AzureAIEndpoint

Wisej.AI.Endpoints.AzureAIEndpoint

Namespace: Wisej.AI.Endpoints

Assembly: Wisej.AI (3.5.0.0)

Represents an endpoint for connecting to Azure AI services, specifically designed to interact with OpenAI models.

public class AzureAIEndpoint : SmartHttpEndpoint

This class provides properties and methods to configure and interact with Azure AI endpoints, allowing for operations such as generating text completions and embeddings.

Constructors

AzureAIEndpoint()

Initializes a new instance of the AzureAIEndpoint class with default settings.

Properties

ApiVersion

String: Gets or sets the API version used for requests. (Default: "2024-02-01")

Authentication

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

EmbeddingModel

String: Gets or sets the model used for generating text embeddings. (Default: "text-embedding-3-small")

Model

String: Gets or sets the model used for generating text completions. (Default: "gpt-4o")

URL

String: Gets or sets the URL of the Azure AI endpoint. (Default: "https://YOUR_RESOURCE_NAME.openai.azure.com")

Methods

AddOptions(message, session)

Adds options to the message for a session.

Parameter
Type
Description

message

The message to which options are added.

session

The session context.

BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.

Parameter
Type
Description

inputs

The input strings for which embeddings are requested.

Returns: Object. An object representing the payload for the embeddings request.

Throws:

GetApiURL()

Constructs the API URL for text completion requests.

Returns: String. A string representing the API URL.

GetEmbeddingsURL()

Constructs the API URL for embedding requests.

Returns: String. A string representing the embeddings API URL.

ReadAssistantMessage(response, message)

Reads the assistant's message from the response.

Parameter
Type
Description

response

The response from the API.

message

The message object to populate.

Throws:

ReadEmbeddingsResponse(response)

Reads the embeddings from the response.

Parameter
Type
Description

response

The response from the API.

Returns: Single[][]. A jagged array of floats representing the embeddings.

Throws:

ReadUsage(message, reply)

Reads the usage statistics from the reply and updates the message.

Parameter
Type
Description

message

The message object to update.

reply

The dynamic reply object containing usage data.

Last updated