-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
[Feature] Support MiniMax-M1 function calls features #20297
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
Conversation
Signed-off-by: QscQ <[email protected]>
Signed-off-by: QscQ <[email protected]>
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 @qscqesze, 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 vLLM's capabilities by adding native support for Minimax-M1 model's function calling features. It involves creating a specialized chat template to format prompts according to Minimax-M1's requirements and developing a dedicated tool parser to interpret the model's tool call responses, including robust handling for streaming scenarios. This integration allows users to leverage Minimax-M1 models for advanced tool-use applications within the vLLM framework.
Highlights
- Minimax-M1 Function Call Support: Introduces comprehensive support for Minimax-M1's function calling features, enabling vLLM to correctly format prompts for tool use and parse the model's tool call responses.
- New Chat Template: Adds a new Jinja chat template (
examples/tool_chat_template_minimax_m1.jinja
) specifically designed for Minimax-M1, defining its unique prompt format for system messages, user inputs, assistant responses, and the structure for tool definitions and tool calls using XML tags. - Dedicated Tool Parser: Implements a new
MinimaxToolParser
to accurately extract and stream tool calls from Minimax-M1 model outputs. This parser handles the model's specific XML-like tag structure (<tool_calls>
) and uses partial JSON parsing for incremental argument extraction during streaming. - Integration with OpenAI API: Integrates the new
MinimaxToolParser
into vLLM's OpenAI API entrypoint, allowing users to enable Minimax-M1 function calling via the--tool-call-parser minimax
command-line argument.
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 is currently in preview and 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 to provide feedback.
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 Minimax-M1 function calls, including a new Jinja chat template and a dedicated tool parser. The non-streaming tool extraction logic appears sound. However, the streaming tool call parsing in minimax_tool_parser.py
has significant design flaws related to handling multiple concurrent tool calls and extracting argument deltas, which will lead to incorrect behavior. Additionally, there are opportunities to improve error handling and code clarity for better maintainability.
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
Signed-off-by: QscQ <[email protected]>
Signed-off-by: qingjun <[email protected]>
Signed-off-by: QscQ <[email protected]>
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.
Great work, thanks for sharing examples! It would be nice to add a unit test, especially to test complex features like streaming - see xlam for an example https://github.com/vllm-project/vllm/blob/02cabff207ca68094a73ba21296c82cdbcb1d1a5/tests/tool_use/test_xlam_tool_parser.py
@heeju-kim2 @aarnphm Hi. Would you have some time to help review this RP when convenient? It looks like we’ll need someone with write access to approve it in order to move forward with the CI/CD process. |
Can you add tests similar to Michael's suggestion here? |
note for self: one more tools to keep in mind of 😃 |
Signed-off-by: QscQ <[email protected]>
Signed-off-by: qingjun <[email protected]>
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.
Thanks for this
@aandyw I noticed that the CI/CD pipeline for this auto-merge has been running for over 17 hours. It seems to be stuck at the "Intel HPU Test" stage — is this expected, or could something be wrong? |
) Signed-off-by: QscQ <[email protected]> Signed-off-by: qingjun <[email protected]>
) Signed-off-by: QscQ <[email protected]> Signed-off-by: qingjun <[email protected]>
) Signed-off-by: QscQ <[email protected]> Signed-off-by: qingjun <[email protected]>
) Signed-off-by: QscQ <[email protected]> Signed-off-by: qingjun <[email protected]> Signed-off-by: avigny <[email protected]>
) Signed-off-by: QscQ <[email protected]> Signed-off-by: qingjun <[email protected]>
Support MiniMax-M1 function calls features
How to use:
test_scripts:
Outpt:
Streaming Test:
Output: