Represents a citation linking a span of response text to a source.
All four major providers (Anthropic, OpenAI, Google, Perplexity) share the pattern of linking response text to sources. This struct normalizes those provider-specific formats into a common shape.
Fields
:cited_text- The actual text cited from the source (when available):source- ACitationSourceidentifying where the citation came from:start_index- Character offset into the ContentPart's text where this citation starts:end_index- Character offset where this citation ends:confidence- Confidence score (0.0-1.0) when provided (e.g., Gemini):metadata- Provider-specific data for round-tripping. String keys for JSON serialization.
Summary
Functions
Filters citations by source type.
Returns all unique source URLs from a list of citations.
Types
Functions
Filters citations by source type.
@spec new(map()) :: {:ok, t()} | {:error, Ecto.Changeset.t()}
Returns all unique source URLs from a list of citations.