Skip to main content

AzureAIEndpoint

Namespace: Wisej.AI.Endpoints

Assembly: Wisej.AI

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.

ParameterTypeDescription
messageObjectThe message to which options are added.
sessionSmartSessionThe session context.

BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.

ParameterTypeDescription
inputsString[]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.

ParameterTypeDescription
responseResponseThe response from the API.
messageMessageThe message object to populate.

Throws:

ReadEmbeddingsResponse(response)

Reads the embeddings from the response.

ParameterTypeDescription
responseResponseThe 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.

ParameterTypeDescription
messageMessageThe message object to update.
replyObjectThe dynamic reply object containing usage data.