Faithfulness, answer relevance, context precision

RAGAS gives you separable signals. Faithfulness asks whether the answer stays grounded in the retrieved context. Answer relevance asks whether the answer actually addresses the question. Context precision asks whether the retrieved chunks were worth retrieving. Context recall, which needs a ground truth, asks whether your retriever found the chunks that contain the answer at all.

Matching exercise: Match metric to the failure it detects

Loading practice…

models.py
python
class EvalScore(BaseModel):
    """RAGAS metric scores for a single answer."""
    faithfulness: float | None = None
    answer_relevance: float | None = None
    context_precision: float | None = None
    context_recall: float | None = None

All four fields are optional. Context recall is only populated when a ground truth is provided. The other three can be computed without labels, which is what makes RAGAS usable on real user traffic, not just gold sets.