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
Copy file name to clipboardExpand all lines: articles/ai-foundry/foundry-models/how-to/use-chat-completions.md
+71-8Lines changed: 71 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ ms.custom: generated
15
15
16
16
# How to generate chat completions with Azure AI Foundry Models
17
17
18
-
This article explains how to generate chat completions with Azure AI Foundry Model deployments by using the unified OpenAI v1 chat completion endpoint, also referred to as the v1 Azure OpenAI APIs. The unified endpoint eliminates the need for separate Azure-specific code paths.
18
+
This article explains how to generate chat completions using next generation v1 Azure OpenAI APIs.
19
19
20
20
## Prerequisites
21
21
@@ -28,7 +28,7 @@ To use chat completion models in your application, you need:
28
28
29
29
## v1 Azure OpenAI APIs
30
30
31
-
The v1 Azure OpenAI APIs use the `OpenAI()` client instead of the deprecated `AzureOpenAI()` client. The v1 Azure OpenAI APIs add support for:
31
+
The next generation v1 Azure OpenAI APIs let you use the `OpenAI()` client in the official OpenAI client libraries across languages instead of the `AzureOpenAI()` client. The v1 Azure OpenAI APIs add support for:
32
32
33
33
- Ongoing access to the latest features, with no need to frequently specify new values for the `api-version` parameter.
34
34
- OpenAI client support with minimal code changes to swap between OpenAI and Azure OpenAI when using key-based authentication.
@@ -183,6 +183,8 @@ Microsoft Entra authentication only supports Azure OpenAI resources. Complete th
First install the Azure Identity client library. For how to install this library, see [Azure Identity client library for Java](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity/README.md#include-the-package).
319
+
Authentication with Microsoft Entra ID requires some initial setup. First install the Azure Identity client library. For more options on how to install this library, see [Azure Identity client library for Java](https://github.com/Azure/azure-sdk-for-java/blob/main/sdk/identity/azure-identity/README.md#include-the-package).
320
+
321
+
322
+
Add the Azure Identity client library:
323
+
324
+
```xml
325
+
<dependency>
326
+
<groupId>com.azure</groupId>
327
+
<artifactId>azure-identity</artifactId>
328
+
<version>1.18.0</version>
329
+
</dependency>
330
+
```
331
+
332
+
After setup, you can choose which type of credential from `azure.identity` to use. As an example, `DefaultAzureCredential` can be used to authenticate the client.
333
+
334
+
Authentication is easiest using `DefaultAzureCredential`. It finds the best credential to use in its running environment.
First install the Azure Identity client library before you can use DefaultAzureCredential:
538
+
539
+
```bash
482
540
npm install @azure/identity
483
541
```
484
542
485
543
To authenticate the `OpenAI` client, use the `getBearerTokenProvider` function from the `@azure/identity` package. This function creates a token provider that `OpenAI` uses internally to obtain tokens for each request. Create the token provider as follows:
Use the [azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity) module for Microsoft Entra ID authentication with Azure OpenAI.
559
616
617
+
Install the Azure Identity module:
618
+
619
+
```bash
620
+
go get -u github.com/Azure/azure-sdk-for-go/sdk/azidentity
0 commit comments