RAG-001RAG · Findinglayaeval.RetrievalRelevance

Retrieval Relevance

Did we fetch documents that match the question?

QUESTIONParis hotels?FETCHED PAGESParis hotel listHotel pricesTokyo weatherParis stays3 of 4 pages match
Simulation state:
When it passes

Most fetched pages are on topic.

Threshold satisfied: evaluation score >= 3.0.

When it fails

Most fetched pages are off topic.

Violation detected: execution flagged for human review or fallback routing.

SDK Specification

ParameterValueDescription
ClassRetrievalRelevancePython evaluator class in layaeval
Required Fields"query", "retrieved_context"Arguments expected in the call signature
Default Threshold>= 3.0Passes when quality score is at or above this value
CategoryRAG EvaluationFinding (Did search bring back the right pages?)

Python Example

pip install layaeval
retrieval-relevance.py
1from layaeval import RetrievalRelevance
2
3metric = RetrievalRelevance(threshold=3.0) # passes at or above 3.0
4
5res = metric(
6 query="What is the capital of France?",
7 retrieved_context="Paris is the capital of France, with 2.1M residents.",
8)
9
10print(res.passed, res.value, res.confidence)

Related RAG Checks

Other checks in Finding

View all 42 checks →