Skip to content

IterationRecordEvaluationExtensions

NexusLabs.Foundry.MicrosoftAgentFramework

NexusLabs.Foundry.MicrosoftAgentFramework.Iterative

IterationRecordEvaluationExtensions Class

Extensions that convert IterationRecord and collections of iteration records into Microsoft.Extensions.AI shapes suitable for evaluation libraries (e.g., Microsoft.Extensions.AI.Evaluation's ToolCallAccuracyEvaluator).

public static class IterationRecordEvaluationExtensions

Inheritance System.Object 🡒 IterationRecordEvaluationExtensions

Methods

IterationRecordEvaluationExtensions.ToToolCallTrajectory(this IterationRecord) Method

Materializes a tool-call trajectory as a list of Microsoft.Extensions.AI.ChatMessage instances suitable for Microsoft.Extensions.AI.Evaluation trajectory-aware evaluators. Each tool call becomes an assistant message containing a Microsoft.Extensions.AI.FunctionCallContent, immediately followed by a tool message containing the matching Microsoft.Extensions.AI.FunctionResultContent.

public static System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> ToToolCallTrajectory(this NexusLabs.Foundry.MicrosoftAgentFramework.Iterative.IterationRecord record);

Parameters

record IterationRecord

The iteration record to convert.

Returns

System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage>
An ordered trajectory of Microsoft.Extensions.AI.ChatMessage entries. Empty if the iteration produced no tool calls.

IterationRecordEvaluationExtensions.ToToolCallTrajectory(this IEnumerable<IterationRecord>) Method

Materializes a tool-call trajectory across an entire iterative run by concatenating the trajectories of each iteration in order.

public static System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage> ToToolCallTrajectory(this System.Collections.Generic.IEnumerable<NexusLabs.Foundry.MicrosoftAgentFramework.Iterative.IterationRecord> records);

Parameters

records System.Collections.Generic.IEnumerable<IterationRecord>

The iteration records to flatten.

Returns

System.Collections.Generic.IReadOnlyList<Microsoft.Extensions.AI.ChatMessage>
An ordered trajectory of Microsoft.Extensions.AI.ChatMessage entries across all iterations. Empty if no iteration produced any tool calls.