Retrieval and RAG
Context precision
Implemented
rag.context_precisionDefinition
How well the retriever ranks useful chunks first: the mean of precision@k at the rank of each relevant chunk, over the retrieved list (RAGAS context precision; average precision over retrieved chunks).
Formula
Σ_k (precision@k · rel_k) / Σ_k rel_k
Range: [0, 1]
Inputs and outputs
- chunk_relevance: per query, relevance of each retrieved chunk in rank order
Returns: MetricResult (float, or per-example array with average=None)
Assumptions
No assumptions beyond valid, aligned inputs of the documented types.
Limitations
No metric-specific limitations are documented yet. Interpret the value alongside the task, data, and other metrics.
Python API
import evalsuite as es
es.context_precision(chunk_relevance)References
- Es S, James J, Espinosa-Anke L, Schockaert S. RAGAS: automated evaluation of retrieval augmented generation. EACL (demos). 2024:150-158.