feat(translator): grounding metadata + Claude web_search citation passthrough#1532
feat(translator): grounding metadata + Claude web_search citation passthrough#1532cjangrist wants to merge 4 commits intorouter-for-me:mainfrom
Conversation
Add google_search, code_execution, and url_context tool passthrough in request translators and grounding_metadata response passthrough across all provider/format combinations. Streaming paths compact raw JSON to prevent SSE newline framing issues. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Summary of ChangesHello @cjangrist, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the proxy's capability to integrate with Gemini's advanced features by enabling the seamless use of Google Search grounding, code execution, and URL context tools. It ensures that requests containing these tools are correctly translated and forwarded to Gemini, and critically, that the rich grounding metadata returned by Gemini is accurately propagated back to the client across various API formats and streaming/non-streaming scenarios. This broadens the functionality available to users and improves the fidelity of responses by providing crucial context from the model's grounding process. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for Google Search grounding by passing through google_search, code_execution, and url_context tools in request translators, and groundingMetadata in response translators. The changes are applied consistently across numerous translators for various API formats (OpenAI, Claude) and providers (Antigravity, Gemini CLI, Gemini API). While the implementation appears correct, there is significant code duplication in handling the passthrough tools and in compacting JSON for streaming responses. I've added a few comments with suggestions to refactor this duplicated logic into shared utility functions to enhance maintainability.
…formats Preserve web_search_20250305 built-in tools in request translation and surface web_search_tool_result/citations_delta in Chat Completions and Responses API streaming + non-streaming output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…format Preserve built-in tools in Gemini request translation and convert web_search_tool_result/citations_delta to groundingMetadata in streaming and non-streaming Gemini output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
11 tests covering request tool preservation, streaming/non-streaming response translation for OpenAI, Responses, and Gemini formats, plus accumulator reset verification. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@tianyicui @soffchen @neavo @luispater @hkfires @masrurimz can I please have your thoughts? these pass through search engine tool call grounding references, critical for building trustable answer engines. |
Summary
Test plan
Generated with Claude Code