Skip to main content

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

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: 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.

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