feat(translator): OpenAI web search annotations passthrough#1539
feat(translator): OpenAI web search annotations passthrough#1539cjangrist wants to merge 1 commit intorouter-for-me:mainfrom
Conversation
…ormats When OpenAI returns url_citation annotations on Chat Completions responses, translate them to the appropriate format for each downstream client: - Claude: citations array on message_delta/response - Gemini: groundingMetadata.citations - Responses: populated annotations array on output items Also enables built-in tool passthrough (web_search_preview) from Responses to Chat Completions requests. 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 translator's capabilities by enabling the seamless propagation of OpenAI's web search annotations and built-in tools across various API formats. The changes ensure that rich contextual information from web searches is preserved and correctly formatted when translating between OpenAI, Claude, Gemini, and Responses APIs, improving the fidelity and utility of translated responses. 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
Activity
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 successfully implements the passthrough of OpenAI web search annotations to various downstream formats like Claude, Gemini, and Responses, for both streaming and non-streaming scenarios. The changes also enable the passthrough of built-in tools from Responses to Chat Completions, and the new unit tests provide good coverage for these features. My review focuses on improving code maintainability by addressing several instances of duplicated logic. I've suggested creating helper functions to handle JSON compaction and annotation attachment, which would reduce redundancy and make the code cleaner. Additionally, I've pointed out an opportunity to improve readability by reducing repetitive type assertions.
internal/translator/openai/openai/responses/openai_openai-responses_response.go
Show resolved
Hide resolved
|
@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
url_citationannotations from Chat Completions responses to all downstream formats (Claude citations, Gemini groundingMetadata, Responses annotations)web_search_preview) from Responses→Chat Completions requestsmessage.annotations, attach directlyTest plan
content_part.doneandoutput_item.doneboth asserted (Responses)search_context_size)go test ./...— zero failures🤖 Generated with Claude Code