chore: import upstream snapshot with attribution
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
dotnet-build-and-test / dotnet-test-functions (push) Has been cancelled
dotnet-build-and-test / paths-filter (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Debug, windows-latest, net9.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, ubuntu-latest, net8.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-build (Release, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, ubuntu-latest, net10.0) (push) Has been cancelled
dotnet-build-and-test / dotnet-test (Release, integration, true, windows-latest, net472) (push) Has been cancelled
dotnet-build-and-test / dotnet-foundry-hosted-it (push) Has been cancelled
dotnet-build-and-test / dotnet-build-and-test-check (push) Has been cancelled
dotnet-build-and-test / Integration Test Report (push) Has been cancelled
CodeQL / Analyze (csharp) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFrameworks>net10.0</TargetFrameworks>
|
||||
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.Foundry\Microsoft.Agents.AI.Foundry.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
|
||||
// This sample demonstrates that the evaluation pipeline preserves multimodal content.
|
||||
// When an agent conversation includes images, EvalChecks.HasImageContent() can verify
|
||||
// they survived into the EvalItem — useful for testing vision-capable agents.
|
||||
//
|
||||
// No Azure credentials needed: this sample builds EvalItems locally to show the pattern.
|
||||
|
||||
using Microsoft.Agents.AI;
|
||||
using Microsoft.Extensions.AI;
|
||||
|
||||
// Simulate a vision agent conversation where the user sends an image.
|
||||
// Just pass the conversation — query/response are derived automatically.
|
||||
// For cloud-based quality evaluation of multimodal conversations, see the
|
||||
// 05-end-to-end/Evaluation samples (FoundryQuality, ConversationSplits).
|
||||
EvalItem imageItem = new(
|
||||
conversation:
|
||||
[
|
||||
new(ChatRole.User,
|
||||
[
|
||||
new TextContent("What do you see in this image?"),
|
||||
new UriContent(new Uri("https://example.com/mountain.png"), "image/png"),
|
||||
]),
|
||||
new(ChatRole.Assistant, "The image shows a mountain landscape with snow-capped peaks."),
|
||||
]);
|
||||
|
||||
// Simulate a text-only conversation (no image).
|
||||
EvalItem textItem = new(
|
||||
query: "Tell me about mountains.",
|
||||
response: "Mountains are large landforms that rise above the surrounding terrain.");
|
||||
|
||||
// HasImageContent() passes when the conversation contains an image, fails otherwise.
|
||||
// This lets you verify that your vision agent actually received the image.
|
||||
LocalEvaluator evaluator = new(
|
||||
EvalChecks.HasImageContent(),
|
||||
EvalChecks.NonEmpty());
|
||||
|
||||
AgentEvaluationResults results = await evaluator.EvaluateAsync([imageItem, textItem]);
|
||||
|
||||
Console.WriteLine($"Evaluation: {results.Passed}/{results.Total} passed");
|
||||
Console.WriteLine();
|
||||
|
||||
Console.WriteLine($"Image conversation: has_image_content = {imageItem.HasImageContent}"); // true
|
||||
Console.WriteLine($"Text conversation: has_image_content = {textItem.HasImageContent}"); // false
|
||||
Console.WriteLine();
|
||||
|
||||
for (int i = 0; i < results.Items.Count; i++)
|
||||
{
|
||||
Console.WriteLine($"Item {i + 1}: {results.InputItems![i].Query}");
|
||||
foreach (var metric in results.Items[i].Metrics)
|
||||
{
|
||||
string status = metric.Value.Interpretation?.Failed == true ? "FAIL" : "PASS";
|
||||
Console.WriteLine($" [{status}] {metric.Key}: {metric.Value.Interpretation?.Reason}");
|
||||
}
|
||||
|
||||
Console.WriteLine();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
# Evaluation - Multimodal
|
||||
|
||||
This sample demonstrates that the evaluation pipeline preserves multimodal content. When conversations include images, `EvalChecks.HasImageContent` can verify they survived into the `EvalItem`.
|
||||
|
||||
## What this sample demonstrates
|
||||
|
||||
- Building `EvalItem` objects with `UriContent` image content
|
||||
- Using built-in `EvalChecks.HasImageContent` to detect images in conversations
|
||||
- Comparing image vs. text-only conversations to show when the check passes/fails
|
||||
- Evaluating directly with `LocalEvaluator.EvaluateAsync()` (no agent needed)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- .NET 10 SDK or later
|
||||
|
||||
No Azure credentials or environment variables are required for this sample since it evaluates locally without calling an agent.
|
||||
|
||||
## Run the sample
|
||||
|
||||
```powershell
|
||||
cd dotnet/samples/02-agents/Evaluation
|
||||
dotnet run --project .\Evaluation_Multimodal
|
||||
```
|
||||
|
||||
## See also
|
||||
|
||||
- [Evaluation_SimpleEval](../Evaluation_SimpleEval/) — Simplest evaluation with built-in checks and `agent.EvaluateAsync()`
|
||||
- [Evaluation_FoundryQuality](../../../05-end-to-end/Evaluation/Evaluation_FoundryQuality/) — Cloud-based quality evaluation with Foundry evaluators
|
||||
- [Evaluation_FoundryRubric](../../../05-end-to-end/Evaluation/Evaluation_FoundryRubric/) — Rubric (adaptive) evaluators with per-dimension scores
|
||||
- [Evaluation_ConversationSplits](../../../05-end-to-end/Evaluation/Evaluation_ConversationSplits/) — Multi-turn conversation split strategies
|
||||
Reference in New Issue
Block a user