AnswerCorrectnessMetric<T>

Models & Types ยท AiDotNet.RetrievalAugmentedGeneration.Evaluation

Evaluates the factual correctness of generated answers.

Inheritance: RAGMetricBase<T> โ†’ AnswerCorrectnessMetric<T>

How It Works

Assesses whether the generated answer contains factually correct information by comparing against ground truth. When a text generator is supplied it is used as an LLM judge that rates correctness; when an embedding model is supplied semantic (cosine) similarity is used. When both are supplied the two signals are averaged (RAGAS-style). When neither is supplied the metric falls back to the offline lexical Jaccard word-overlap heuristic.

Constructors

Constructor Summary
AnswerCorrectnessMetric(ITextGenerator generator, IEmbeddingModel<T> embeddingModel) Initializes a new instance of the AnswerCorrectnessMetric class.
AnswerCorrectnessMetric(string llmEndpoint, string llmApiKey) Initializes a new instance of the AnswerCorrectnessMetric class.

Properties

Property Summary
string Description { get; } Gets the description of what this metric measures.
string Name { get; } Gets the name of this metric.