RAG-003RAG · Enough to answerlayaeval.ContextSufficiency
Context Sufficiency
Do the sources hold enough to answer without guessing?
Simulation state:
When it passes
Enough to answer.
Threshold satisfied: evaluation score >= 0.50.
When it fails
Not enough — it would have to guess.
Violation detected: execution flagged for human review or fallback routing.
SDK Specification
| Parameter | Value | Description |
|---|---|---|
| Class | ContextSufficiency | Python evaluator class in layaeval |
| Required Fields | "query", "retrieved_context" | Arguments expected in the call signature |
| Default Threshold | >= 0.50 | 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-sufficiency.py
1from layaeval import ContextSufficiency23metric = ContextSufficiency(threshold=0.50) # passes at or above 0.5045res = 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