Jaa


ScenarioRun.EvaluateAsync Method

Definition

Evaluates the supplied modelResponse and returns an EvaluationResult containing one or more EvaluationMetrics.

public System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult> EvaluateAsync (System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatMessage> messages, Microsoft.Extensions.AI.ChatMessage modelResponse, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.Evaluation.EvaluationContext>? additionalContext = default, System.Threading.CancellationToken cancellationToken = default);
member this.EvaluateAsync : seq<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatMessage * seq<Microsoft.Extensions.AI.Evaluation.EvaluationContext> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
Public Function EvaluateAsync (messages As IEnumerable(Of ChatMessage), modelResponse As ChatMessage, Optional additionalContext As IEnumerable(Of EvaluationContext) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of EvaluationResult)

Parameters

messages
IEnumerable<ChatMessage>

The conversation history including the request that produced the supplied modelResponse.

modelResponse
ChatMessage

The response that is to be evaluated.

additionalContext
IEnumerable<EvaluationContext>

Additional contextual information (beyond that which is available in messages) that the IEvaluators included in this ScenarioRun may need to accurately evaluate the supplied modelResponse.

cancellationToken
CancellationToken

A CancellationToken that can cancel the evaluation operation.

Returns

An EvaluationResult containing one or more EvaluationMetrics.

Applies to