RAG-014RAG · Staying truthfullayaeval.ContextUtilization

Context Utilization

Did the answer use the useful facts it was given?

SOURCESANSWERHotel Lumière$180 a nightNear the LouvreStay at LumièreIt's $180 a nightNear the LouvreUsed 3 of 3 facts
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

ParameterValueDescription
ClassContextUtilizationPython evaluator class in layaeval
Required Fields"retrieved_context", "response"Arguments expected in the call signature
Default Threshold>= 3.0Passes when quality score is at or above this value
CategoryRAG EvaluationStaying truthful (Does every line come from the pages, with nothing made up?)

Python Example

pip install layaeval
context-utilization.py
1from layaeval import ContextUtilization
2
3metric = ContextUtilization(threshold=3.0) # passes at or above 3.0
4
5res = metric(
6 retrieved_context="Paris is the capital of France, with 2.1M residents.",
7 response="Paris is the capital of France.",
8)
9
10print(res.passed, res.value, res.confidence)

Related RAG Checks

Other checks in Staying truthful

View all 42 checks →