RAG-004RAG · Enough to answerlayaeval.ContextCoverage
Context Coverage
How much of the needed info is in the sources?
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
| Parameter | Value | Description |
|---|---|---|
| Class | ContextCoverage | 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 | Enough to answer (Is there enough in the pages to answer at all?) |
Python Example
context-coverage.py
1from layaeval import ContextCoverage23metric = ContextCoverage(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