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
@@ -36,7 +36,7 @@ import { DefaultAzureCredential } from "@azure/identity";
36
36
const credential =newDefaultAzureCredential();
37
37
```
38
38
39
-
This object is then passed to the second argument of the `OpenAIClient` and `AssistantsClient` client constructors.
39
+
This object is then passed as part of the [`AzureClientOptions`](#configuration) object to the `AzureOpenAI` and `AssistantsClient` client constructors.
40
40
41
41
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:
For more information about Azure OpenAI keyless authentication, see the "[Get started with the Azure OpenAI security building block](/azure/developer/ai/get-started-securing-your-ai-app?tabs=github-codespaces&pivots=typescript)" QuickStart article.
61
62
62
-
# [API Key](#tab/api-key)
63
63
64
-
API Key
64
+
### Configuration
65
+
66
+
The `AzureClientOptions` object extends the OpenAI `ClientOptions` object. This Azure-specific client object is used to configure the connection and behavior of the Azure OpenAI client. It includes properties for specifying the properties unique to Azure.
65
67
66
-
API keys are not recommended for production use because they are less secure than other authentication methods.
68
+
| Property | Details |
69
+
|--|--|
70
+
| apiVersion: `string`| Specifies the API version to use. |
71
+
| azureADTokenProvider: `(() => Promise<string>)`| A function that returns an access token for Microsoft Entra (formerly known as Azure Active Directory), invoked on every request.|
72
+
| deployment: `string`| A model deployment. If provided, sets the base client URL to include `/deployments/{deployment}`. Non-deployment endpoints can't be used (not supported with Assistants APIs).|
73
+
| endpoint: `string`| Your Azure OpenAI endpoint with the following format: `https://RESOURCE-NAME.azure.openai.com/`.|
74
+
75
+
# [API Key](#tab/api-key)
76
+
77
+
API keys aren't recommended for production use because they're less secure than other authentication methods.
`AzureOpenAI` can be authenticated with an API key by setting the `AZURE_OPENAI_API_KEY` environment variable or by setting the `apiKey` string property in the options object when creating the `AzureOpenAI` client.
The `AzureClientOptions` object extends the OpenAI `ClientOptions` object. This Azure-specific client object is used to configure the connection and behavior of the Azure OpenAI client. It includes properties for specifying the properties unique to Azure.
80
97
98
+
| Property | Details |
99
+
|--|--|
100
+
| apiKey: `string`| Your API key for authenticating requests. |
101
+
| apiVersion: `string`| Specifies the API version to use. |
102
+
| deployment: `string`| A model deployment. If provided, sets the base client URL to include `/deployments/{deployment}`. Non-deployment endpoints can't be used (not supported with Assistants APIs).|
103
+
| endpoint: `string`| Your Azure OpenAI endpoint with the following format: `https://RESOURCE-NAME.azure.openai.com/`.|
0 commit comments