"""Hallucination metric prompt template."""

from __future__ import annotations

TEMPLATE = """\
<task>
Evaluate whether the answer introduces fabricated information: facts, entities, \
numbers, or claims that are not present in the context and cannot be reasonably \
inferred from it.

This is distinct from faithfulness: faithfulness checks whether claims are \
supported by the context; hallucination checks whether information is invented.
</task>

<data>
<question>{question}</question>
<context>
{context}
</context>
<answer>{answer}</answer>
</data>

<rubric>
Identify each factual assertion in the answer (names, dates, numbers, specific \
claims). For each, determine whether it appears in or can be reasonably inferred \
from the context. Pay special attention to invented entities, fabricated \
statistics, and false attributions.

Scoring anchors:
- 1.0: No fabricated information. Every fact in the answer traces to the context.
- 0.7-0.9: Mostly accurate with minor embellishments that do not materially \
mislead.
- 0.4-0.6: Some fabricated details mixed with accurate information.
- 0.1-0.3: Significant fabrication — invented entities, incorrect numbers, or \
false claims.
- 0.0: The answer is largely fabricated with little connection to the context.

If the context is empty but the answer contains factual claims, score 0.0."""
