You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -25,6 +25,33 @@ Feature availability in Azure OpenAI is dependent on what version of the REST AP
25
25
npm install openai
26
26
```
27
27
28
+
## Configuration
29
+
30
+
The `AzureClientOptions` object is used to configure the API client for interfacing with the Azure OpenAI API. The configuration object extends the existing OpenAi `ClientOptions` object. Below are the Azure OpenAI specific properties, their default values, and descriptions:
31
+
32
+
**Properties**:
33
+
34
+
* azureADTokenProvider:
35
+
Type: (() => Promise<string>) | undefined
36
+
Default: undefined
37
+
Description: A function that returns an access token for Microsoft Entra (formerly known as Azure Active Directory), which will be invoked on every request.
38
+
* apiKey:
39
+
Type: string | undefined
40
+
Default: process.env['AZURE_OPENAI_API_KEY']
41
+
Description: Your API key for authenticating requests.
42
+
* apiVersion:
43
+
Type: string | undefined
44
+
Default: process.env['OPENAI_API_VERSION']
45
+
Description: Specifies the API version to use.
46
+
* deployment:
47
+
Type: string | undefined
48
+
Default: undefined
49
+
Description: A model deployment. If given, sets the base client URL to include /deployments/{deployment}. Note: this means you won't be able to use non-deployment endpoints. Not supported with Assistants APIs.
50
+
* endpoint:
51
+
Type: string | undefined
52
+
Default: undefined
53
+
Description: Your Azure endpoint, including the resource, e.g. https://example-resource.azure.openai.com/.
54
+
28
55
## Authentication
29
56
30
57
# [Microsoft Entra ID](#tab/secure)
@@ -36,7 +63,7 @@ import { DefaultAzureCredential } from "@azure/identity";
36
63
const credential =newDefaultAzureCredential();
37
64
```
38
65
39
-
This object is then passed to the second argument of the `OpenAIClient` and `AssistantsClient` client constructors.
66
+
This object is then passed as part of the [`AzureClientOptions`](#configuration) object to the `AzureOpenAI` and `AssistantsClient` client constructors.
40
67
41
68
In order to authenticate the `AzureOpenAI` client, however, we need to use the `getBearerTokenProvider` function from the `@azure/identity` package. This function creates a token provider that `AzureOpenAI` uses internally to obtain tokens for each request. The token provider is created as follows:
|`endpoint`|`process.env.AZURE_COSMOS_DB_ENDPOINT`| The endpoint URL for the Azure Cosmos DB instance. |
112
+
|`key`|`process.env.AZURE_COSMOS_DB_KEY`| The primary key for accessing the Azure Cosmos DB instance. |
113
+
|`databaseName`|`process.env.AZURE_COSMOS_DB_DATABASE`| The name of the database to connect to within the Azure Cosmos DB. |
114
+
|`containerName`|`process.env.AZURE_COSMOS_DB_CONTAINER`| The name of the container (collection) within the database. |
115
+
|`aadCredentials`|`new DefaultAzureCredential()`| Azure Active Directory credentials for authentication. |
116
+
|`consistencyLevel`|`Session`| The consistency level for read operations (e.g., Strong, BoundedStaleness, Session, Eventual). |
117
+
|`connectionPolicy`|`Default`| The connection policy for the Cosmos DB client, including retry options and preferred locations. |
118
+
|`timeout`|`60000` (60 seconds) | The timeout duration for requests to the Azure Cosmos DB instance. |
119
+
120
+
## Description
121
+
122
+
The `AzureClientOptions` object is used to configure the connection and behavior of the Azure Cosmos DB client. It includes properties for specifying the endpoint, authentication credentials, database and container names, consistency level, connection policy, and request timeout.
0 commit comments