Skip to content

Commit 155c6ca

Browse files
authored
Add page for responsible AI with .NET (#48303)
1 parent cbaeba9 commit 155c6ca

16 files changed

+84
-19
lines changed

β€Ž.openpublishing.redirection.ai.jsonβ€Ž

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,22 @@
22
"redirections": [
33
{
44
"source_path_from_root": "/docs/ai/ai-extensions.md",
5-
"redirect_url": "/dotnet/ai/microsoft-extensions-ai"
5+
"redirect_url": "/dotnet/ai/microsoft-extensions-ai",
6+
"redirect_document_id": true
67
},
78
{
89
"source_path_from_root": "/docs/ai/conceptual/agents.md",
910
"redirect_url": "/dotnet/ai"
1011
},
12+
{
13+
"source_path_from_root": "/docs/ai/conceptual/evaluation-libraries.md",
14+
"redirect_url": "/dotnet/ai/evaluation/libraries",
15+
"redirect_document_id": true
16+
},
1117
{
1218
"source_path_from_root": "/docs/ai/get-started/dotnet-ai-overview.md",
13-
"redirect_url": "/dotnet/ai/overview"
19+
"redirect_url": "/dotnet/ai/overview",
20+
"redirect_document_id": true
1421
},
1522
{
1623
"source_path_from_root": "/docs/ai/how-to/app-service-db-auth.md",
@@ -24,6 +31,11 @@
2431
"source_path_from_root": "/docs/ai/how-to/work-with-local-models.md",
2532
"redirect_url": "/dotnet/ai"
2633
},
34+
{
35+
"source_path_from_root": "/docs/ai/quickstarts/evaluate-ai-response.md",
36+
"redirect_url": "/dotnet/ai/evaluation/evaluate-ai-response",
37+
"redirect_document_id": true
38+
},
2739
{
2840
"source_path_from_root": "/docs/ai/quickstarts/get-started-azure-openai.md",
2941
"redirect_url": "/dotnet/ai/quickstarts/build-chat-app"
@@ -38,27 +50,41 @@
3850
},
3951
{
4052
"source_path_from_root": "/docs/ai/quickstarts/quickstart-assistants.md",
41-
"redirect_url": "/dotnet/ai/quickstarts/create-assistant"
53+
"redirect_url": "/dotnet/ai/quickstarts/create-assistant",
54+
"redirect_document_id": true
4255
},
4356
{
4457
"source_path_from_root": "/docs/ai/quickstarts/quickstart-azure-openai-tool.md",
4558
"redirect_url": "/dotnet/ai/quickstarts/use-function-calling"
4659
},
4760
{
4861
"source_path_from_root": "/docs/ai/quickstarts/quickstart-local-ai.md",
49-
"redirect_url": "/dotnet/ai/quickstarts/chat-local-model"
62+
"redirect_url": "/dotnet/ai/quickstarts/chat-local-model",
63+
"redirect_document_id": true
5064
},
5165
{
5266
"source_path_from_root": "/docs/ai/quickstarts/quickstart-openai-generate-images.md",
53-
"redirect_url": "/dotnet/ai/quickstarts/generate-images"
67+
"redirect_url": "/dotnet/ai/quickstarts/generate-images",
68+
"redirect_document_id": true
5469
},
5570
{
5671
"source_path_from_root": "/docs/ai/quickstarts/quickstart-openai-summarize-text.md",
57-
"redirect_url": "/dotnet/ai/quickstarts/prompt-model"
72+
"redirect_url": "/dotnet/ai/quickstarts/prompt-model",
73+
"redirect_document_id": true
5874
},
5975
{
6076
"source_path_from_root": "/docs/ai/tutorials/llm-eval.md",
61-
"redirect_url": "/dotnet/ai/quickstarts/evaluate-ai-response"
77+
"redirect_url": "/dotnet/ai/evaluation/evaluate-ai-response"
78+
},
79+
{
80+
"source_path_from_root": "/docs/ai/tutorials/evaluate-safety.md",
81+
"redirect_url": "/dotnet/ai/evaluation/evaluate-safety",
82+
"redirect_document_id": true
83+
},
84+
{
85+
"source_path_from_root": "/docs/ai/tutorials/evaluate-with-reporting.md",
86+
"redirect_url": "/dotnet/ai/evaluation/evaluate-with-reporting",
87+
"redirect_document_id": true
6288
}
6389
]
6490
}

β€Ždocs/ai/quickstarts/evaluate-ai-response.mdβ€Ž renamed to β€Ždocs/ai/evaluation/evaluate-ai-response.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ms.topic: quickstart
1010
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.
1111

1212
> [!NOTE]
13-
> 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)
13+
> This quickstart demonstrates the simplest usage of the evaluation API. Notably, it doesn't demonstrate use of the [response caching](libraries.md#cached-responses) and [reporting](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](evaluate-with-reporting.md)
1414
1515
## Prerequisites
1616

@@ -103,4 +103,4 @@ If you no longer need them, delete the Azure OpenAI resource and GPT-4 model dep
103103
## Next steps
104104
105105
- Evaluate the responses from different OpenAI models.
106-
- Add response caching and reporting to your evaluation code. For more information, see [Tutorial: Evaluate a model's response with response caching and reporting](../tutorials/evaluate-with-reporting.md).
106+
- Add response caching and reporting to your evaluation code. For more information, see [Tutorial: Evaluate a model's response with response caching and reporting](evaluate-with-reporting.md).

β€Ždocs/ai/tutorials/evaluate-safety.mdβ€Ž renamed to β€Ždocs/ai/evaluation/evaluate-safety.mdβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Complete the following steps to create an MSTest project.
110110
> [!NOTE]
111111
> This code example passes the LLM <xref:Microsoft.Extensions.AI.IChatClient> as `originalChatClient` to <xref:Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfigurationExtensions.ToChatConfiguration(Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfiguration,Microsoft.Extensions.AI.IChatClient)>. The reason to include the LLM chat client here is to enable getting a chat response from the LLM, and notably, to enable response caching for it. (If you don't want to cache the LLM's response, you can create a separate, local <xref:Microsoft.Extensions.AI.IChatClient> to fetch the response from the LLM.) Instead of passing a <xref:Microsoft.Extensions.AI.IChatClient>, if you already have a <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration> for an LLM from another reporting configuration, you can pass that instead, using the <xref:Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfigurationExtensions.ToChatConfiguration(Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfiguration,Microsoft.Extensions.AI.Evaluation.ChatConfiguration)> overload.
112112
>
113-
> Similarly, if you configure both [LLM-based evaluators](../conceptual/evaluation-libraries.md#quality-evaluators) and [Azure AI Foundry Evaluation service&ndash;based evaluators](../conceptual/evaluation-libraries.md#safety-evaluators) in the reporting configuration, you also need to pass the LLM <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration> to <xref:Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfigurationExtensions.ToChatConfiguration(Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfiguration,Microsoft.Extensions.AI.Evaluation.ChatConfiguration)>. Then it returns a <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration> that can talk to both types of evaluators.
113+
> Similarly, if you configure both [LLM-based evaluators](libraries.md#quality-evaluators) and [Azure AI Foundry Evaluation service&ndash;based evaluators](libraries.md#safety-evaluators) in the reporting configuration, you also need to pass the LLM <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration> to <xref:Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfigurationExtensions.ToChatConfiguration(Microsoft.Extensions.AI.Evaluation.Safety.ContentSafetyServiceConfiguration,Microsoft.Extensions.AI.Evaluation.ChatConfiguration)>. Then it returns a <xref:Microsoft.Extensions.AI.Evaluation.ChatConfiguration> that can talk to both types of evaluators.
114114
115115
1. Add a method to define the [chat options](xref:Microsoft.Extensions.AI.ChatOptions) and ask the model for a response to a given question.
116116

@@ -148,6 +148,6 @@ To generate a report to view the evaluation results, see [Generate a report](eva
148148

149149
This tutorial covers the basics of evaluating content safety. As you create your test suite, consider the following next steps:
150150

151-
- Configure additional evaluators, such as the [quality evaluators](../conceptual/evaluation-libraries.md#quality-evaluators). For an example, see the AI samples repo [quality and safety evaluation example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example10_RunningQualityAndSafetyEvaluatorsTogether.cs).
151+
- Configure additional evaluators, such as the [quality evaluators](libraries.md#quality-evaluators). For an example, see the AI samples repo [quality and safety evaluation example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example10_RunningQualityAndSafetyEvaluatorsTogether.cs).
152152
- Evaluate the content safety of generated images. For an example, see the AI samples repo [image response example](https://github.com/dotnet/ai-samples/blob/main/src/microsoft-extensions-ai-evaluation/api/reporting/ReportingExamples.Example09_RunningSafetyEvaluatorsAgainstResponsesWithImages.cs).
153153
- In real-world evaluations, you might not want to validate individual results, since the LLM responses and evaluation scores can vary over time as your product (and the models used) evolve. You might not want individual evaluation tests to fail and block builds in your CI/CD pipelines when this happens. Instead, in such cases, it might be better to rely on the generated report and track the overall trends for evaluation scores across different scenarios over time (and only fail individual builds in your CI/CD pipelines when there's a significant drop in evaluation scores across multiple different tests).
File renamed without changes.

β€Ždocs/ai/conceptual/evaluation-libraries.mdβ€Ž renamed to β€Ždocs/ai/evaluation/libraries.mdβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ ms.date: 07/24/2025
66
---
77
# The Microsoft.Extensions.AI.Evaluation libraries
88

9-
The Microsoft.Extensions.AI.Evaluation libraries simplify the process of evaluating the quality and accuracy of responses generated by AI models in .NET intelligent apps. Various metrics measure aspects like relevance, truthfulness, coherence, and completeness of the responses. Evaluations are crucial in testing, because they help ensure that the AI model performs as expected and provides reliable and accurate results.
9+
The Microsoft.Extensions.AI.Evaluation libraries simplify the process of evaluating the quality and safety of responses generated by AI models in .NET intelligent apps. Various quality metrics measure aspects like relevance, truthfulness, coherence, and completeness of the responses. Safety metrics measure aspects like hate and unfairness, violence, and sexual content. Evaluations are crucial in testing, because they help ensure that the AI model performs as expected and provides reliable and accurate results.
1010

1111
The evaluation libraries, which are built on top of the [Microsoft.Extensions.AI abstractions](../microsoft-extensions-ai.md), are composed of the following NuGet packages:
1212

1313
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation) – Defines the core abstractions and types for supporting evaluation.
1414
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.NLP](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.NLP) - Contains [evaluators](#nlp-evaluators) that evaluate the similarity of an LLM's response text to one or more reference responses using natural language processing (NLP) metrics. These evaluators aren't LLM or AI-based; they use traditional NLP techniques such as text tokenization and n-gram analysis to evaluate text similarity.
1515
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Quality](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Quality) – Contains [evaluators](#quality-evaluators) that assess the quality of LLM responses in an app according to metrics such as relevance and completeness. These evaluators use the LLM directly to perform evaluations.
16-
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) – Contains [evaluators](#safety-evaluators), such as the `ProtectedMaterialEvaluator` and `ContentHarmEvaluator`, that use the [Azure AI Foundry](/azure/ai-foundry/) Evaluation service to perform evaluations.
16+
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) – Contains [evaluators](#safety-evaluators), such as the `ProtectedMaterialEvaluator` and `ContentHarmEvaluator`, that use the [Azure AI Foundry](/azure/ai-foundry/) evaluation service to perform evaluations.
1717
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Reporting](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Reporting) – Contains support for caching LLM responses, storing the results of evaluations, and generating reports from that data.
1818
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Reporting.Azure](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Reporting.Azure) - Supports the reporting library with an implementation for caching LLM responses and storing the evaluation results in an [Azure Storage](/azure/storage/common/storage-introduction) container.
1919
- [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Console](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Console) – A command-line tool for generating reports and managing evaluation data.
@@ -60,7 +60,7 @@ NLP evaluators evaluate the quality of an LLM response by comparing it to a refe
6060

6161
### Safety evaluators
6262

63-
Safety evaluators check for presence of harmful, inappropriate, or unsafe content in a response. They rely on the Azure AI Foundry Evaluation service, which uses a model that's fine tuned to perform evaluations.
63+
Safety evaluators check for presence of harmful, inappropriate, or unsafe content in a response. They rely on the Azure AI Foundry evaluation service, which uses a model that's fine tuned to perform evaluations.
6464

6565
| Evaluator type | Metric | Description |
6666
|---------------------------------------------------------------------------|--------------------|-------------|
@@ -86,7 +86,7 @@ The library contains support for storing evaluation results and generating repor
8686

8787
:::image type="content" source="../media/ai-extensions/pipeline-report.jpg" lightbox="../media/ai-extensions/pipeline-report.jpg" alt-text="Screenshot of an AI evaluation report in an Azure DevOps pipeline.":::
8888

89-
The `dotnet aieval` tool, which ships as part of the `Microsoft.Extensions.AI.Evaluation.Console` package, includes functionality for generating reports and managing the stored evaluation data and cached responses. For more information, see [Generate a report](../tutorials/evaluate-with-reporting.md#generate-a-report).
89+
The `dotnet aieval` tool, which ships as part of the `Microsoft.Extensions.AI.Evaluation.Console` package, includes functionality for generating reports and managing the stored evaluation data and cached responses. For more information, see [Generate a report](evaluate-with-reporting.md#generate-a-report).
9090

9191
## Configuration
9292

File renamed without changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Responsible AI with .NET
3+
description: Learn what responsible AI is and how you can use .NET to evaluate the safety of your AI apps.
4+
ms.date: 09/08/2025
5+
ai-usage: ai-assisted
6+
---
7+
8+
# Responsible AI with .NET
9+
10+
*Responsible AI* refers to the practice of designing, developing, and deploying artificial intelligence systems in a way that is ethical, transparent, and aligned with human values. It emphasizes fairness, accountability, privacy, and safety to ensure that AI technologies benefit individuals and society as a whole. As AI becomes increasingly integrated into applications and decision-making processes, prioritizing responsible AI is of utmost importance.
11+
12+
Microsoft has identified [six principles](https://www.microsoft.com/ai/responsible-ai) for responsible AI:
13+
14+
- Fairness
15+
- Reliability and safety
16+
- Privacy and security
17+
- Inclusiveness
18+
- Transparency
19+
- Accountability
20+
21+
If you're building an AI app with .NET, the [πŸ“¦ Microsoft.Extensions.AI.Evaluation.Safety](https://www.nuget.org/packages/Microsoft.Extensions.AI.Evaluation.Safety) package provides evaluators to help ensure that the responses your app generates, both text and image, meet the standards for responsible AI. The evaluators can also detect problematic content in user input. These safety evaluators use the [Azure AI Foundry evaluation service](/azure/ai-foundry/concepts/evaluation-evaluators/risk-safety-evaluators) to perform evaluations. They include metrics for hate and unfairness, groundedness, ungrounded inference of human attributes, and the presence of:
22+
23+
- Protected material
24+
- Self-harm content
25+
- Sexual content
26+
- Violent content
27+
- Vulnerable code (text-based only)
28+
- Indirect attacks (text-based only)
29+
30+
For more information about the safety evaluators, see [Safety evaluators](libraries.md#safety-evaluators). To get started with the Microsoft.Extensions.AI.Evaluation.Safety evaluators, see [Tutorial: Evaluate response safety with caching and reporting](evaluate-safety.md).
31+
32+
## See also
33+
34+
- [Responsible AI at Microsoft](https://www.microsoft.com/ai/responsible-ai)
35+
- [Training: Embrace responsible AI principles and practices](/training/modules/embrace-responsible-ai-principles-practices/)
36+
- [Azure AI Foundry evaluation service](/azure/ai-foundry/concepts/evaluation-evaluators/risk-safety-evaluators)
37+
- [Azure AI Content Safety](/azure/ai-services/content-safety/overview)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
Β (0)