EquivalenceEvaluator class

Evaluates whether an AI response is semantically equivalent to a ground truth reference.

Returns a NumericMetric named "Equivalence" scored 1–5 (fail below 3). Requires an EquivalenceEvaluatorContext and a ChatConfiguration.

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

Constructors

EquivalenceEvaluator()

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

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