chore: upgrade @anthropic-ai/sdk to 0.104.1 and @anthropic-ai/vertex-sdk to 0.17.1#600
chore: upgrade @anthropic-ai/sdk to 0.104.1 and @anthropic-ai/vertex-sdk to 0.17.1#600p12tic wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (11)
📝 WalkthroughWalkthroughThis PR adds defensive type checking for image source handling across message format transformers and API providers, ensuring only base64-sourced images are converted to data URLs; simultaneously extends markdown export to recognize new content block types (tool-reference, document, search-result) and updates Anthropic SDK dependencies. ChangesImage Source Type Safety
Extended Content Block Type Support
Anthropic SDK Version Update
🎯 2 (Simple) | ⏱️ ~12 minutes
🚥 Pre-merge checks | ✅ 2 | ❌ 3❌ Failed checks (3 warnings)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
edelauna
left a comment
There was a problem hiding this comment.
Thank you for taking on this dependency bump. Had a couple comments regarding image handling.
| @@ -361,7 +361,10 @@ export function convertToOpenAiMessages( | |||
| toolResultImages.push(part) | |||
There was a problem hiding this comment.
Should this push be guarded with if (part.source.type === "base64")? A URL-sourced image would get pushed here and emit "(see following user message for image)", but the follow-up flush block at line 385 is commented out — so the image silently disappears while the placeholder still goes to the model.
| if (part.type === "text") { | ||
| return part.text | ||
| } | ||
| return "" |
There was a problem hiding this comment.
In SDK 0.104.1, ToolResultBlockParam.content is Array<TextBlockParam | ImageBlockParam | SearchResultBlockParam | DocumentBlockParam | ToolReferenceBlockParam>. Could a SearchResultBlockParam or DocumentBlockParam inside a tool result end up here and get silently dropped as ""?
| image_url: { url: `data:${part.source.media_type};base64,${part.source.data}` }, | ||
| } | ||
| } | ||
| return { type: "text", text: "[Image]" } |
There was a problem hiding this comment.
OpenAI chat completions supports URL images natively via { type: "image_url", image_url: { url: "https://..." } }. ai-sdk.ts already handles this case at line 63 as a reference. Worth forwarding URL sources here instead of falling back to [Image]?
| }, | ||
| } | ||
| } | ||
| return { type: "text", text: "[Image]" } |
There was a problem hiding this comment.
Mistral also supports URL images natively (imageUrl: { url: "https://..." }). Could forward source.type === "url" here instead of substituting [Image], similar to openai-format.ts.
| if (part.type === "image") { | ||
| if (part.source.type === "base64") { | ||
| return new vscode.LanguageModelTextPart( | ||
| `[Image (${part.source?.type || "Unknown source-type"}): ${part.source?.media_type || "unknown media-type"} not supported by VSCode LM API]`, |
There was a problem hiding this comment.
Inside if (part.source.type === "base64"), part.source?.type is always "base64" — the optional chain and || "Unknown source-type" fallback are dead. Could simplify to [Image (base64): ${part.source.media_type} not supported by VSCode LM API].
Related GitHub Issue
Closes: #438
Description
Upgrades Anthropic AI SDK to newer version.
Test Procedure
Check if Anthropic provider still runs fine.
Pre-Submission Checklist
Screenshots / Videos
N/A.
Documentation Updates
Not needed.
Additional Notes
None.
Get in Touch
Mention at github.
Summary by CodeRabbit
Bug Fixes
New Features