Skip to content

v0.22.0

@ozongzi ozongzi tagged this 24 Apr 18:53
Adds `Content::Document(DocumentContent)` variant with `DocumentData::{Base64, Url}`
and optional filename. Providers with native file support emit the appropriate
wire shape:

- Anthropic:         `{type: "document", source: {type: "base64"|"url", ...}}`
- OpenAI Responses:  `{type: "input_file", file_data|file_url, filename}`
- Gemini:            base64 → `inline_data`, URL → `file_data {file_uri}`
- OpenRouter:        `{type: "file", file: {filename, file_data}}`
- claude_code:       Anthropic document block on stdin JSON

Providers without a file wire (DeepSeek, Grok, GLM, Kimi) silently drop
`Content::Document` parts; users route PDFs through `Provider::OpenRouter`
with a matching `base_url` for those models.

Anthropic `cache_control` stamping extends to document blocks. Tool-result
documents are dropped everywhere (no provider accepts files in function
call outputs).

One breaking change: `Content` is `#[non_exhaustive]`-ish in spirit but
exhaustive external `match` on it must now add a `Content::Document(_)`
arm.
Assets 2
Loading