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.
| Level | Supported | Notes |
|---|---|---|
| Span | Yes | Apply to an LLM span, using its message history as the input and its latest response as the output. |
| Trace | Yes | Apply across a trace whose spans form the conversation available to the response. |
| Session | Yes | Apply across a multi-turn session, using the ordered turns as the input. |
Relevant span kinds: LLM and agent spans, particularly in multi-turn or tool-using pipelines.
Input Requirements#
The Hallucination evaluator requires two inputs:
| Field | Type | Description |
|---|---|---|
input | string | The full record the assistant had access to before responding — prior user and assistant turns, tool calls, and tool results, plus any retrieved or provided content — rendered as a single, readable transcript with every turn labeled by its role. Treated as the only source of truth. |
output | string | The assistant’s latest response to classify. |
Formatting the input#
Pass input 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:
Keep the role labels on every turn. The evaluator weighs evidence by its source: user messages, tool results, and retrieved or provided content are treated as authoritative ground truth, while the assistant’s own earlier turns are not counted as independent evidence for a claim. If you strip the roles and pass an unlabeled blob, the evaluator can’t tell an authoritative tool result from an unverified assistant claim, and its grounding judgments degrade. Always keep the role on every turn in the input, and label tool outputs as tool results.
Output Interpretation#
The evaluator returns a Score object with the following properties:
| Property | Value | Description |
|---|---|---|
label | "hallucinated" or "grounded" | Classification result |
score | 1.0 or 0.0 | Numeric score (1.0 = hallucinated, 0.0 = grounded) |
explanation | string | LLM-generated reasoning for the classification |
direction | "minimize" | Lower scores are better |
metadata | object | Additional information such as the model name. When tracing is enabled, includes the trace_id for the evaluation. |
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#
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.
For more details on input mapping options, see Input Mapping.
For more details on input mapping options, see Input Mapping.
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.
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

