4/16
Part 2 of 7 · Ground the answerLearn
Ask for the quotes first, then check that each one is really there
Anthropic's docs give three moves against hallucinations:
- Give the model permission to admit uncertainty, which can drastically reduce false information.
- Ask it to extract word-for-word quotes before it answers, so the answer rests on the actual text.
- Verify claims with citations, which return the exact passages that support each claim.
Quotes are worth asking for because a program can check them. A quote that isn't in the source was made up, and an answer resting on it gets stopped. unsupported makes that check. It lowercases the source and each quote, turns every run of spaces and line breaks into one space, and returns the quotes it can't find in the source. You'll write it in the next step.
policy = "Unused gear can be returned within 30 days of delivery. Worn items are not accepted."
quotes = ["returned within 30 days of delivery", "Worn items are accepted"]
print(unsupported(quotes, policy))
The answer quotes two passages from the policy. Which does the check reject?
Pick one to see what it prints.
Pick an answer above to see the rest