Overview
The Hallucination evaluator determines whether an assistant’s response contains claims that are unsupported by, or that contradict, the conversation it had access to. Unlike Faithfulness — which grounds a single response in a single block of retrieved context — Hallucination grounds the response in the broader conversation: earlier user and assistant turns, tool calls, tool results, and any retrieved context.When to Use
Use the Hallucination evaluator when you need to:- Evaluate multi-turn agents and assistants - Check whether a response invents facts that were never established across the conversation
- Catch fabricated tool results - Detect when a response asserts data that a tool never returned (or returned an error for)
- Verify grounding beyond a single RAG context - Judge responses against everything the model saw, not just one retrieved document
This evaluator judges the response against the conversation as its source of truth. It is the conversation-level counterpart to Faithfulness; reach for Faithfulness when you have a single retrieved context block and Hallucination when grounding lives across the conversation and tool activity.
Supported Levels
The level of an evaluator determines the scope of the evaluation in OpenTelemetry terms. Some evaluations are applicable to individual spans, some to full traces or sessions, and some are applicable at multiple levels.
Relevant span kinds: LLM and agent spans, particularly in multi-turn or tool-using pipelines.
Input Requirements
The Hallucination evaluator requires two inputs:Formatting the input
Passinput as a single, human-readable transcript of the whole record — not raw JSON. Label every turn with its role, and mark tool calls and their results clearly:
Output Interpretation
The evaluator returns aScore object with the following properties:
Interpretation:
- Grounded (0.0): Every claim in the response restates, or follows necessarily from, the input (ordinary general knowledge is allowed as long as it doesn’t contradict the input)
- Hallucinated (1.0): The response asserts situation-specific facts not present in the input, or contradicts it
Usage Examples
- Python
- TypeScript
Using Input Mapping
When your data has different field names or requires transformation, use input mapping. This is especially useful when you need to assemble a readable conversation from a list of messages.- Python
- TypeScript
Configuration
For LLM client configuration options, see Configuring the LLM.Viewing and Modifying the Prompt
You can view the latest versions of our prompt templates on GitHub. The evaluators are designed to work well in a variety of contexts, but we highly recommend modifying the prompt to be more specific to your use case. Feel free to adapt them.- Python
- TypeScript
Using with Phoenix
Evaluating Traces
Run evaluations on traces collected in Phoenix and log results as annotations:Running Experiments
Use the Hallucination evaluator in Phoenix experiments:API Reference
- Python: HallucinationEvaluator
- TypeScript: createHallucinationEvaluator
Related
- Faithfulness Evaluator - Grounds a single response in a single retrieved context
- User Friction Evaluator - Detects friction expressed across a conversation

