View Source Anthropic.Messages.Content.Citation (anthropic_community v0.5.0)

Decodes a raw citation object (as found in a Text content block's :citations list) into one of the five typed citation-location structs, discriminated on "type": CharLocation, PageLocation, ContentBlockLocation, SearchResultLocation, WebSearchResultLocation.

Citations are response-only — there is no request-side citation object to encode back, only a citations: %{enabled: true} config attached to the source document/search-result block being cited (see Anthropic.Messages.Content.Document).

Summary

Functions

Encodes a citation struct (or a plain map, passed through unchanged) back to its wire shape — needed because Anthropic.ToolRunner and multi-turn conversations replay a Text block's citations list as-is into a later request's message history.

Types

Functions

@spec from_json(map()) :: t() | map()
@spec to_json(t() | map()) :: map()

Encodes a citation struct (or a plain map, passed through unchanged) back to its wire shape — needed because Anthropic.ToolRunner and multi-turn conversations replay a Text block's citations list as-is into a later request's message history.