pub struct Annotation {
pub kind: AnnotationKind,
pub title: Option<String>,
pub url: Option<String>,
pub file_id: Option<String>,
pub tool_name: Option<String>,
pub snippet: Option<String>,
pub annotated_regions: Option<Vec<TextSpanRegion>>,
pub annotated_regions_coordinate_space: Option<RegionCoordinateSpace>,
pub additional_properties: Map<String, Value>,
}Expand description
A citation annotation attached to content.
Fields§
§kind: AnnotationKindThe annotation kind discriminator ("citation"), matching upstream’s
Annotation.type.
title: Option<String>§url: Option<String>§file_id: Option<String>§tool_name: Option<String>§snippet: Option<String>§annotated_regions: Option<Vec<TextSpanRegion>>§annotated_regions_coordinate_space: Option<RegionCoordinateSpace>What Self::annotated_regions index into. None keeps the
original meaning — character offsets into the annotated
TextContent::text — so annotations serialized before this field
existed read the same.
A provider that reports where in the cited source a quote came from
sets RegionCoordinateSpace::Source: Anthropic’s document
citations carry character offsets into the document, page numbers or
content-block indices, none of which are positions in the generated
text. Without the marker a consumer that highlights the answer from
annotated_regions highlights the wrong span, or one past the end of
the text (upstream #9436).
additional_properties: Map<String, Value>Provider-specific extras (upstream additional_properties), e.g. a
code-interpreter citation’s container_id or a file citation’s
index.
Implementations§
Source§impl Annotation
impl Annotation
Sourcepub fn content_regions(&self) -> &[TextSpanRegion]
pub fn content_regions(&self) -> &[TextSpanRegion]
The regions that are spans of the annotated text itself — empty when
they locate the quote in the cited source instead (see
Self::annotated_regions_coordinate_space). Use this, not
annotated_regions, to highlight or link generated text.
Trait Implementations§
Source§impl Clone for Annotation
impl Clone for Annotation
Source§fn clone(&self) -> Annotation
fn clone(&self) -> Annotation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more