Skip to content

Commit 3ad13b4

Browse files
committed
Merge branch 'main' into release-preview-codestral-model
2 parents b316a89 + 8bae9c8 commit 3ad13b4

16 files changed

+42
-94
lines changed

articles/ai-services/openai/includes/use-your-data-dotnet.md

Lines changed: 21 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: travisw
55
ms.author: travisw
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 03/07/2024
8+
ms.date: 01/09/2025
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -14,14 +14,12 @@ ms.date: 03/07/2024
1414

1515
From the project directory, open the *Program.cs* file and replace its contents with the following code:
1616

17-
### Without response streaming
18-
1917
```csharp
20-
using Azure;
18+
using System;
2119
using Azure.AI.OpenAI;
20+
using System.ClientModel;
2221
using Azure.AI.OpenAI.Chat;
2322
using OpenAI.Chat;
24-
using System.Text.Json;
2523
using static System.Environment;
2624

2725
string azureOpenAIEndpoint = GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
@@ -31,36 +29,38 @@ string searchEndpoint = GetEnvironmentVariable("AZURE_AI_SEARCH_ENDPOINT");
3129
string searchKey = GetEnvironmentVariable("AZURE_AI_SEARCH_API_KEY");
3230
string searchIndex = GetEnvironmentVariable("AZURE_AI_SEARCH_INDEX");
3331

34-
#pragma warning disable AOAI001
3532
AzureOpenAIClient azureClient = new(
36-
new Uri(azureOpenAIEndpoint),
37-
new AzureKeyCredential(azureOpenAIKey));
33+
new Uri(azureOpenAIEndpoint),
34+
new ApiKeyCredential(azureOpenAIKey));
3835
ChatClient chatClient = azureClient.GetChatClient(deploymentName);
3936

37+
// Extension methods to use data sources with options are subject to SDK surface changes. Suppress the
38+
// warning to acknowledge and this and use the subject-to-change AddDataSource method.
39+
#pragma warning disable AOAI001
40+
4041
ChatCompletionOptions options = new();
4142
options.AddDataSource(new AzureSearchChatDataSource()
4243
{
43-
Endpoint = new Uri(searchEndpoint),
44-
IndexName = searchIndex,
45-
Authentication = DataSourceAuthentication.FromApiKey(searchKey),
44+
Endpoint = new Uri(searchEndpoint),
45+
IndexName = searchIndex,
46+
Authentication = DataSourceAuthentication.FromApiKey(searchKey),
4647
});
4748

4849
ChatCompletion completion = chatClient.CompleteChat(
49-
[
50-
new UserChatMessage("What are my available health plans?"),
51-
], options);
52-
53-
Console.WriteLine(completion.Content[0].Text);
50+
[
51+
new UserChatMessage("What health plans are available?"),
52+
],
53+
options);
5454

55-
AzureChatMessageContext onYourDataContext = completion.GetAzureMessageContext();
55+
ChatMessageContext onYourDataContext = completion.GetMessageContext();
5656

5757
if (onYourDataContext?.Intent is not null)
5858
{
59-
Console.WriteLine($"Intent: {onYourDataContext.Intent}");
59+
Console.WriteLine($"Intent: {onYourDataContext.Intent}");
6060
}
61-
foreach (AzureChatCitation citation in onYourDataContext?.Citations ?? [])
61+
foreach (ChatCitation citation in onYourDataContext?.Citations ?? [])
6262
{
63-
Console.WriteLine($"Citation: {citation.Content}");
63+
Console.WriteLine($"Citation: {citation.Content}");
6464
}
6565
```
6666

@@ -86,72 +86,4 @@ Thank you for your interest in the Contoso electronics plan and benefit packages
8686
learn more about the various options available to you...// Omitted for brevity
8787
```
8888

89-
This will wait until the model has generated its entire response before printing the results. Alternatively, if you want to asynchronously stream the response and print the results, you can replace the contents of *Program.cs* with the code in the next example.
90-
91-
### Async with streaming
92-
93-
```csharp
94-
using Azure;
95-
using Azure.AI.OpenAI;
96-
using Azure.AI.OpenAI.Chat;
97-
using OpenAI.Chat;
98-
using static System.Environment;
99-
100-
string azureOpenAIEndpoint = GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT");
101-
string azureOpenAIKey = GetEnvironmentVariable("AZURE_OPENAI_API_KEY");
102-
string deploymentName = GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_ID");
103-
string searchEndpoint = GetEnvironmentVariable("AZURE_AI_SEARCH_ENDPOINT");
104-
string searchKey = GetEnvironmentVariable("AZURE_AI_SEARCH_API_KEY");
105-
string searchIndex = GetEnvironmentVariable("AZURE_AI_SEARCH_INDEX");
106-
107-
#pragma warning disable AOAI001
108-
109-
AzureOpenAIClient azureClient = new(
110-
new Uri(azureOpenAIEndpoint),
111-
new AzureKeyCredential(azureOpenAIKey));
112-
ChatClient chatClient = azureClient.GetChatClient(deploymentName);
113-
114-
ChatCompletionOptions options = new();
115-
options.AddDataSource(new AzureSearchChatDataSource()
116-
{
117-
Endpoint = new Uri(searchEndpoint),
118-
IndexName = searchIndex,
119-
Authentication = DataSourceAuthentication.FromApiKey(searchKey),
120-
});
121-
122-
var chatUpdates = chatClient.CompleteChatStreamingAsync(
123-
[
124-
new UserChatMessage("What are my available health plans?"),
125-
], options);
126-
127-
AzureChatMessageContext onYourDataContext = null;
128-
await foreach (var chatUpdate in chatUpdates)
129-
{
130-
if (chatUpdate.Role.HasValue)
131-
{
132-
Console.WriteLine($"{chatUpdate.Role}: ");
133-
}
134-
135-
foreach (var contentPart in chatUpdate.ContentUpdate)
136-
{
137-
Console.Write(contentPart.Text);
138-
}
139-
140-
if (onYourDataContext == null)
141-
{
142-
onYourDataContext = chatUpdate.GetAzureMessageContext();
143-
}
144-
}
145-
146-
Console.WriteLine();
147-
if (onYourDataContext?.Intent is not null)
148-
{
149-
Console.WriteLine($"Intent: {onYourDataContext.Intent}");
150-
}
151-
foreach (AzureChatCitation citation in onYourDataContext?.Citations ?? [])
152-
{
153-
Console.Write($"Citation: {citation.Content}");
154-
}
155-
```
156-
157-
89+
This will wait until the model has generated its entire response before printing the results.

articles/ai-services/openai/includes/use-your-data-python.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: mrbullwinkle #travisw
55
ms.author: mbullwin #travisw
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 03/07/2024
8+
ms.date: 01/10/2025
99
---
1010

1111
[!INCLUDE [Set up required variables](./use-your-data-common-variables.md)]
@@ -59,7 +59,7 @@ deployment = os.environ.get("AZURE_OPENAI_DEPLOYMENT_ID")
5959
client = openai.AzureOpenAI(
6060
azure_endpoint=endpoint,
6161
api_key=api_key,
62-
api_version="2024-02-01",
62+
api_version="2024-10-21",
6363
)
6464

6565
completion = client.chat.completions.create(
@@ -87,7 +87,8 @@ completion = client.chat.completions.create(
8787
}
8888
)
8989

90-
print(completion.model_dump_json(indent=2))
90+
print(f"{completion.choices[0].message.role}: {completion.choices[0].message.content}")
91+
9192
```
9293

9394
# [OpenAI Python 0.28.1](#tab/python)

articles/ai-services/openai/use-your-data-quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.custom: devx-track-dotnet, devx-track-extended-java, devx-track-js, devx-trac
88
ms.topic: quickstart
99
author: aahill
1010
ms.author: aahi
11-
ms.date: 10/22/2024
11+
ms.date: 01/09/2025
1212
recommendations: false
1313
zone_pivot_groups: openai-use-your-data
1414
---

articles/ai-studio/how-to/deploy-models-cohere-command.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2129,6 +2129,7 @@ For more examples of how to use Cohere models, see the following examples and tu
21292129
| Description | Language | Sample |
21302130
|-------------------------------------------|-------------------|-----------------------------------------------------------------|
21312131
| Web requests | Bash | [Command-R](https://aka.ms/samples/cohere-command-r/webrequests) - [Command-R+](https://aka.ms/samples/cohere-command-r-plus/webrequests) |
2132+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
21322133
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) |
21332134
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
21342135
| OpenAI SDK (experimental) | Python | [Link](https://aka.ms/samples/cohere-command/openaisdk) |

articles/ai-studio/how-to/deploy-models-cohere-embed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,7 @@ Cohere Embed V3 models can optimize the embeddings based on its use case.
631631
| Description | Language | Sample |
632632
|-------------------------------------------|-------------------|-----------------------------------------------------------------|
633633
| Web requests | Bash | [cohere-embed.ipynb](https://aka.ms/samples/embed-v3/webrequests) |
634+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
634635
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) |
635636
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
636637
| OpenAI SDK (experimental) | Python | [Link](https://aka.ms/samples/cohere-embed/openaisdk) |

articles/ai-studio/how-to/deploy-models-jais.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ For more examples of how to use Jais models, see the following examples and tuto
11691169

11701170
| Description | Language | Sample |
11711171
|-------------------------------------------|-------------------|-----------------------------------------------------------------|
1172+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
11721173
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) |
11731174
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
11741175

articles/ai-studio/how-to/deploy-models-llama.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@ For more examples of how to use Meta Llama models, see the following examples an
14641464
| Description | Language | Sample |
14651465
|-------------------------------------------|-------------------|------------------------------------------------------------------- |
14661466
| CURL request | Bash | [Link](https://aka.ms/meta-llama-3.1-405B-instruct-webrequests) |
1467+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
14671468
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azureml-examples/blob/main/sdk/typescript/README.md) |
14681469
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
14691470
| Python web requests | Python | [Link](https://aka.ms/meta-llama-3.1-405B-instruct-webrequests) |

articles/ai-studio/how-to/deploy-models-managed.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,10 @@ response_json = json.loads(response)
151151
print(json.dumps(response_json, indent=2))
152152
```
153153

154+
## Configure Autoscaling
155+
156+
To configure autoscaling for deployments, you can go to Azure Portal, locate the Azure resource typed `Machine learning online deployment` in the resource group of the AI project, and use Scaling menu under Setting. For more information on autoscaling, see [Autoscale online endpoints](/azure/machine-learning/how-to-autoscale-endpoints) in the Azure Machine Learning documentation.
157+
154158
## Delete the deployment endpoint
155159

156160
To delete deployments in Azure AI Foundry portal, select the **Delete** button on the top panel of the deployment details page.

articles/ai-studio/how-to/deploy-models-mistral-nemo.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,6 +2020,7 @@ For more examples of how to use Mistral models, see the following examples and t
20202020
| Description | Language | Sample |
20212021
|-------------------------------------------|-------------------|-----------------------------------------------------------------|
20222022
| CURL request | Bash | [Link](https://aka.ms/mistral-large/webrequests-sample) |
2023+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
20232024
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) |
20242025
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
20252026
| Python web requests | Python | [Link](https://aka.ms/mistral-large/webrequests-sample) |

articles/ai-studio/how-to/deploy-models-mistral-open.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,6 +1289,7 @@ For more examples of how to use Mistral models, see the following examples and t
12891289
| Description | Language | Sample |
12901290
|-------------------------------------------|-------------------|-----------------------------------------------------------------|
12911291
| CURL request | Bash | [Link](https://aka.ms/mistral-large/webrequests-sample) |
1292+
| Azure AI Inference package for C# | C# | [Link](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/ai/Azure.AI.Inference/samples) |
12921293
| Azure AI Inference package for JavaScript | JavaScript | [Link](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/ai/ai-inference-rest/samples) |
12931294
| Azure AI Inference package for Python | Python | [Link](https://aka.ms/azsdk/azure-ai-inference/python/samples) |
12941295
| Python web requests | Python | [Link](https://aka.ms/mistral-large/webrequests-sample) |

0 commit comments

Comments
 (0)