hallucination_check
Lexical hallucination check: verifies an LLM answer's words, numbers and polarity against the provided source/context. Fast, deterministic, no API key needed. Each answer sentence is aligned to its best-matching source sentence, so a number only counts as support when it sits on the SAME statement ("founded in 1998" is not grounded by "sold 1998 units"), and a negation or antonym flip against that sentence returns verdict "contradicted" — the corrupted-fact hallucination that reuses source vocabulary. Limitations: still lexical — it cannot follow a paraphrase, a synonym, or multi-sentence reasoning, so a "well_grounded" verdict means "nothing lexical found", never "verified true". Entailment: run_semantic_tests (NLI/embedding) or a calibrated judge.
Example tool call
This call uses example arguments supplied in the tool’s input schema.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"answer": "Le remboursement prend plus de 7 jours ouvrés.",
"context": "Le remboursement prend plus de 7 jours ouvrés."
},
"name": "hallucination_check"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cases | No | Batch instead of answer + context: one result per case, and the worst gate overall. | |
| answer | No | The LLM answer to verify (with context). | |
| strict | No | Every sentence must be supported (default false). | |
| context | No | The source text that should ground it. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| detail | No | ||
| message | No | ||
| numbers | No | ||
| overlap | No | ||
| verdict | No | ||
| analysis | No | ||
| entities | No | ||
| grounded | No | ||
| sentence | No | ||
| total_words | No | ||
| matched_words | No | ||
| contradictions | No | ||
| grounded_count | No | ||
| unbound_claims | No | ||
| grounding_score | No | ||
| total_sentences | No | ||
| ungrounded_count | No | ||
| unsupported_claims | No |