AnthropicEndpoint
Wisej.AI.Endpoints.AnthropicEndpoint
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI (3.5.0.0)
Represents an endpoint for connecting to Anthropic services.
public class AnthropicEndpoint : SmartHttpEndpoint
This class is used to configure and manage connections to Anthropic endpoints, providing methods to send messages and handle responses. It inherits from SmartHttpEndpoint.
Constructors
AnthropicEndpoint()

Initializes a new instance of the AnthropicEndpoint class.
Sets default values for authentication, model, URL, and headers.
Properties
Authentication

String: Gets or sets the authentication method for the endpoint. (Default: "x-api-key"
)
Model

String: Gets or sets the model used by the Anthropic endpoint. (Default: "claude-3-5-sonnet-20241022"
)
URL

String: Gets or sets the URL for the Anthropic API endpoint. (Default: "https://api.anthropic.com/v1/messages"
)
Methods
AddMessages(payload, session, messages)

Adds messages to the payload for the Anthropic API request.
Prepares the system message and other messages for the API request.Throws:
ArgumentNullException Thrown if session , payload , or messages is null.
AddOptions(message, session)

Adds options to the message before sending it to the Anthropic endpoint.
Sets default values for temperature and max tokens in the message.
BuildMessage(message)

Builds a message object for the Anthropic API.
Returns: Object. An object representing the message for the API.
Handles different input types, including text and images.Throws:
ArgumentNullException Thrown if message is null.
ReadAssistantMessage(response, message)

Reads the assistant's message from the response.
Parses the response content and updates the message text.Throws:
ArgumentNullException Thrown if response or message is null.
ReadUsage(message, reply)

Reads the usage information from the API reply.
Last updated