CoherenceEvaluator Class

Definition

An IEvaluator that evaluates the 'Coherence' of a response produced by an AI model.

public ref class CoherenceEvaluator sealed : Microsoft::Extensions::AI::Evaluation::IEvaluator
public sealed class CoherenceEvaluator : Microsoft.Extensions.AI.Evaluation.IEvaluator
type CoherenceEvaluator = class
    interface IEvaluator
Public NotInheritable Class CoherenceEvaluator
Implements IEvaluator
Inheritance
CoherenceEvaluator
Implements

Remarks

CoherenceEvaluator measures the readability and user-friendliness of the response being evaluated. It assesses the ability of an AI system to generate text that reads naturally, flows smoothly, and resembles human-like language in its responses.

CoherenceEvaluator returns a NumericMetric that contains a score for 'Coherence'. The score is a number between 1 and 5, with 1 indicating a poor score, and 5 indicating an excellent score.

Note: CoherenceEvaluator is an AI-based evaluator that uses an AI model to perform its evaluation. While the prompt that this evaluator uses to perform its evaluation is designed to be model-agnostic, the performance of this prompt (and the resulting evaluation) can vary depending on the model used, and can be especially poor when a smaller / local model is used.

The prompt that CoherenceEvaluator uses has been tested against (and tuned to work well with) the following models. So, using this evaluator with a model from the following list is likely to produce the best results. (The model to be used can be configured via ChatClient.)

GPT-4o

Constructors

CoherenceEvaluator()

Properties

CoherenceMetricName

Gets the Name of the NumericMetric returned by CoherenceEvaluator.

EvaluationMetricNames

Gets the Names of the EvaluationMetrics produced by this IEvaluator.

Methods

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

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

Extension Methods

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

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

EvaluateAsync(IEvaluator, ChatMessage, ChatResponse, 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.

EvaluateAsync(IEvaluator, ChatResponse, 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, String, String, ChatConfiguration, IEnumerable<EvaluationContext>, CancellationToken)

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

Applies to

See also