-
-
Notifications
You must be signed in to change notification settings - Fork 627
fix(translator): preserve built-in tools (web_search) to Responses API #552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(translator): preserve built-in tools (web_search) to Responses API #552
Conversation
- Pass through non-function tool definitions like web_search - Translate tool_choice for built-in tools and function tools - Add regression tests for built-in tool passthrough
Summary of ChangesHello @XInTheDark, 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 resolves a critical issue where built-in tools, such as "web_search", were inadvertently discarded during the translation process between OpenAI Chat Completions and the Responses API. The changes ensure that these tools, along with their associated "tool_choice" settings, are accurately preserved in both translation directions. Additionally, a new "copilot-unlimited-mode" configuration has been introduced to enhance compatibility with "copilot-api" by automatically prepending an assistant message to relevant requests, which may help in managing API rate limits. Highlights
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly implements the fix to preserve built-in tools like web_search during translation between OpenAI and Codex API formats. The changes in the translator files are logical and are well-covered by the new tests.
However, this PR also introduces a new copilot-unlimited-mode feature and includes some refactoring in the amp module. These changes are not mentioned in the PR description, making the review process more difficult. In the future, it would be beneficial to keep pull requests focused on a single concern to improve clarity and reviewability.
Overall, the changes are positive, but the scope of the PR could be improved.
| if err != nil { | ||
| return rawJSON | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The error from sjson.SetRawBytes is silently ignored. While an error here is unlikely, it's good practice to log it for debugging purposes. This would help identify potential issues if the input rawJSON is malformed in an unexpected way.
You will need to import log "github.com/sirupsen/logrus" to apply this suggestion, which appears to be the standard logger for this project.
| if err != nil { | |
| return rawJSON | |
| } | |
| if err != nil { | |
| log.Warnf("Failed to prepend assistant message for copilot unlimited mode: %v", err) | |
| return rawJSON | |
| } |
|
Superseded by #553 (same fix, rebased onto upstream main; single-commit PR). |
Problem
Fix
Tests