RAG-001RAG · Findinglayaeval.RetrievalRelevance
Retrieval Relevance
Did we fetch documents that match the question?
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
| Parameter | Value | Description |
|---|---|---|
| Class | RetrievalRelevance | Python evaluator class in layaeval |
| Required Fields | "query", "retrieved_context" | Arguments expected in the call signature |
| Default Threshold | >= 3.0 | Passes when quality score is at or above this value |
| Category | RAG Evaluation | Finding (Did search bring back the right pages?) |
Python Example
retrieval-relevance.py
1from layaeval import RetrievalRelevance23metric = RetrievalRelevance(threshold=3.0) # passes at or above 3.045res = metric(6 query="What is the capital of France?",7 retrieved_context="Paris is the capital of France, with 2.1M residents.",8)910print(res.passed, res.value, res.confidence)
Related RAG Checks