Jaa


EvaluatorExtensions.EvaluateAsync Method

Definition

Overloads

EvaluateAsync(IEvaluator, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

EvaluateAsync(IEvaluator, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

EvaluateAsync(IEvaluator, ChatMessage, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

EvaluateAsync(IEvaluator, String, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

EvaluateAsync(IEvaluator, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

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

Parameters

evaluator
IEvaluator

The IEvaluator that should perform the evaluation.

modelResponse
ChatMessage

The response that is to be evaluated.

chatConfiguration
ChatConfiguration

A ChatConfiguration that specifies the IChatClient and the IEvaluationTokenCounter that should be used if the evaluation is performed using an AI model.

additionalContext
IEnumerable<EvaluationContext>

Additional contextual information that the evaluator 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.

Remarks

The Names of the EvaluationMetrics contained in the returned EvaluationResult should match EvaluationMetricNames.

Also note that chatConfiguration must not be omitted if the evaluation is performed using an AI model.

Applies to

EvaluateAsync(IEvaluator, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

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

Parameters

evaluator
IEvaluator

The IEvaluator that should perform the evaluation.

modelResponse
String

The response that is to be evaluated.

chatConfiguration
ChatConfiguration

A ChatConfiguration that specifies the IChatClient and the IEvaluationTokenCounter that should be used if the evaluation is performed using an AI model.

additionalContext
IEnumerable<EvaluationContext>

Additional contextual information that the evaluator 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.

Remarks

The Names of the EvaluationMetrics contained in the returned EvaluationResult should match EvaluationMetricNames.

Also note that chatConfiguration must not be omitted if the evaluation is performed using an AI model.

Applies to

EvaluateAsync(IEvaluator, ChatMessage, ChatMessage, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

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

Parameters

evaluator
IEvaluator

The IEvaluator that should perform the evaluation.

userRequest
ChatMessage

The request that produced the modelResponse that is to be evaluated.

modelResponse
ChatMessage

The response that is to be evaluated.

chatConfiguration
ChatConfiguration

A ChatConfiguration that specifies the IChatClient and the IEvaluationTokenCounter that should be used if the evaluation is performed using an AI model.

additionalContext
IEnumerable<EvaluationContext>

Additional contextual information (beyond that which is available in userRequest) that the evaluator 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.

Remarks

The Names of the EvaluationMetrics contained in the returned EvaluationResult should match EvaluationMetricNames.

Also note that chatConfiguration must not be omitted if the evaluation is performed using an AI model.

Applies to

EvaluateAsync(IEvaluator, String, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

public static System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult> EvaluateAsync (this Microsoft.Extensions.AI.Evaluation.IEvaluator evaluator, string userRequest, string modelResponse, Microsoft.Extensions.AI.Evaluation.ChatConfiguration? chatConfiguration = default, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.Evaluation.EvaluationContext>? additionalContext = default, System.Threading.CancellationToken cancellationToken = default);
static member EvaluateAsync : Microsoft.Extensions.AI.Evaluation.IEvaluator * string * string * Microsoft.Extensions.AI.Evaluation.ChatConfiguration * seq<Microsoft.Extensions.AI.Evaluation.EvaluationContext> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<Microsoft.Extensions.AI.Evaluation.EvaluationResult>
<Extension()>
Public Function EvaluateAsync (evaluator As IEvaluator, userRequest As String, modelResponse As String, Optional chatConfiguration As ChatConfiguration = Nothing, Optional additionalContext As IEnumerable(Of EvaluationContext) = Nothing, Optional cancellationToken As CancellationToken = Nothing) As ValueTask(Of EvaluationResult)

Parameters

evaluator
IEvaluator

The IEvaluator that should perform the evaluation.

userRequest
String

The request that produced the modelResponse that is to be evaluated.

modelResponse
String

The response that is to be evaluated.

chatConfiguration
ChatConfiguration

A ChatConfiguration that specifies the IChatClient and the IEvaluationTokenCounter that should be used if the evaluation is performed using an AI model.

additionalContext
IEnumerable<EvaluationContext>

Additional contextual information (beyond that which is available in userRequest) that the evaluator 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.

Remarks

The Names of the EvaluationMetrics contained in the returned EvaluationResult should match EvaluationMetricNames.

Also note that chatConfiguration must not be omitted if the evaluation is performed using an AI model.

Applies to