Skip to content

feat(client): serialize ContentBlock::Attachment across native wires - #1047

Merged
hakula139 merged 2 commits into
mainfrom
feat/multimodal-phase2-wires
Dec 3, 2026
Merged

hakula139 merged 2 commits into
mainfrom
feat/multimodal-phase2-wires

Conversation

@hakula139

Copy link
Copy Markdown
Member

Summary

  • Serialize hydrated ContentBlock::Attachment (AttachmentSource::Base64) blocks natively across all three provider wires, returning ClientError::UnsupportedContent for unresolved AttachmentSource::BlobRef payloads or unsupported media types:
    • Anthropic (crates/ox-core/src/client/anthropic.rs): encode image/* as image blocks and application/pdf as document blocks with base64 source.
    • Google Gemini (crates/ox-core/src/client/google.rs): encode image/*, application/pdf, audio/*, and video/* via GeminiPart::inline_data (inlineData with mimeType and data).
    • OpenAI Responses (crates/ox-core/src/client/openai.rs): widen ResponsesInputItem::Message::content to ResponsesMessageContent (Text for text-only messages, Parts when attachments are present), encoding text as input_text, image/* as input_image data URLs, and application/pdf as input_file data URLs (defaulting missing filenames to attachment.pdf).
  • Update wire serialization tests in anthropic, google, and openai to cover supported MIME types, BlobRef rejection, and unsupported MIME rejection.

Test plan

  • cargo fmt --check (passed)
  • cargo clippy --all-targets -- -D warnings (passed)
  • cargo doc --no-deps (passed)
  • cargo test -p ox-core (225 passed, 0 failed, 2 live tests ignored)
  • cargo llvm-cov -p ox-core --summary-only (97.37% line coverage)
  • nix develop -c run-hooks (all hooks passed)

Related

@hakula139 hakula139 added enhancement New capability area: client Touches the model API client, authentication, or request wire labels Dec 3, 2026
@hakula139 hakula139 self-assigned this Dec 3, 2026
@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.76471% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/ox-core/src/client/google.rs 99.13% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hakula139
hakula139 merged commit 72c2360 into main Dec 3, 2026
7 checks passed
@hakula139
hakula139 deleted the feat/multimodal-phase2-wires branch December 3, 2026 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: client Touches the model API client, authentication, or request wire enhancement New capability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant