Skip to content

Commit b3684c0

Browse files
alliscodeCopilot
andcommitted
Fix net472 build: conditional evaluation package refs and file exclusion
- Make Microsoft.Extensions.AI.Evaluation package references conditional on net8.0+ in AI, AzureAI, and Workflows csproj files - Exclude Evaluation/**/*.cs from compilation on legacy TFMs (net472, netstandard2.0) since MEAI.Evaluation does not support them - Fix missing numRepetitions XML doc params in AgentEvaluationExtensions - Fix expectedOutput parameter name bug in BuildItemsFromResponses call Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 257eff4 commit b3684c0

12 files changed

Lines changed: 366 additions & 278 deletions

File tree

dotnet/agent-framework-dotnet.slnx

Lines changed: 327 additions & 268 deletions
Large diffs are not rendered by default.

dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/FoundryAgents_Evaluations_Step03_AllPatterns.csproj renamed to dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/FoundryAgents_Evaluations_Step03_AllPatterns.csproj

File renamed without changes.

dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/Program.cs renamed to dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/Program.cs

File renamed without changes.

dotnet/samples/GettingStarted/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/README.md renamed to dotnet/samples/02-agents/FoundryAgents/FoundryAgents_Evaluations_Step03_AllPatterns/README.md

File renamed without changes.

dotnet/src/Microsoft.Agents.AI.AzureAI/Evaluation/FoundryEvals.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3-
using System.Linq;
43
using Microsoft.Extensions.AI;
54
using Microsoft.Extensions.AI.Evaluation;
65
using Microsoft.Extensions.AI.Evaluation.Quality;

dotnet/src/Microsoft.Agents.AI.AzureAI/Microsoft.Agents.AI.AzureAI.csproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@
1616
<ItemGroup>
1717
<PackageReference Include="Azure.AI.Projects" />
1818
<PackageReference Include="Microsoft.Extensions.AI" />
19+
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
20+
<PackageReference Include="OpenAI" />
21+
</ItemGroup>
22+
23+
<!-- Evaluation support requires net8.0+ (MEAI.Evaluation does not support legacy TFMs) -->
24+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
1925
<PackageReference Include="Microsoft.Extensions.AI.Evaluation" />
2026
<PackageReference Include="Microsoft.Extensions.AI.Evaluation.Quality" />
2127
<PackageReference Include="Microsoft.Extensions.AI.Evaluation.Safety" />
22-
<PackageReference Include="Microsoft.Extensions.AI.OpenAI" />
23-
<PackageReference Include="OpenAI" />
28+
</ItemGroup>
29+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
30+
<Compile Remove="Evaluation\**\*.cs" />
2431
</ItemGroup>
2532

2633
<ItemGroup>

dotnet/src/Microsoft.Agents.AI.Workflows/Microsoft.Agents.AI.Workflows.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@
5454
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
5555
</ItemGroup>
5656

57+
<!-- Evaluation support requires net8.0+ (MEAI.Evaluation does not support legacy TFMs) -->
58+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
59+
<Compile Remove="Evaluation\**\*.cs" />
60+
</ItemGroup>
61+
5762
</Project>

dotnet/src/Microsoft.Agents.AI/Evaluation/AgentEvaluationExtensions.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Microsoft. All rights reserved.
1+
// Copyright (c) Microsoft. All rights reserved.
22

33
using System;
44
using System.Collections.Generic;
@@ -77,6 +77,10 @@ public static async Task<AgentEvaluationResults> EvaluateAsync(
7777
/// Use <see cref="ConversationSplitters.LastTurn"/>, <see cref="ConversationSplitters.Full"/>,
7878
/// or a custom <see cref="IConversationSplitter"/> implementation.
7979
/// </param>
80+
/// <param name="numRepetitions">
81+
/// Number of times to run each query (default 1). When greater than 1, each query is invoked
82+
/// independently N times to measure consistency.
83+
/// </param>
8084
/// <param name="cancellationToken">Cancellation token.</param>
8185
/// <returns>Evaluation results.</returns>
8286
public static async Task<AgentEvaluationResults> EvaluateAsync(
@@ -113,6 +117,10 @@ public static async Task<AgentEvaluationResults> EvaluateAsync(
113117
/// Use <see cref="ConversationSplitters.LastTurn"/>, <see cref="ConversationSplitters.Full"/>,
114118
/// or a custom <see cref="IConversationSplitter"/> implementation.
115119
/// </param>
120+
/// <param name="numRepetitions">
121+
/// Number of times to run each query (default 1). When greater than 1, each query is invoked
122+
/// independently N times to measure consistency.
123+
/// </param>
116124
/// <param name="cancellationToken">Cancellation token.</param>
117125
/// <returns>One result per evaluator.</returns>
118126
public static async Task<IReadOnlyList<AgentEvaluationResults>> EvaluateAsync(
@@ -164,7 +172,7 @@ public static async Task<AgentEvaluationResults> EvaluateAsync(
164172
IEnumerable<IEnumerable<ExpectedToolCall>>? expectedToolCalls = null,
165173
CancellationToken cancellationToken = default)
166174
{
167-
var items = BuildItemsFromResponses(agent, responses, queries, expected, expectedToolCalls);
175+
var items = BuildItemsFromResponses(agent, responses, queries, expectedOutput, expectedToolCalls);
168176
return await evaluator.EvaluateAsync(items, evalName, cancellationToken).ConfigureAwait(false);
169177
}
170178

dotnet/src/Microsoft.Agents.AI/Evaluation/EvalItem.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3-
using System;
43
using System.Collections.Generic;
54
using System.Linq;
65
using Microsoft.Extensions.AI;

dotnet/src/Microsoft.Agents.AI/Microsoft.Agents.AI.csproj

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323

2424
<ItemGroup>
2525
<PackageReference Include="Microsoft.Extensions.AI" />
26-
<PackageReference Include="Microsoft.Extensions.AI.Evaluation" />
2726
<PackageReference Include="Microsoft.Extensions.Compliance.Abstractions" />
2827
<PackageReference Include="Microsoft.Extensions.VectorData.Abstractions" />
2928
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" />
@@ -32,6 +31,14 @@
3231
<PackageReference Include="System.Diagnostics.DiagnosticSource" />
3332
</ItemGroup>
3433

34+
<!-- Evaluation support requires net8.0+ (MEAI.Evaluation does not support legacy TFMs) -->
35+
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
36+
<PackageReference Include="Microsoft.Extensions.AI.Evaluation" />
37+
</ItemGroup>
38+
<ItemGroup Condition="!$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
39+
<Compile Remove="Evaluation\**\*.cs" />
40+
</ItemGroup>
41+
3542
<PropertyGroup>
3643
<!-- NuGet Package Settings -->
3744
<Title>Microsoft Agent Framework</Title>

0 commit comments

Comments
 (0)