check_grounding
Verify an answer against source context before returning it: confirm required facts appear, trace every number to evidence, and require abstention when context lacks the answer.
Instructions
Check whether an answer is grounded in the provided context. Deterministic (no LLM judge): verifies that required facts appear in the answer, that every number in the answer traces to the context, and — for questions the context cannot answer — that the answer abstains instead of fabricating. Use this to self-check RAG / document-QA / retrieval answers before returning them.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| answer | Yes | The answer to check. | |
| context | Yes | The retrieved context the answer must be grounded in (a string, or an array of passages). | |
| question | No | The original question (optional; lets numbers from the question count as grounded). | |
| must_abstain | No | Set true when the context does NOT contain the answer: the answer must then decline rather than fabricate. | |
| expected_facts | No | Facts a correct answer must contain (e.g. "30 days", "no restocking fee"). Each must appear in the answer. | |
| allowed_new_numbers | No | Numbers the answer may introduce that are not in the context (e.g. from the question). |