
'Cite Your Sources' in a Prompt Isn't Grounding: Use Claude's Citations Feature
- كاتب موثّق
- Claude API
محتويات المقال
The common misconception
Claude follows formatting instructions well, so every answer comes back with neat, consistent references. Spot checks pass: most prompted citations are right, which makes the wrong ones rare and easy to miss. Anthropic's own guide to reducing recommends asking Claude to quote and cite. A reference with a section number and quote marks looks like something a system verified.
What actually happens
A prompted citation is just more output
The Citations feature returns pointers, not prose
document blocks with "citations": {"enabled": true}, and the API does the bookkeeping:
Your documents are chunked Plain text and PDFs are split into sentences; custom content documents keep the blocks you provide, with no further chunking. A chunk is the smallest thing Claude can cite. Claude answers in blocks The response becomes several textblocks. A block that makes a claim from your documents carries acitationslist.The API attaches exact locations Each citation has the cited_text, adocument_index, thedocument_titleand a location: character range for plain text, page range for PDFs, block range for custom content.
{ "type": "text", "text": "the grass is green", "citations": [{ "type": "char_location", "cited_text": "The grass is green. ", "document_index": 0, "document_title": "Example Document", "start_char_index": 0, "end_char_index": 20 }]}cited_text itself, the docs state that they "are guaranteed to contain valid pointers to the provided documents". cited_text also doesn't count toward output tokens, so if you used to ask Claude to copy quotes out, you might pay less.
What the guarantee doesn't cover
Rewriting the assistant
import anthropicclient = anthropic.Anthropic()reply = client.messages.create( model="claude-opus-5-5", max_tokens=2048, system="Answer from the handbook. Cite every claim as [Handbook §x.y].", messages=[{"role": "user", "content": f"<handbook>{HANDBOOK}</handbook>\n{QUESTION}"}],)answer = next(b.text for b in reply.content if b.type == "text")print(answer) # "[Handbook §4.2]" is text Claude wrote; nothing checked itimport anthropicclient = anthropic.Anthropic()reply = client.messages.create( model="claude-opus-5-5", max_tokens=2048, messages=[{"role": "user", "content": [ {"type": "document", "title": "Employee Handbook 2026", "source": {"type": "text", "media_type": "text/plain", "data": HANDBOOK}, "citations": {"enabled": True}}, {"type": "text", "text": QUESTION}, ]}],)for block in reply.content: if block.type == "text": quotes = [c.cited_text for c in block.citations or []] print(repr(block.text), "<-", quotes or "no citation")cited_text, copied from the document | ||
document_index plus a char, page or block range | ||
How to apply it in your project
Find prompted citations Search your prompts for "cite", "source" and "quote", and your code for regexes that parse references out of answers. Send sources as cited documents Pass each source as a documentblock withcitationsenabled. It's all or none: every document in the request must have the same setting.Render from the citations array Show cited_textand link to the page or character range, instead of trusting references written in the answer.Treat uncited claims as unsupported A factual sentence without a citation is a signal: flag it, hide it, or send it for review. Check relevance in your evals On a sample of answers, check that each cited_textactually supports its sentence. A valid pointer can still point at the wrong passage.
Key takeaways
A citation you ask for in the prompt is generated text; nothing checks it against your documents. The Citations feature returns structured locations whose pointers are guaranteed valid, plus cited_textthat doesn't count toward output tokens.A valid pointer isn't proof: whether the passage supports the claim is still Claude's judgment. Uncited text blocks exist, so decide in code what to do with claims that have no citation. Citations and structured outputs don't mix; use one line per field when you need both.
التعليقات (0)