Skip to content

Commit 5b8efb6

Browse files
committed
Merge branch 'main' into release-2024-march-openai-ga
2 parents 4bf915b + c011042 commit 5b8efb6

File tree

156 files changed

+2589
-2641
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+2589
-2641
lines changed

.openpublishing.redirection.active-directory.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33690,6 +33690,6 @@
3369033690
"source_path_from_root": "/articles/active-directory-domain-services/contact-us.md",
3369133691
"redirect_url": "/azure/active-directory/fundamentals/support-help-options",
3369233692
"redirect_document_id": false
33693-
},
33693+
}
3369433694
]
33695-
}
33695+
}

.openpublishing.redirection.sql-database.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2580,6 +2580,6 @@
25802580
"source_path_from_root": "/articles/sql-data-warehouse/sql-data-warehouse-security-threat-detection.md",
25812581
"redirect_url": "/azure/sql-database/sql-database-threat-detection-overview",
25822582
"redirect_document_id": false
2583-
},
2583+
}
25842584
]
25852585
}

articles/ai-services/openai/assistants-quickstart.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ms.topic: quickstart
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
ms.date: 02/01/2024
12-
zone_pivot_groups: openai-quickstart
12+
zone_pivot_groups: openai-quickstart-assistants
1313
recommendations: false
1414
---
1515

@@ -30,6 +30,12 @@ Azure OpenAI Assistants (Preview) allows you to create AI assistants tailored to
3030

3131
::: zone-end
3232

33+
::: zone pivot="programming-language-csharp"
34+
35+
[!INCLUDE [C# quickstart](includes/assistants-csharp.md)]
36+
37+
::: zone-end
38+
3339
::: zone pivot="rest-api"
3440

3541
[!INCLUDE [REST API quickstart](includes/assistants-rest.md)]
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
---
2+
title: 'Quickstart: Use the OpenAI Service via the .NET SDK'
3+
titleSuffix: Azure OpenAI Service
4+
description: Walkthrough on how to get started with Azure OpenAI and make your first completions call with the .NET SDK.
5+
manager: masoucou
6+
author: aapowell
7+
ms.author: aapowell
8+
ms.service: azure-ai-openai
9+
ms.topic: include
10+
ms.date: 03/05/2024
11+
---
12+
13+
[Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/openai/Azure.AI.OpenAI/src) | [Package (NuGet)](https://www.nuget.org/packages/Azure.AI.OpenAI/)
14+
15+
## Prerequisites
16+
17+
- An Azure subscription - <a href="https://azure.microsoft.com/free/cognitive-services" target="_blank">Create one for free</a>
18+
- Access granted to Azure OpenAI in the desired Azure subscription
19+
20+
Currently, access to this service is granted only by application. You can apply for access to Azure OpenAI by completing the form at <a href="https://aka.ms/oai/access" target="_blank">https://aka.ms/oai/access</a>. Open an issue on this repo to contact us if you have an issue.
21+
- The [.NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0)
22+
- Azure OpenAI Assistants are currently available in Sweden Central, East US 2, and Australia East. For more information about model availability in those regions, see the [models guide](../concepts/models.md).
23+
- We recommend reviewing the [Responsible AI transparency note](/legal/cognitive-services/openai/transparency-note?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext&tabs=text) and other [Responsible AI resources](/legal/cognitive-services/openai/overview?context=%2Fazure%2Fai-services%2Fopenai%2Fcontext%2Fcontext) to familiarize yourself with the capabilities and limitations of the Azure OpenAI Service.
24+
- An Azure OpenAI resource with the `gpt-4 (1106-preview)` model deployed was used testing this example.
25+
26+
## Set up
27+
28+
### Create a new .NET Core application
29+
30+
In a console window (such as cmd, PowerShell, or Bash), use the `dotnet new` command to create a new console app with the name `azure-openai-quickstart`. This command creates a simple "Hello World" project with a single C# source file: *Program.cs*.
31+
32+
```dotnetcli
33+
dotnet new console -n azure-openai-assistants-quickstart
34+
```
35+
36+
Change your directory to the newly created app folder. You can build the application with:
37+
38+
```dotnetcli
39+
dotnet build
40+
```
41+
42+
The build output should contain no warnings or errors.
43+
44+
```output
45+
...
46+
Build succeeded.
47+
0 Warning(s)
48+
0 Error(s)
49+
...
50+
```
51+
52+
Install the OpenAI .NET client library with:
53+
54+
```console
55+
dotnet add package Azure.AI.OpenAI.Assistants --prerelease
56+
```
57+
58+
[!INCLUDE [get-key-endpoint](get-key-endpoint.md)]
59+
60+
[!INCLUDE [environment-variables](environment-variables.md)]
61+
62+
## Create an assistant
63+
64+
In our code we are going to specify the following values:
65+
66+
| **Name** | **Description** |
67+
|:---|:---|
68+
| **Assistant name** | Your deployment name that is associated with a specific model. |
69+
| **Instructions** | Instructions are similar to system messages this is where you give the model guidance about how it should behave and any context it should reference when generating a response. You can describe the assistant's personality, tell it what it should and shouldn't answer, and tell it how to format responses. You can also provide examples of the steps it should take when answering responses. |
70+
| **Model** | This is where you set which model deployment name to use with your assistant. The retrieval tool requires `gpt-35-turbo (1106)` or `gpt-4 (1106-preview)` model. **Set this value to your deployment name, not the model name unless it is the same.** |
71+
| **Code interpreter** | Code interpreter provides access to a sandboxed Python environment that can be used to allow the model to test and execute code. |
72+
73+
### Tools
74+
75+
An individual assistant can access up to 128 tools including `code interpreter`, as well as any custom tools you create via [functions](../how-to/assistant-functions.md).
76+
77+
Create and run an assistant with the following:
78+
79+
```csharp
80+
using Azure;
81+
using Azure.AI.OpenAI.Assistants;
82+
83+
string endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new ArgumentNullException("AZURE_OPENAI_ENDPOINT");
84+
string key = Environment.GetEnvironmentVariable("AZURE_OPENAI_API_KEY") ?? throw new ArgumentNullException("AZURE_OPENAI_API_KEY");
85+
AssistantsClient client = new AssistantsClient(new Uri(endpoint), new AzureKeyCredential(key));
86+
87+
// Create an assistant
88+
Assistant assistant = await client.CreateAssistantAsync(
89+
new AssistantCreationOptions("gpt-4-1106-preview") // Replace this with the name of your model deployment
90+
{
91+
Name = "Math Tutor",
92+
Instructions = "You are a personal math tutor. Write and run code to answer math questions.",
93+
Tools = { new CodeInterpreterToolDefinition() }
94+
});
95+
96+
// Create a thread
97+
AssistantThread thread = await client.CreateThreadAsync();
98+
99+
// Add a user question to the thread
100+
ThreadMessage message = await client.CreateMessageAsync(
101+
thread.Id,
102+
MessageRole.User,
103+
"I need to solve the equation `3x + 11 = 14`. Can you help me?");
104+
105+
// Run the thread
106+
ThreadRun run = await client.CreateRunAsync(
107+
thread.Id,
108+
new CreateRunOptions(assistant.Id)
109+
);
110+
111+
// Wait for the assistant to respond
112+
do
113+
{
114+
await Task.Delay(TimeSpan.FromMilliseconds(500));
115+
run = await client.GetRunAsync(thread.Id, run.Id);
116+
}
117+
while (run.Status == RunStatus.Queued
118+
|| run.Status == RunStatus.InProgress);
119+
120+
// Get the messages
121+
PageableList<ThreadMessage> messagesPage = await client.GetMessagesAsync(thread.Id);
122+
IReadOnlyList<ThreadMessage> messages = messagesPage.Data;
123+
124+
// Note: messages iterate from newest to oldest, with the messages[0] being the most recent
125+
foreach (ThreadMessage threadMessage in messages.Reverse())
126+
{
127+
Console.Write($"{threadMessage.CreatedAt:yyyy-MM-dd HH:mm:ss} - {threadMessage.Role,10}: ");
128+
foreach (MessageContent contentItem in threadMessage.ContentItems)
129+
{
130+
if (contentItem is MessageTextContent textItem)
131+
{
132+
Console.Write(textItem.Text);
133+
}
134+
Console.WriteLine();
135+
}
136+
}
137+
```
138+
139+
This will print an output as follows:
140+
141+
```
142+
2024-03-05 03:38:17 - user: I need to solve the equation `3x + 11 = 14`. Can you help me?
143+
2024-03-05 03:38:25 - assistant: The solution to the equation \(3x + 11 = 14\) is \(x = 1\).
144+
```
145+
146+
New messages can be created on the thread before re-running, which will see the assistant use the past messages as context within the thread.
147+
148+
## Clean up resources
149+
150+
If you want to clean up and remove an OpenAI resource, you can delete the resource or resource group. Deleting the resource group also deletes any other resources associated with it.
151+
152+
- [Portal](../../multi-service-resource.md?pivots=azportal#clean-up-resources)
153+
- [Azure CLI](../../multi-service-resource.md?pivots=azcli#clean-up-resources)
154+
155+
## See also
156+
157+
* Learn more about how to use Assistants with our [How-to guide on Assistants](../how-to/assistant.md).
158+
* [Azure OpenAI Assistants API samples](https://github.com/Azure-Samples/azureai-samples/tree/main/scenarios/Assistants)

articles/ai-services/openai/references/azure-search.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to use Azure OpenAI on your Azure Search data Python & RE
55
manager: nitinme
66
ms.service: azure-ai-openai
77
ms.topic: conceptual
8-
ms.date: 02/14/2024
8+
ms.date: 03/12/2024
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
recommendations: false
@@ -14,7 +14,7 @@ ms.custom: devx-track-python
1414

1515
# Data source - Azure AI Search
1616

17-
The configurable options of Azure AI Search when using Azure OpenAI On Your Data. This data source is supported in API version `2024-02-15-preview`.
17+
The configurable options of Azure AI Search when using Azure OpenAI On Your Data. This data source is supported in API version `2024-02-01`.
1818

1919
|Name | Type | Required | Description |
2020
|--- | --- | --- | --- |
@@ -141,7 +141,7 @@ token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://co
141141
client = AzureOpenAI(
142142
azure_endpoint=endpoint,
143143
azure_ad_token_provider=token_provider,
144-
api_version="2024-02-15-preview",
144+
api_version="2024-02-01",
145145
)
146146

147147
completion = client.chat.completions.create(
@@ -176,7 +176,7 @@ print(completion.model_dump_json(indent=2))
176176

177177
```bash
178178
az rest --method POST \
179-
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-15-preview \
179+
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-01 \
180180
--resource https://cognitiveservices.azure.com/ \
181181
--body \
182182
'

articles/ai-services/openai/references/cosmos-db.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to use Azure OpenAI on your Azure Cosmos DB data Python &
55
manager: nitinme
66
ms.service: azure-ai-openai
77
ms.topic: conceptual
8-
ms.date: 02/14/2024
8+
ms.date: 03/12/2024
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
recommendations: false
@@ -14,7 +14,7 @@ ms.custom: devx-track-python
1414

1515
# Data source - Azure Cosmos DB for MongoDB vCore
1616

17-
The configurable options of Azure Cosmos DB for MongoDB vCore when using Azure OpenAI On Your Data. This data source is supported in API version `2024-02-15-preview`.
17+
The configurable options of Azure Cosmos DB for MongoDB vCore when using Azure OpenAI On Your Data. This data source is supported in API version `2024-02-01`.
1818

1919
|Name | Type | Required | Description |
2020
|--- | --- | --- | --- |
@@ -127,7 +127,7 @@ token_provider = get_bearer_token_provider(
127127
client = AzureOpenAI(
128128
azure_endpoint=endpoint,
129129
azure_ad_token_provider=token_provider,
130-
api_version="2024-02-15-preview",
130+
api_version="2024-02-01",
131131
)
132132

133133
completion = client.chat.completions.create(
@@ -178,7 +178,7 @@ print(completion.model_dump_json(indent=2))
178178
```bash
179179

180180
az rest --method POST \
181-
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-15-preview \
181+
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-01 \
182182
--resource https://cognitiveservices.azure.com/ \
183183
--body \
184184
'

articles/ai-services/openai/references/on-your-data.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to use Azure OpenAI On Your Data Python & REST API.
55
manager: nitinme
66
ms.service: azure-ai-openai
77
ms.topic: conceptual
8-
ms.date: 02/14/2024
8+
ms.date: 03/12/2024
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
recommendations: false
@@ -14,10 +14,10 @@ ms.custom: devx-track-python
1414

1515
# Azure OpenAI On Your Data API Reference
1616

17-
This article provides reference documentation for Python and REST for the new Azure OpenAI On Your Data API. The latest preview api-version is `2024-02-15-preview` [Swagger spec](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-02-15-preview/inference.json).
17+
This article provides reference documentation for Python and REST for the new Azure OpenAI On Your Data API. The latest API version is `2024-02-01` [Swagger spec](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-02-01).
1818

1919
> [!NOTE]
20-
> Since `2024-02-15-preview` we introduced the following breaking changes comparing to earlier API versions:
20+
> Since API version `2024-02-15-preview` we introduced the following breaking changes comparing to earlier API versions:
2121
> * The API path is changed from `/extensions/chat/completions` to `/chat/completions`.
2222
> * The naming convention of property keys and enum values is changed from camel casing to snake casing. Example: `deploymentName` is changed to `deployment_name`.
2323
> * The data source type `AzureCognitiveSearch` is changed to `azure_search`.
@@ -27,6 +27,13 @@ This article provides reference documentation for Python and REST for the new Az
2727
POST {endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}
2828
```
2929

30+
**Supported versions**
31+
* `2024-02-15-preview` [Swagger spec](https://github.com/Azure/azure-rest-api-specs/blob/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/preview/2024-02-15-preview/inference.json)
32+
* `2024-02-01` [Swagger spec](https://github.com/Azure/azure-rest-api-specs/tree/main/specification/cognitiveservices/data-plane/AzureOpenAI/inference/stable/2024-02-01).
33+
34+
> [!NOTE]
35+
> [Azure Machine learning indexes](./azure-machine-learning.md), [Pinecone](./pinecone.md), and [Elasticsearch](./elasticsearch.md) are only supported in the `2024-02-15-preview` API version.
36+
3037
## URI parameters
3138

3239
|Name | In | Type | Required | Description |
@@ -118,7 +125,7 @@ token_provider = get_bearer_token_provider(DefaultAzureCredential(), "https://co
118125
client = AzureOpenAI(
119126
azure_endpoint=endpoint,
120127
azure_ad_token_provider=token_provider,
121-
api_version="2024-02-15-preview",
128+
api_version="2024-02-01",
122129
)
123130

124131
completion = client.chat.completions.create(
@@ -164,7 +171,7 @@ print(completion.model_dump_json(indent=2))
164171

165172
```bash
166173
az rest --method POST \
167-
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-15-preview \
174+
--uri $AzureOpenAIEndpoint/openai/deployments/$ChatCompletionsDeploymentName/chat/completions?api-version=2024-02-01 \
168175
--resource https://cognitiveservices.azure.com/ \
169176
--body \
170177
'

articles/ai-services/speech-service/batch-transcription-create.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ Azure AI Speech supports OpenAI's Whisper model by using the batch transcription
255255
To use a Whisper model for batch transcription, you need to set the `model` property. Whisper is a display-only model, so the lexical field isn't populated in the response.
256256

257257
> [!IMPORTANT]
258-
> Whisper models are currently in preview. You should always use [version 3.2](./migrate-v3-1-to-v3-2.md) of the speech to text API, which is available in a separate preview, for Whisper models.
258+
> For Whisper models, you should always use [version 3.2](./migrate-v3-1-to-v3-2.md) of the speech to text API.
259259
260260
Whisper models by batch transcription are supported in the East US, Southeast Asia, and West Europe regions.
261261

@@ -285,36 +285,38 @@ spx csr list --base --api-version v3.2-preview.1
285285

286286
::: zone-end
287287

288-
The `displayName` property of a Whisper model contains "Whisper Preview" as shown in this example. Whisper is a display-only model, so the lexical field isn't populated in the transcription.
288+
The `displayName` property of a Whisper model contains "Whisper" as shown in this example. Whisper is a display-only model, so the lexical field isn't populated in the transcription.
289289

290290
```json
291291
{
292-
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/d9cbeee6-582b-47ad-b5c1-6226583c92b6",
292+
"self": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/e418c4a9-9937-4db7-b2c9-8afbff72d950",
293293
"links": {
294-
"manifest": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/d9cbeee6-582b-47ad-b5c1-6226583c92b6/manifest"
294+
"manifest": "https://eastus.api.cognitive.microsoft.com/speechtotext/v3.2-preview.1/models/base/e418c4a9-9937-4db7-b2c9-8afbff72d950/manifest"
295295
},
296296
"properties": {
297297
"deprecationDates": {
298-
"adaptationDateTime": "2024-10-15T00:00:00Z",
299-
"transcriptionDateTime": "2025-10-15T00:00:00Z"
298+
"adaptationDateTime": "2025-04-15T00:00:00Z",
299+
"transcriptionDateTime": "2026-04-15T00:00:00Z"
300300
},
301301
"features": {
302302
"supportsTranscriptions": true,
303303
"supportsEndpoints": false,
304304
"supportsTranscriptionsOnSpeechContainers": false,
305-
"supportsAdaptationsWith": [],
305+
"supportsAdaptationsWith": [
306+
"Acoustic"
307+
],
306308
"supportedOutputFormats": [
307309
"Display"
308310
]
309311
},
310-
"chargeForAdaptation": false
312+
"chargeForAdaptation": true
311313
},
312-
"lastActionDateTime": "2023-07-19T12:46:27Z",
314+
"lastActionDateTime": "2024-02-29T15:53:28Z",
313315
"status": "Succeeded",
314-
"createdDateTime": "2023-07-19T12:39:52Z",
316+
"createdDateTime": "2024-02-29T15:46:07Z",
315317
"locale": "en-US",
316-
"displayName": "20230707 Whisper Preview",
317-
"description": "en-US base model"
318+
"displayName": "20240228 Whisper Large V2",
319+
"description": "OpenAI Whisper Model in Azure AI Speech (Whisper v2-large)"
318320
},
319321
```
320322

articles/aks/azure-cni-overlay.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ az aks nodepool add -g $resourceGroup --cluster-name $clusterName \
138138
>
139139
> - The cluster is on Kubernetes version 1.22+.
140140
> - Doesn't use the dynamic pod IP allocation feature.
141-
> - Doesn't have network policies enabled.
141+
> - Doesn't have network policies enabled. Network Policy engine can be uninstalled before the upgrade, see [Uninstall Azure Network Policy Manager or Calico](use-network-policies.md#uninstall-azure-network-policy-manager-or-calico-preview)
142142
> - Doesn't use any Windows node pools with docker as the container runtime.
143143
144144
> [!NOTE]

0 commit comments

Comments
 (0)