RAG-014RAG · Staying truthfullayaeval.ContextUtilization
Context Utilization
Did the answer use the useful facts it was given?
Simulation state:
When it passes
Used all the good facts.
Threshold satisfied: evaluation score >= 3.0.
When it fails
Ignored most of them.
Violation detected: execution flagged for human review or fallback routing.
SDK Specification
| Parameter | Value | Description |
|---|---|---|
| Class | ContextUtilization | Python evaluator class in layaeval |
| Required Fields | "retrieved_context", "response" | Arguments expected in the call signature |
| Default Threshold | >= 3.0 | Passes when quality score is at or above this value |
| Category | RAG Evaluation | Staying truthful (Does every line come from the pages, with nothing made up?) |
Python Example
context-utilization.py
1from layaeval import ContextUtilization23metric = ContextUtilization(threshold=3.0) # passes at or above 3.045res = metric(6 retrieved_context="Paris is the capital of France, with 2.1M residents.",7 response="Paris is the capital of France.",8)910print(res.passed, res.value, res.confidence)
Related RAG Checks
Other checks in Staying truthful
RAG-006Read →
Groundedness
Is each sentence in the answer backed by the sources?
RAG-007Read →
Strict Groundedness
A yes or no: is every claim proven? One gap fails it.
RAG-008Read →
Hallucination Risk
Did the answer invent facts that aren't in the sources?
RAG-018Read →
Claim Support
Is this single claim backed by the evidence?
RAG-019Read →
Contradiction Detection
Does the answer say the opposite of the sources?
RAG-020Read →
Context Conflict
Do two fetched sources disagree with each other?