-
Notifications
You must be signed in to change notification settings - Fork 906
[agent_template] Update qwen3 coder agent template #5802
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
[agent_template] Update qwen3 coder agent template #5802
Conversation
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.
Summary of Changes
Hello @Jintao-Huang, 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 improves the integration and flexibility of Qwen3-Coder models within the system. It introduces a new qwen3_coder
agent template and model type, along with a refactoring of the _format_tools
method across multiple agent templates to support optional system prompts. These changes streamline the configuration of agent-based models and ensure that Qwen3-Coder models are correctly represented and tested.
Highlights
- New Qwen3-Coder Agent Template: A dedicated
qwen3_coder
model type and agent template have been introduced, specifically designed for Qwen3-Coder models, enhancing their integration and functionality within the system. - Flexible System Prompt Handling: The
_format_tools
method across various agent templates (includingReactGRPO
,GLM4
,Hermes
,Llama
,Mistral
,Qwen
,React
, andToolBench
) has been updated to accept an optional system prompt, providing greater flexibility in agent configuration. - Qwen3-Coder Template Enhancements: The
Qwen3CoderAgentTemplate
now inherits fromHermesAgentTemplate
, and its_format_tools
method includes a default system prompt and improved tool formatting, streamlining its behavior. - Documentation Updates: Both the Chinese and English documentation for supported models and datasets have been updated to correctly list Qwen3-Coder models under the new
qwen3_coder
template type. - Test Case Refinement: The
test_qwen3_coder
test case has been updated to remove explicitmodel_type
specification, allowing for automatic inference, and includes a new assertion for template encoding consistency.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command>
or @gemini-code-assist <command>
. Below is a summary of the supported commands.
Feature | Command | Description |
---|---|---|
Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
Help | /gemini help |
Displays a list of available commands. |
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 .gemini/
folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 introduces support for the qwen3_coder
agent template, involving the addition of new model and template types, refactoring model registrations, and creating the Qwen3CoderAgentTemplate
. A significant part of the change is updating the _format_tools
method signature across various agent templates to correctly handle optional system prompts, which improves flexibility. Most changes are well-implemented and enhance code organization and correctness. I've identified one area for improvement in glm4.py
where the system prompt handling could be more consistent with the other templates.
return functions | ||
|
||
def _format_tools(self, tools: List[Union[str, dict]], system: str, user_message=None) -> str: | ||
def _format_tools(self, tools: List[Union[str, dict]], system: Optional[str] = None, user_message=None) -> str: |
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.
While the method signature is correctly updated to accept an Optional[str]
for the system
prompt, the implementation of this method currently ignores this parameter. Instead, it uses a hardcoded glm4_system
string. This will cause any custom system prompt provided by the user to be discarded when tools are used. To ensure user-provided system prompts are respected, the implementation should be updated to utilize the system
parameter, and only fall back to the default glm4_system
when the system
parameter is None
.
#5734