Skip to content

Commit 77d16fe

Browse files
authored
Add tutorial for MEAI.Evaluation with reporting and caching (#45359)
1 parent b3e588c commit 77d16fe

File tree

11 files changed

+453
-13
lines changed

11 files changed

+453
-13
lines changed

docs/ai/index.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ landingContent:
7979
url: get-started-app-chat-template.md
8080
- text: Implement RAG using vector search
8181
url: tutorials/tutorial-ai-vector-search.md
82+
- text: Evaluate a model's response
83+
url: tutorials/evaluate-with-reporting.md
8284

8385
# Card (Optional; Remove if not applicable.)
8486
- title: Training

docs/ai/quickstarts/build-vector-search-app.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ The abstractions in `Microsoft.Extensions.VectorData.Abstractions` provide libra
4646
4747
## Create the app
4848

49-
Complete the following steps to create a .NET console app that can accomplish the following:
49+
Complete the following steps to create a .NET console app that can:
5050

5151
- Create and populate a vector store by generating embeddings for a data set
5252
- Generate an embedding for the user prompt
5353
- Query the vector store using the user prompt embedding
54-
- Displays the relevant results from the vector search
54+
- Display the relevant results from the vector search
5555

5656
1. In an empty directory on your computer, use the `dotnet new` command to create a new console app:
5757

@@ -85,7 +85,7 @@ Complete the following steps to create a .NET console app that can accomplish th
8585
- [`Azure.AI.OpenAI`](https://www.nuget.org/packages/Azure.AI.OpenAI) is the official package for using OpenAI's .NET library with the Azure OpenAI Service.
8686
- [`Microsoft.SemanticKernel.Connectors.InMemory`](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.InMemory) provides an in-memory vector store class to hold queryable vector data records.
8787
- [`Microsoft.Extensions.VectorData.Abstractions`](https://www.nuget.org/packages/Microsoft.Extensions.AI) enables Create-Read-Update-Delete (CRUD) and search operations on vector stores.
88-
- [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration) provides implementation of key-value pair based configuration.
88+
- [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration) provides an implementation of key-value pair—based configuration.
8989
- [`Microsoft.Extensions.Configuration.UserSecrets`](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.UserSecrets) is a user secrets configuration provider implementation for `Microsoft.Extensions.Configuration`.
9090
9191
:::zone-end
@@ -105,7 +105,7 @@ Complete the following steps to create a .NET console app that can accomplish th
105105
- [`Microsoft.Extensions.AI.OpenAI`](https://www.nuget.org/packages/Microsoft.Extensions.AI.OpenAI) provides AI abstractions for OpenAI-compatible models or endpoints. This library also includes the official [`OpenAI`](https://www.nuget.org/packages/OpenAI) library for the OpenAI service API as a dependency.
106106
- [`Microsoft.SemanticKernel.Connectors.InMemory`](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.InMemory) provides an in-memory vector store class to hold queryable vector data records.
107107
- [`Microsoft.Extensions.VectorData.Abstractions`](https://www.nuget.org/packages/Microsoft.Extensions.AI) enables Create-Read-Update-Delete (CRUD) and search operations on vector stores.
108-
- [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration) provides implementation of key-value pair based configuration.
108+
- [Microsoft.Extensions.Configuration](https://www.nuget.org/packages/Microsoft.Extensions.Configuration) provides an implementation of key-value pair—based configuration.
109109
- [`Microsoft.Extensions.Configuration.UserSecrets`](https://www.nuget.org/packages/Microsoft.Extensions.Configuration.UserSecrets) is a user secrets configuration provider implementation for `Microsoft.Extensions.Configuration`.
110110
111111
:::zone-end

docs/ai/quickstarts/create-assistant.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ In this quickstart, you'll learn how to create a minimal AI assistant using the
3939

4040
## Core components of AI assistants
4141

42-
AI assistants are based around conversational threads with a user. The user sends prompts to the assistant on a conversation thread, which directs the assistant to complete tasks using the tools it has available. Assistants can process and analyze data, make decisions, and interact with users or other systems to achieve specific goals. Most assistants include the following components:
42+
AI assistants are based around conversational threads with a user. The user sends prompts to the assistant on a conversation thread, which direct the assistant to complete tasks using the tools it has available. Assistants can process and analyze data, make decisions, and interact with users or other systems to achieve specific goals. Most assistants include the following components:
4343

4444
| **Component** | **Description** |
45-
|---|---|
45+
|---------------|-----------------|
4646
| **Assistant** | The core AI client and logic that uses Azure OpenAI models, manages conversation threads, and utilizes configured tools. |
47-
| **Thread** | A conversation session between an assistant and a user. Threads store messages and automatically handle truncation to fit content into a model's context. |
48-
| **Message** | A message created by an assistant or a user. Messages can include text, images, and other files. Messages are stored as a list on the thread. |
49-
| **Run** | Activation of an assistant to begin running based on the contents of the thread. The assistant uses its configuration and the thread's messages to perform tasks by calling models and tools. As part of a run, the assistant appends messages to the thread. |
47+
| **Thread** | A conversation session between an assistant and a user. Threads store messages and automatically handle truncation to fit content into a model's context. |
48+
| **Message** | A message created by an assistant or a user. Messages can include text, images, and other files. Messages are stored as a list on the thread. |
49+
| **Run** | Activation of an assistant to begin running based on the contents of the thread. The assistant uses its configuration and the thread's messages to perform tasks by calling models and tools. As part of a run, the assistant appends messages to the thread. |
5050
| **Run steps** | A detailed list of steps the assistant took as part of a run. An assistant can call tools or create messages during its run. Examining run steps allows you to understand how the assistant is getting to its final results. |
5151

5252
Assistants can also be configured to use multiple tools in parallel to complete tasks, including the following:

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ ms.custom: devx-track-dotnet, devx-track-dotnet-ai
1010

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

13+
> [!NOTE]
14+
> This quickstart demonstrates the simplest usage of the evaluation API. Notably, it doesn't demonstrate use of the [response caching](../conceptual/evaluation-libraries.md#cached-responses) and [reporting](../conceptual/evaluation-libraries.md#reporting) functionality, which are important if you're authoring unit tests that run as part of an "offline" evaluation pipeline. The scenario shown in this quickstart is suitable in use cases such as "online" evaluation of AI responses within production code and logging scores to telemetry, where caching and reporting aren't relevant. For a tutorial that demonstrates the caching and reporting functionality, see [Tutorial: Evaluate a model's response with response caching and reporting](../tutorials/evaluate-with-reporting.md)
15+
1316
## Prerequisites
1417

1518
- [Install .NET 8.0](https://dotnet.microsoft.com/download) or a later version
@@ -86,7 +89,7 @@ Complete the following steps to create an MSTest project that connects to your l
8689

8790
:::code language="csharp" source="./snippets/evaluate-ai-responses/MyTests.cs" id="Initialize":::
8891

89-
This methods accomplishes the following tasks:
92+
This method accomplishes the following tasks:
9093

9194
- Sets up the <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration>.
9295
- Sets the <xref:Microsoft.Extensions.AI.ChatOptions>, including the <xref:Microsoft.Extensions.AI.ChatOptions.Temperature> and the <xref:Microsoft.Extensions.AI.ChatOptions.ResponseFormat>.

docs/ai/quickstarts/use-function-calling.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ Complete the following steps to create a .NET console app to connect to an AI mo
107107
108108
The app uses the [`Microsoft.Extensions.AI`](https://www.nuget.org/packages/Microsoft.Extensions.AI/) package to send and receive requests to the AI model.
109109
110-
1. In the **Program.cs** file, add the following code to connect and authenticate to the AI model. The `ChatClient` is also configured to use function invocation, which allows .NET functions in your code to be called by the AI model.
110+
1. In the **Program.cs** file, add the following code to connect and authenticate to the AI model. The `ChatClient` is also configured to use function invocation, which allows the AI model to call .NET functions in your code.
111111
112112
:::zone target="docs" pivot="azure-openai"
113113
@@ -124,7 +124,7 @@ The app uses the [`Microsoft.Extensions.AI`](https://www.nuget.org/packages/Micr
124124
125125
:::zone-end
126126
127-
1. Create a new `ChatOptions` object that contains an inline function the AI model can call to get the current weather. The function declaration includes a delegate to run logic and name and description parameters to describe the purpose of the function to the AI model.
127+
1. Create a new `ChatOptions` object that contains an inline function the AI model can call to get the current weather. The function declaration includes a delegate to run logic, and name and description parameters to describe the purpose of the function to the AI model.
128128
129129
:::code language="csharp" source="snippets/function-calling/openai/program.cs" range="16-26":::
130130
@@ -138,7 +138,7 @@ The app uses the [`Microsoft.Extensions.AI`](https://www.nuget.org/packages/Micr
138138
dotnet run
139139
```
140140
141-
The app prints the completion response from the AI model that includes data provided by the .NET function. The AI model understood the registered function was available and called it automatically to generate a proper response.
141+
The app prints the completion response from the AI model, which includes data provided by the .NET function. The AI model understood that the registered function was available and called it automatically to generate a proper response.
142142
143143
:::zone target="docs" pivot="azure-openai"
144144

docs/ai/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ items:
7979
href: conceptual/evaluation-libraries.md
8080
- name: "Quickstart: Evaluate a model's response"
8181
href: quickstarts/evaluate-ai-response.md
82+
- name: "Tutorial: Evaluate a response with response caching and reporting"
83+
href: tutorials/evaluate-with-reporting.md
8284
- name: "Tutorial: Evaluate LLM prompt completions"
8385
href: tutorials/llm-eval.md
8486
- name: Resources

0 commit comments

Comments
 (0)