RAG-004RAG · Enough to answerlayaeval.ContextCoverage

Context Coverage

How much of the needed info is in the sources?

HOW MUCH IS COVEREDHotel namePriceDates freeAddress4 of 4 covered
Simulation state:
When it passes

All of it is covered.

Threshold satisfied: evaluation score >= 3.0.

When it fails

Only half is covered.

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

SDK Specification

ParameterValueDescription
ClassContextCoveragePython 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 EvaluationEnough to answer (Is there enough in the pages to answer at all?)

Python Example

pip install layaeval
context-coverage.py
1from layaeval import ContextCoverage
2
3metric = ContextCoverage(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 Enough to answer

View all 42 checks →