AmazonBedrockEndpoint

Wisej.AI.Endpoints.AmazonBedrockEndpoint

Namespace: Wisej.AI.Endpoints

Assembly: Wisej.AI (3.5.0.0)

Represents an endpoint for connecting to Amazon Bedrock services.

public class AmazonBedrockEndpoint : 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

The payload to which messages are added.

session

The current session context.

messages

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

The message payload to modify.

session

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

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

The response containing the assistant's 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

The message object to update with usage data.

reply

The dynamic reply object containing usage information.

Last updated