AnswerRelevanceMetric<T>
Models & Types ยท AiDotNet.RetrievalAugmentedGeneration.Evaluation
Evaluates how relevant the generated answer is to the original query (RAGAS answer relevance).
Inheritance: RAGMetricBase<T> โ AnswerRelevanceMetric<T>
How It Works
RAGAS answer relevance works by asking a generator to produce the questions that the answer would answer, then measuring the mean cosine similarity between the embeddings of those generated questions and the original query. A high score means the answer is on-topic and directly addresses the question; a low score means the answer is evasive, incomplete, or off-topic.
This metric requires both a text generator (to reverse-generate questions) and an embedding model (to compare them to the query). When either is missing it falls back to the offline lexical Jaccard overlap between the answer and the query.
Constructors
| Constructor | Summary |
|---|---|
AnswerRelevanceMetric(ITextGenerator generator, IEmbeddingModel<T> embeddingModel, int numQuestions) |
Initializes a new instance of the AnswerRelevanceMetric class. |
Properties
| Property | Summary |
|---|---|
string Description { get; } |
Gets the description of what this metric measures. |
string Name { get; } |
Gets the name of this metric. |