> For the complete documentation index, see [llms.txt](https://docs.wisej.com/ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.azureaiendpoint.md).

# AzureAIEndpoint

Namespace: **Wisej.AI.Endpoints**

Assembly: **Wisej.AI** (3.5.0.0)

* [SmartEndpoint](/ai/components/api/smartendpoint.md)
  * [SmartHttpEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.smarthttpendpoint.md)
    * [AzureAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.azureaiendpoint.md)

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

{% tabs %}
{% tab title="C#" %}

```csharp
public class AzureAIEndpoint : SmartHttpEndpoint
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class AzureAIEndpoint
    Inherits SmartHttpEndpoint
```

{% endtab %}
{% endtabs %}

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

### ![](/files/ptrKjmmRoQB76pvrIqh0) AzureAIEndpoint()

Initializes a new instance of the [AzureAIEndpoint](/ai/components/api/smartendpoint/wisej.ai.endpoints.azureaiendpoint.md) class with default settings.

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) ApiVersion

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the API version used for requests. (Default: `"2024-02-01"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Authentication

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the authentication method for the endpoint. (Default: `"api-key"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) EmbeddingModel

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for generating text embeddings. (Default: `"text-embedding-3-small"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) Model

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the model used for generating text completions. (Default: `"gpt-4o"`)

### ![](/files/ptrKjmmRoQB76pvrIqh0) URL

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the URL of the Azure AI endpoint. (Default: `"https://YOUR_RESOURCE_NAME.openai.azure.com"`)

## Methods

### ![](/files/KL0Ik37djZRr8a07Wopd) AddOptions(message, session)

Adds options to the message for a session.

| Parameter   | Type                                                          | Description                             |
| ----------- | ------------------------------------------------------------- | --------------------------------------- |
| **message** | [Object](https://docs.microsoft.com/dotnet/api/system.object) | The message to which options are added. |
| **session** | [SmartSession](/ai/components/api/smartsession.md)            | The session context.                    |

### ![](/files/KL0Ik37djZRr8a07Wopd) BuildEmbeddingsPayload(inputs)

Builds the payload for an embeddings request.

| Parameter  | Type                                                              | Description                                           |
| ---------- | ----------------------------------------------------------------- | ----------------------------------------------------- |
| **inputs** | [String\[\]](https://docs.microsoft.com/dotnet/api/system.string) | The input strings for which embeddings are requested. |

**Returns:** [Object](https://docs.microsoft.com/dotnet/api/system.object). An object representing the payload for the embeddings request.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when inputs is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetApiURL()

Constructs the API URL for text completion requests.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). A string representing the API URL.

### ![](/files/KL0Ik37djZRr8a07Wopd) GetEmbeddingsURL()

Constructs the API URL for embedding requests.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). A string representing the embeddings API URL.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadAssistantMessage(response, message)

Reads the assistant's message from the response.

| Parameter    | Type                                                                            | Description                     |
| ------------ | ------------------------------------------------------------------------------- | ------------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response from the API.      |
| **message**  | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md)     | The message object to populate. |

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when response or message is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadEmbeddingsResponse(response)

Reads the embeddings from the response.

| Parameter    | Type                                                                            | Description                |
| ------------ | ------------------------------------------------------------------------------- | -------------------------- |
| **response** | [Response](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.response.md) | The response from the API. |

**Returns:** [Single\[\]\[\]](https://docs.microsoft.com/dotnet/api/system.single). A jagged array of floats representing the embeddings.

**Throws:**

* [ArgumentNullException](https://docs.microsoft.com/dotnet/api/system.argumentnullexception)\
  Thrown when response is null.

### ![](/files/KL0Ik37djZRr8a07Wopd) ReadUsage(message, reply)

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

| Parameter   | Type                                                                        | Description                                     |
| ----------- | --------------------------------------------------------------------------- | ----------------------------------------------- |
| **message** | [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md) | The message object to update.                   |
| **reply**   | [Object](https://docs.microsoft.com/dotnet/api/system.object)               | The dynamic reply object containing usage data. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartendpoint/wisej.ai.endpoints.azureaiendpoint.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
