Repository navigation
fix(translation): normalize Anthropic image sources - #1308
dagardner-nv wants to merge 2 commits into
Conversation
Signed-off-by: David Gardner <dagardner@nvidia.com>
…malize-anthropic-images Signed-off-by: David Gardner <dagardner@nvidia.com>
|
@coderabbitai fullreview |
|
Action performed
|
|
No actionable comments were generated in the recent review. WalkthroughAnthropic image blocks in messages and tool results now decode to typed URL or base64 image sources when they match recognized shapes. Other shapes remain raw provider data. Tests cover direct and nested content decoding and re-encoding. ChangesAnthropic Image Decoding
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk:
|
What
Decode Anthropic URL and base64 images into
ImageSource::UrlandImageSource::Base64. Use one helper for images in message content and tool results.Keep the complete block as
ImageSource::Rawfor file references,cache_control,transformations, unexpected fields, or malformed sources. Document decoding remains unchanged.Why
Anthropic images previously always decoded as raw JSON. Normalize images whose fields fit the typed IR while preserving blocks that require provider-specific fields.
Notes for reviewers
On hold until after the 0.4 release. Do not merge before then.
The updated
anthropic_multimodal_blocks_decode_and_round_triptest checks the decoded IR and Anthropic round-trip for URL, base64, and raw images in both message content and tool results. It retains document metadata coverage.Validation passed:
anthropic_multimodal_blocks_decode_and_round_triptest.cargo check -p switchyard-translation --offline.Summary by CodeRabbit