Skip to content

Commit 966c24b

Browse files
Merge pull request #46347 from dotnet/main
Merge main into live
2 parents f7f9af2 + 5a61c45 commit 966c24b

File tree

56 files changed

+234
-152
lines changed

Some content is hidden

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

56 files changed

+234
-152
lines changed

.markdownlint-cli2.jsonc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,7 @@
5959
"MD050": {
6060
"style": "asterisk"
6161
},
62-
"MD051": false,
63-
"MD059": false
62+
"MD051": false
6463
},
6564
"ignores": [
6665
".github/",

docs/ai/microsoft-extensions-ai.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,11 @@ Helpers like <xref:Microsoft.Extensions.AI.ChatResponseExtensions.AddMessages*>
8484

8585
#### Tool calling
8686

87-
Some models and services support _tool calling_. To gather additional information, you can configure the <xref:Microsoft.Extensions.AI.ChatOptions> with information about tools (usually .NET methods) that the model can request the client to invoke. Instead of sending a final response, the model requests a function invocation with specific arguments. The client then invokes the function and sends the results back to the model with the conversation history. The `Microsoft.Extensions.AI` library includes abstractions for various message content types, including function call requests and results. While `IChatClient` consumers can interact with this content directly, `Microsoft.Extensions.AI` automates these interactions pro. It provides the following types:
87+
Some models and services support _tool calling_. To gather additional information, you can configure the <xref:Microsoft.Extensions.AI.ChatOptions> with information about tools (usually .NET methods) that the model can request the client to invoke. Instead of sending a final response, the model requests a function invocation with specific arguments. The client then invokes the function and sends the results back to the model with the conversation history. The `Microsoft.Extensions.AI.Abstractions` library includes abstractions for various message content types, including function call requests and results. While `IChatClient` consumers can interact with this content directly, `Microsoft.Extensions.AI` provides helpers that can enable automatically invoking the tools in response to corresponding requests. The `Microsoft.Extensions.AI.Abstractions` and `Microsoft.Extensions.AI` libraries provide the following types:
8888

8989
- <xref:Microsoft.Extensions.AI.AIFunction>: Represents a function that can be described to an AI model and invoked.
9090
- <xref:Microsoft.Extensions.AI.AIFunctionFactory>: Provides factory methods for creating `AIFunction` instances that represent .NET methods.
91-
- <xref:Microsoft.Extensions.AI.FunctionInvokingChatClient>: Wraps an `IChatClient` to add automatic function-invocation capabilities.
91+
- <xref:Microsoft.Extensions.AI.FunctionInvokingChatClient>: Wraps an `IChatClient` as another `IChatClient` that adds automatic function-invocation capabilities.
9292

9393
The following example demonstrates a random function invocation (this example depends on the [📦 Microsoft.Extensions.AI.Ollama](https://www.nuget.org/packages/Microsoft.Extensions.AI.Ollama) NuGet package):
9494

@@ -121,7 +121,7 @@ Alternatively, the <xref:Microsoft.Extensions.AI.LoggingChatClient> and correspo
121121

122122
#### Provide options
123123

124-
Every call to <xref:Microsoft.Extensions.AI.IChatClient.GetResponseAsync*> or <xref:Microsoft.Extensions.AI.IChatClient.GetStreamingResponseAsync*> can optionally supply a <xref:Microsoft.Extensions.AI.ChatOptions> instance containing additional parameters for the operation. The most common parameters among AI models and services show up as strongly typed properties on the type, such as <xref:Microsoft.Extensions.AI.ChatOptions.Temperature?displayProperty=nameWithType>. Other parameters can be supplied by name in a weakly typed manner, via the <xref:Microsoft.Extensions.AI.ChatOptions.AdditionalProperties?displayProperty=nameWithType> dictionary.
124+
Every call to <xref:Microsoft.Extensions.AI.IChatClient.GetResponseAsync*> or <xref:Microsoft.Extensions.AI.IChatClient.GetStreamingResponseAsync*> can optionally supply a <xref:Microsoft.Extensions.AI.ChatOptions> instance containing additional parameters for the operation. The most common parameters among AI models and services show up as strongly typed properties on the type, such as <xref:Microsoft.Extensions.AI.ChatOptions.Temperature?displayProperty=nameWithType>. Other parameters can be supplied by name in a weakly typed manner, via the <xref:Microsoft.Extensions.AI.ChatOptions.AdditionalProperties?displayProperty=nameWithType> dictionary, or via an options instance that the underlying provider understands, via the <xref:Microsoft.Extensions.AI.ChatOptions.RawRepresentationFactory?displayProperty=nameWithType> property.
125125

126126
You can also specify options when building an `IChatClient` with the fluent <xref:Microsoft.Extensions.AI.ChatClientBuilder> API by chaining a call to the <xref:Microsoft.Extensions.AI.ConfigureOptionsChatClientBuilderExtensions.ConfigureOptions(Microsoft.Extensions.AI.ChatClientBuilder,System.Action{Microsoft.Extensions.AI.ChatOptions})> extension method. This delegating client wraps another client and invokes the supplied delegate to populate a `ChatOptions` instance for every call. For example, to ensure that the <xref:Microsoft.Extensions.AI.ChatOptions.ModelId?displayProperty=nameWithType> property defaults to a particular model name, you can use code like the following:
127127

@@ -185,7 +185,7 @@ For stateful services, you might already know the identifier used for the releva
185185

186186
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet2":::
187187

188-
Some services might support automatically creating a thread ID for a request that doesn't have one. In such cases, you can transfer the <xref:Microsoft.Extensions.AI.ChatResponse.ConversationId?displayProperty=nameWithType> over to the `ChatOptions.ConversationId` for subsequent requests. For example:
188+
Some services might support automatically creating a conversation ID for a request that doesn't have one, or creating a new conversation ID that represents the current state of the conversation after incorporating the last round of messages. In such cases, you can transfer the <xref:Microsoft.Extensions.AI.ChatResponse.ConversationId?displayProperty=nameWithType> over to the `ChatOptions.ConversationId` for subsequent requests. For example:
189189

190190
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet3":::
191191

@@ -251,7 +251,7 @@ In this way, the `RateLimitingEmbeddingGenerator` can be composed with other `IE
251251
You can start building with `Microsoft.Extensions.AI` in the following ways:
252252

253253
- **Library developers**: If you own libraries that provide clients for AI services, consider implementing the interfaces in your libraries. This allows users to easily integrate your NuGet package via the abstractions.
254-
- **Service consumers**: If you're developing libraries that consume AI services, use the abstractions instead of hardcoding to a specific AI service. This approach gives your consumers the flexibility to choose their preferred service.
254+
- **Service consumers**: If you're developing libraries that consume AI services, use the abstractions instead of hardcoding to a specific AI service. This approach gives your consumers the flexibility to choose their preferred provider.
255255
- **Application developers**: Use the abstractions to simplify integration into your apps. This enables portability across models and services, facilitates testing and mocking, leverages middleware provided by the ecosystem, and maintains a consistent API throughout your app, even if you use different services in different parts of your application.
256256
- **Ecosystem contributors**: If you're interested in contributing to the ecosystem, consider writing custom middleware components.
257257

docs/ai/quickstarts/evaluate-ai-response.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ ms.topic: quickstart
66
ms.custom: devx-track-dotnet, devx-track-dotnet-ai
77
---
88

9-
# Evaluate the quality of a model's response
9+
# Quickstart: Evaluate response quality
1010

1111
In this quickstart, you create an MSTest app to evaluate the quality of a chat response from an OpenAI model. The test app uses the [Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) libraries.
1212

docs/ai/quickstarts/snippets/chat-with-data/azure-openai/CloudService.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ namespace VectorDataAI;
44

55
internal class CloudService
66
{
7-
[VectorStoreRecordKey]
7+
[VectorStoreKey]
88
public int Key { get; set; }
99

10-
[VectorStoreRecordData]
10+
[VectorStoreData]
1111
public string Name { get; set; }
1212

13-
[VectorStoreRecordData]
13+
[VectorStoreData]
1414
public string Description { get; set; }
1515

16-
[VectorStoreRecordVector(Dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)]
16+
[VectorStoreVector(Dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)]
1717
public ReadOnlyMemory<float> Vector { get; set; }
1818
}

docs/ai/quickstarts/snippets/chat-with-data/azure-openai/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
// <SnippetVectorStore>
5959
// Create and populate the vector store
6060
var vectorStore = new InMemoryVectorStore();
61-
IVectorStoreRecordCollection<int, CloudService> cloudServicesStore =
61+
VectorStoreCollection<int, CloudService> cloudServicesStore =
6262
vectorStore.GetCollection<int, CloudService>("cloudServices");
63-
await cloudServicesStore.CreateCollectionIfNotExistsAsync();
63+
await cloudServicesStore.EnsureCollectionExistsAsync();
6464

6565
foreach (CloudService service in cloudServices)
6666
{
@@ -75,7 +75,7 @@
7575
ReadOnlyMemory<float> queryEmbedding = await generator.GenerateVectorAsync(query);
7676

7777
List<VectorSearchResult<CloudService>> results =
78-
await cloudServicesStore.SearchEmbeddingAsync(queryEmbedding, top: 1).ToListAsync();
78+
await cloudServicesStore.SearchAsync(queryEmbedding, top: 1).ToListAsync();
7979

8080
foreach (VectorSearchResult<CloudService> result in results)
8181
{

docs/ai/quickstarts/snippets/chat-with-data/azure-openai/VectorDataAI.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
<ItemGroup>
1212
<PackageReference Include="Azure.Identity" Version="1.14.0" />
1313
<PackageReference Include="Azure.AI.OpenAI" Version="2.1.0" />
14-
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.4.3-preview.1.25230.7" />
15-
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.0.0-preview.1.25229.1" />
16-
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.48.0-preview" />
14+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" Version="9.5.0-preview.1.25265.7" />
15+
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" Version="9.5.0" />
16+
<PackageReference Include="Microsoft.SemanticKernel.Connectors.InMemory" Version="1.53.1-preview" />
1717
<PackageReference Include="Microsoft.Extensions.Configuration" Version="10.0.0-preview.4.25258.110" />
1818
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="10.0.0-preview.4.25258.110" />
1919
<PackageReference Include="System.Linq.AsyncEnumerable" Version="10.0.0-preview.4.25258.110" />

docs/ai/toc.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,14 @@ items:
8181
items:
8282
- name: The Microsoft.Extensions.AI.Evaluation libraries
8383
href: conceptual/evaluation-libraries.md
84-
- name: "Quickstart: Evaluate the quality of a response"
85-
href: quickstarts/evaluate-ai-response.md
86-
- name: "Tutorial: Evaluate the safety of a response"
87-
href: tutorials/evaluate-safety.md
88-
- name: "Tutorial: Evaluate a response with caching and reporting"
89-
href: tutorials/evaluate-with-reporting.md
84+
- name: Tutorials
85+
items:
86+
- name: "Quickstart: Evaluate the quality of a response"
87+
href: quickstarts/evaluate-ai-response.md
88+
- name: "Evaluate response quality with caching and reporting"
89+
href: tutorials/evaluate-with-reporting.md
90+
- name: "Evaluate response safety with caching and reporting"
91+
href: tutorials/evaluate-safety.md
9092
- name: Resources
9193
items:
9294
- name: API reference

docs/ai/tutorials/evaluate-safety.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
---
2-
title: Tutorial - Evaluate the content safety of a model's response
3-
description: Create an MSTest app that evaluates the content safety of a model's response using the evaluators in the Microsoft.Extensions.AI.Evaluation.Safety package.
2+
title: Tutorial - Evaluate response safety with caching and reporting
3+
description: Create an MSTest app that evaluates the content safety of a model's response using the evaluators in the Microsoft.Extensions.AI.Evaluation.Safety package and with caching and reporting.
44
ms.date: 05/12/2025
55
ms.topic: tutorial
66
ms.custom: devx-track-dotnet-ai
77
---
88

9-
# Tutorial: Evaluate the content safety of a model's response
9+
# Tutorial: Evaluate response safety with caching and reporting
1010

1111
In this tutorial, you create an MSTest app to evaluate the *content safety* of a response from an OpenAI model. Safety evaluators check for presence of harmful, inappropriate, or unsafe content in a response. The test app uses the safety evaluators from the [Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) package to perform the evaluations. These safety evaluators use the [Azure AI Foundry](/azure/ai-foundry/) Evaluation service to perform evaluations.
1212

docs/ai/tutorials/evaluate-with-reporting.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
2-
title: Tutorial - Evaluate a model's response
3-
description: Create an MSTest app and add a custom evaluator to evaluate the AI chat response of a language model, and learn how to use the caching and reporting features of Microsoft.Extensions.AI.Evaluation.
2+
title: Tutorial - Evaluate response quality with caching and reporting
3+
description: Create an MSTest app to evaluate the response quality of a language model, add a custom evaluator, and learn how to use the caching and reporting features of Microsoft.Extensions.AI.Evaluation.
44
ms.date: 05/09/2025
55
ms.topic: tutorial
66
ms.custom: devx-track-dotnet-ai
77
---
88

9-
# Tutorial: Evaluate a model's response with response caching and reporting
9+
# Tutorial: Evaluate response quality with caching and reporting
1010

11-
In this tutorial, you create an MSTest app to evaluate the chat response of an OpenAI model. The test app uses the [Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) libraries to perform the evaluations, cache the model responses, and create reports. The tutorial uses both built-in and custom evaluators.
11+
In this tutorial, you create an MSTest app to evaluate the chat response of an OpenAI model. The test app uses the [Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) libraries to perform the evaluations, cache the model responses, and create reports. The tutorial uses both built-in and custom evaluators. The built-in quality evaluators (from the [Microsoft.Extensions.AI.Evaluation.Quality package](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Quality)) use an LLM to perform evaluations; the custom evaluator does not use AI.
1212

1313
## Prerequisites
1414

docs/architecture/blazor-for-web-forms-developers/security-authentication-authorization.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,15 @@ It's also worth considering putting any additional columns on separate tables. S
255255

256256
### Migrating data from universal providers to ASP.NET Core Identity
257257

258-
Once you have the destination table schema in place, the next step is to migrate your user and role records to the new schema. A complete list of the schema differences, including which columns map to which new columns, can be found [here](/aspnet/core/migration/proper-to-2x/membership-to-core-identity).
258+
Once you have the destination table schema in place, the next step is to migrate your user and role records to the new schema. For a complete list of the schema differences, including which columns map to which new columns, see [Migrate from ASP.NET Membership authentication to ASP.NET Core 2.0 Identity](/aspnet/core/migration/proper-to-2x/membership-to-core-identity).
259259

260-
To migrate your users from membership to the new identity tables, you should [follow the steps described in the documentation](/aspnet/core/migration/proper-to-2x/membership-to-core-identity). After following these steps and the script provided, your users will need to change their password the next time they log in.
260+
To migrate your users from membership to the new identity tables, follow the steps described in [Migrate from ASP.NET Membership authentication to ASP.NET Core 2.0 Identity](/aspnet/core/migration/proper-to-2x/membership-to-core-identity). After following these steps and the script provided, your users will need to change their password the next time they log in.
261261

262-
It is possible to migrate user passwords but the process is much more involved. Requiring users to update their passwords as part of the migration process, and encouraging them to use new, unique passwords, is likely to enhance the overall security of the application.
262+
It's possible to migrate user passwords, but the process is much more involved. Requiring users to update their passwords as part of the migration process, and encouraging them to use new, unique passwords, is likely to enhance the overall security of the application.
263263

264264
### Migrating security settings from web.config to app startup
265265

266-
As noted above, ASP.NET membership and role providers are configured in the application's `web.config` file. Since ASP.NET Core apps are not tied to IIS and use a separate system for configuration, these settings must be configured elsewhere. For the most part, ASP.NET Core Identity is configured in the *Program.cs* file. Open the web project that was created earlier (to generate the identity table schema) and review its *Program.cs* (or *Startup.cs*) file.
266+
As noted previously, ASP.NET membership and role providers are configured in the application's `web.config` file. Since ASP.NET Core apps are not tied to IIS and use a separate system for configuration, these settings must be configured elsewhere. For the most part, ASP.NET Core Identity is configured in the *Program.cs* file. Open the web project that was created earlier (to generate the identity table schema) and review its *Program.cs* (or *Startup.cs*) file.
267267

268268
This code adds support for EF Core and Identity:
269269

0 commit comments

Comments
 (0)