Cost
Anthropic's guide says enabling citations adds some input tokens because of the prompt and the chunking, and that cited_text does not count toward output tokens.
BuildSpark AI: Understand AI. Make it work for you. New here? Start here.
Home · Retrieval · 10 · Citation & grounding check
Concept card · Retrieval
What this gets you. Prove each answer sentence is in the source it cites.
You can now split your files, find the right passage, and tie the reply to it. Next: Build an agent.
A citation and grounding check ties a claim in the reply to a source you actually retrieved.
Oct 18: First card. The picture ties a claim to a chunk (a piece of the document), then cites the wrong chunk. Sources are Anthropic's citations guide and OpenAI's file search guide.
Anthropic's citations guide says you enable citations on a document and the response can attach a citation to a claim. The guide says the API extracts cited_text from the document, and that those citations contain valid pointers to the documents you provided. That statement is Anthropic's. A pointer is not a grade of the answer. OpenAI's file search guide says the message can include file_citation annotations with a file id and a filename. The support assistant on this site asks for a citations array in JSON. Anthropic's guide says citations cannot be used together with structured outputs, and that the API returns a 400 error if you enable both. The picture shows a claim with its source, then the same shape with the wrong source. It does not call either API.
Anthropic's guide says enabling citations adds some input tokens because of the prompt and the chunking, and that cited_text does not count toward output tokens.
A file id lets you open the file. It does not prove the sentence is in the chunk. On the support assistant, the template copies a sentence from the cited chunk. A model can name an id and write a sentence that chunk does not contain.
If one request needs both a JSON schema and Anthropic citations, the guide says the API returns a 400. Pick one on that request. A citation of a chunk you did not retrieve fails the check, even when the pointer is well formed.
Take one answer from the support assistant. Open the citation id. If the sentence is not in that chunk, the check fails.
Showing the citation and skipping the open-the-chunk step. Anthropic's pointer statement is about the document you sent, not about a file the model named from memory.
The reply cites the hours chunk and says the refund window is 90 days. The hours chunk is about weekday hours. What failed?
On the support assistant, the prompt step asks for a citations array. The JSON under Templated answer quotes a sentence the example already selected.
Look for: the weekday answer cites hours, and that sentence is in the Support hours chunk. The 90-day run can put the pasted ticket first in the keyword list. The simulated answer still cites refunds and quotes the 14-day sentence. "90 days" is in the ticket, not in the cited chunk. Anthropic's citations guide says the API extracts cited_text and that those citations contain valid pointers to documents you provided. That is Anthropic's statement, not a grade of the sentence. OpenAI's file search guide can attach a file_citation with a filename. This page's check is opening the chunk.