user
turn, like "Use citations to back up your answer."
for example.We’ve also observed that when the model is asked to structure its response, it is unlikely to use citations unless explicitly told to use citations within that format. For example, if the model is asked to use <result>
tags in its response, you should add something like "Always use citations in your answer, even within <result> tags."
cited_text
does not count towards your output tokens.cited_text
, citations are guaranteed to contain valid pointers to the provided documents.Provide document(s) and enable citations
citations.enabled=true
on each of your documents. Currently, citations must be enabled on all or none of the documents within a request.Documents get processed
Claude provides cited response
source
content can be cited from.title
and context
are optional fields that will be passed to the model but not used towards cited content.title
is limited in length so you may find the context
field to be useful in storing any document metadata as text or stringified json.content
list provided in the custom content document.cited_text
field is provided for convenience and does not count towards output tokens.cited_text
is also not counted towards input tokens.cache_control
to your top-level document content blocks.
cache_control
on the document blockfile_id
:
Type | Best for | Chunking | Citation format |
---|---|---|---|
Plain text | Simple text documents, prose | Sentence | Character indices (0-indexed) |
PDF files with text content | Sentence | Page numbers (1-indexed) | |
Custom content | Lists, transcripts, special formatting, more granular citations | No additional chunking | Block indices (0-indexed) |
file_id
:
Example plain text citation
file_id
. PDF text is extracted and chunked into sentences. As image citations are not yet supported, PDFs that are scans of documents and do not contain extractable text will not be citable.
Example PDF citation
Example citation
citations_delta
type that contains a single citation to be added to the citations
list on the current text
content block.
Example streaming events