pub struct Citation {
pub citation_type: Option<String>,
pub url: Option<String>,
pub title: Option<String>,
pub cited_text: Option<String>,
pub document_index: Option<u32>,
pub document_title: Option<String>,
pub extra: Map<String, Value>,
}Expand description
A citation attached to a TextBlock, linking generated text back to a
source.
Anthropic emits several citation shapes — web_search_result_location,
char_location, page_location, content_block_location, … — that share a
type tag and overlapping fields. This models the fields consumers commonly
render as typed optionals and preserves any remaining variant-specific
fields (start/end indices, encrypted_index, …) verbatim in
Citation::extra, so unmodeled or future shapes deserialize without loss.
Fields§
§citation_type: Option<String>Citation variant tag, e.g. "web_search_result_location".
url: Option<String>Source URL (web-search citations).
title: Option<String>Human-readable source title.
cited_text: Option<String>The span of source text being cited.
document_index: Option<u32>Index of the source document (document-location citations).
document_title: Option<String>Title of the source document.
extra: Map<String, Value>Any additional location fields not modeled above, preserved verbatim.