Skip to content

Tools

Pydantic AI connects answer citations with saved chats

3-line summary

  1. Version 2.61.0 adds a common citation format and provider and UI support.
  2. Citations kept in the frontend differ from those replayed to a model.
  3. Provider, output and streaming choices still determine what survives.
PracticalDevelopers
AI-generated conceptual image of a navy paper ribbon joined to a red book by three copper threads
AI-generated conceptual image: AI Ping

The Python AI SDK Pydantic AI has added a common way to collect answer citations and connect them with saved conversations and web chat interfaces. Version 2.61.0, released October 24, includes four coordinated changes covering citation data, additional providers, history replay and the Vercel AI adapter.

Citations attach to the text portion of a model response. They pair web or document sources with a character range where that relationship can be checked; otherwise the range is absent. The documentation cautions that listed sources can copy one another, so a larger number does not establish stronger support.

The Vercel AI adapter lists each cited web page once per message. Received citations survive in text metadata when a frontend stores and returns history. Document sources stay outside the web-page list.

Metadata includes excerpts and original provider citation data, potentially carrying a user’s document content. Client-supplied citations are checked for structure and fit within the text. Invalid entries are dropped while others survive.

AI-generated conceptual image of a rose-glass case carrying fabric, a book and folded paper together
AI-generated conceptual image: AI Ping

Provider differences remain. On Amazon Bedrock, document citations cover text and PDFs on supported Anthropic models, excluding S3 documents. OpenRouter supplies no usable position in the answer. With xAI, enabling citations makes the model write Markdown markers. The Citations option does not request citations for structured output on Bedrock or xAI. Other Bedrock models ignore the setting, and text documents must be UTF-8 when citations are enabled or a user error is raised. Bedrock document titles follow their order, with names such as Document 1.

Saving citations does not mean replaying all of them

Replay is narrower than storage. Returning history to its original provider supports Anthropic web-search citations and OpenAI Responses URL and file annotations. Responses also needs the original message ID. Position-based document citations and history switched to a different provider go back as plain text.

Document references use the request’s document order. Trimming or editing can make the same position identify another document, so these references are not replayed unchanged. Edits that keep the answer’s length can also evade change detection.

When consecutive text parts merge for the web interface, citation positions move too. Anthropic web-search citations must cover their entire original text part. After merging, those citations remain in metadata while the answer returns to Anthropic as plain text.

AI-generated conceptual image of a teal triangular token at its matching opening beside an empty round opening
AI-generated conceptual image: AI Ping

Citations can arrive after text during streaming. Google and OpenAI Chat deliver them at the response’s end, so the documentation directs readers to the completed response for citations. A separate interface integration, the AG-UI adapter, does not send citation data to the frontend.

Sources

  • How-to guideAbout 17 min reading

    Design an AI workflow with clear review points

    Map intake, drafting, review and approval. Walk through missing information and retries on paper, with explicit stop and handoff conditions.

    AdvancedPlanningDesignersMarketersSalesProduct researchOffice workersDevelopers
  • How-to guideAbout 18 min reading

    Evaluate AI work beyond first impressions

    Build a small evaluation set, compare drafts against evidence, change one instruction and test on a fresh case. No code required.

    AdvancedPlanningDesignersMarketersSalesProduct researchOffice workersDevelopers