AmazonBedrockEndpoint
Namespace: Wisej.AI.Endpoints
Assembly: Wisej.AI
Represents an endpoint for connecting to Amazon Bedrock services.
- C#
- VB.NET
public class AmazonBedrockEndpoint : SmartHttpEndpoint
Public Class AmazonBedrockEndpoint
Inherits SmartHttpEndpoint
This class is used to configure and manage connections to Amazon Bedrock endpoints, specifically for interacting with the Anthropic API.
Constructors
AmazonBedrockEndpoint()
Initializes a new instance of the AmazonBedrockEndpoint 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 for the endpoint. (Default: "claude-3-opus-20240229")
URL
String: Gets or sets the URL for the endpoint. (Default: "https://api.anthropic.com/v1/messages")
Methods
AddMessages(payload, session, messages)
Adds messages to the payload.
| Parameter | Type | Description |
|---|---|---|
| payload | Object | The payload to which messages are added. |
| session | SmartSession | The current session context. |
| messages | IList<Message> | The list of messages to add. |
Ensures the system message is complete and prepares the payload for sending.
AddOptions(message, session)
Adds options to the message payload.
| Parameter | Type | Description |
|---|---|---|
| message | Object | The message payload to modify. |
| session | SmartSession | The current session context. |
Sets default values for temperature and max tokens in the message payload.
BuildMessage(message)
Builds a message object from a Message instance.
| Parameter | Type | Description |
|---|---|---|
| message | Message | The message to convert. |
Returns: Object. A dynamic object representing the message.
Handles different input types, including text and images.
ReadAssistantMessage(response, message)
Reads the assistant's message from the response.
| Parameter | Type | Description |
|---|---|---|
| response | Response | The response containing the assistant's message. |
| message | Message | The message object to populate. |
Parses the response stream to extract the assistant's message content.
ReadUsage(message, reply)
Reads the usage information from the reply.
| Parameter | Type | Description |
|---|---|---|
| message | Message | The message object to update with usage data. |
| reply | Object | The dynamic reply object containing usage information. |