ContextRelevanceMetric<T>

Models & Types ยท AiDotNet.RetrievalAugmentedGeneration.Evaluation

Evaluates the relevance of retrieved context to the query.

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

How It Works

Measures how relevant the retrieved documents are to answering the query, helping identify retrieval quality issues. When an embedding model is supplied, relevance is the mean cosine similarity between the query and each retrieved document; otherwise the offline lexical Jaccard word-overlap heuristic is used.

Constructors

Constructor Summary
ContextRelevanceMetric(IEmbeddingModel<T> embeddingModel) Initializes a new instance of the ContextRelevanceMetric class.

Properties

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