Fix: Preserve Gemini tool-output media parts - #3571
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (4)
📝 WalkthroughWalkthroughAdds structured Gemini FunctionResponse parts support: new types and unmarshalling for function_response/parts, utilities to collect/convert mixed text+media blocks, bidirectional conversion preserving Parts, tests for mixed/media-only/native flows, and two Nix hash updates. ChangesGemini provider media support
Build dependency updates
Sequence Diagram(s)sequenceDiagram
participant Gemini as Gemini.FunctionResponse
participant Converter as convertGeminiFunctionResponseToToolOutput
participant Bifrost as ResponsesToolMessage.Output
participant Builder as convertResponsesMessagesToGeminiContents
Gemini->>Converter: provide FunctionResponse (Response + Parts)
Converter->>Bifrost: produce ResponsesFunctionToolCallOutputBlocks or ResponsesToolCallOutputStr
Bifrost->>Builder: when sending → include FunctionResponse.Parts in emitted Gemini FunctionResponse
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related issues
Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 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 |
Confidence Score: 5/5Safe to merge — the change is a pure provider converter fix, all new helpers are transformation-only functions, and the bug being fixed (dropped media in tool outputs) is well-exercised by the new tests. The logic in No files require special attention. Important Files Changed
Reviews (4): Last reviewed commit: "fix: gemini tool call media outputs" | Re-trigger Greptile |
ec50983 to
995bd28
Compare
The merge-base changed after approval.
d36cd75 to
5e4bfb7
Compare
6711ce3 to
a1beab5
Compare
e6d62fe to
4b2c248
Compare
|
Hi, |
|
Seems like this was superceeded by #4202 ? |
fa15f50 to
ca190fc
Compare
ac30a53 to
7c66b20
Compare
Summary
At the moment, image tool call results are dropped when using Gemini. This makes the model effectively blind when using something akin to a screenshot tool, etc.
This is critical for us, so we've been running a modified version of bifrost. Would love to see this fixed in the next release so we can switch back to upstream.
Changes
Preserve Gemini functionResponse.parts media for tool outputs across Chat, Responses, streaming, and native GenAI paths.
Type of change
Affected areas
How to test
I wrote a standalone test script for an e2e test (current upstream version does not pass this):
Details
Screenshots/Recordings
N/A
Breaking changes
Related issues
N/A
Security considerations
N/A
Checklist
Summary by CodeRabbit
New Features
Tests
Chores