RetrievalEvaluator class

Evaluates how well the retrieved context chunks are relevant to the user request and ranked appropriately.

Returns a NumericMetric named "Retrieval" scored 1–5 (fail below 3). Requires a RetrievalEvaluatorContext and a ChatConfiguration.

Inheritance
Annotations
  • @Source(name: 'RetrievalEvaluator.cs', namespace: 'Microsoft.Extensions.AI.Evaluation.Quality', repository: 'dotnet/extensions', path: 'src/Libraries/Microsoft.Extensions.AI.Evaluation.Quality/')

Constructors

RetrievalEvaluator()

Properties

evaluationMetricNames List<String>
The names of the EvaluationMetrics produced by this evaluator.
no setteroverride
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

buildEvaluationInstructions(List<ChatMessage> messages, ChatResponse modelResponse, List<EvaluationContext> additionalContext) List<ChatMessage>?
Builds the evaluation instructions (system + user messages).
override
evaluate(Iterable<ChatMessage> messages, ChatResponse modelResponse, {ChatConfiguration? chatConfiguration, Iterable<EvaluationContext>? additionalContext, CancellationToken? cancellationToken}) Future<EvaluationResult>
Evaluates modelResponse and returns an EvaluationResult.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Constants

retrievalMetricName → const String
The name of the NumericMetric returned by this evaluator.