-
- Notifications
You must be signed in to change notification settings - Fork 12.1k
[Bugfix] Fix tool_choice="none" being ignored by GPT-OSS/harmony models #30867
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
| Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
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 addresses a bug where tool_choice="none" was being ignored for GPT-OSS/harmony models. The changes correctly modify _make_request_with_harmony to respect the exclude_tools_when_tool_choice_none flag, preventing tool definitions from being included in the prompt when tool_choice is set to "none". The logic is sound, and a new test case has been added to verify the fix. The changes appear correct and improve consistency. I have no major concerns.
| 👋 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 You ask your reviewers to trigger select CI tests on top of 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 If you have any questions, please reach out to us on Slack at https://slack.vllm.ai. 🚀 |
chaunceyjiang left a comment
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 Responses API should also support this.
| Hi @HaloWorld, the pre-commit checks have failed. Please run: uv pip install pre-commit pre-commit install pre-commit run --all-filesThen, commit the changes and push to your branch. For future commits, Tip Is |
Thank you for the feedback. You're absolutely right that the feature should ideally be consistent across our APIs. Currently, the Given this context and to adhere to the principle of minimal changes for this PR, would it be acceptable to add support for the Responses API in a separate, follow-up PR? This would allow us to land the core logic for the Chat API promptly while giving due attention to properly extending the Responses API. Please let me know your thoughts. I'm happy to proceed either way. |
chaunceyjiang left a comment
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~
| @chaunceyjiang Hi, thank you for reviewing and approving the changes. I've noticed that the CI run has failed on one specific test case: Interestingly, I wasn't able to reproduce this failure locally when running the same test, and it passes on my machine. I'd be happy to provide any additional logs or information that might help investigate the discrepancy between the CI environment and my local setup. |
Co-authored-by: Chauncey <chaunceyjiang@gmail.com> Signed-off-by: PlatinumGod <pyjapple@gmail.com>
Signed-off-by: yujiepu <pyjapple@gmail.com>
…ls (vllm-project#30867) Signed-off-by: yujiepu <pyjapple@gmail.com> Signed-off-by: PlatinumGod <pyjapple@gmail.com> Co-authored-by: Chauncey <chaunceyjiang@gmail.com> Signed-off-by: zRzRzRzRzRzRzR <2448370773@qq.com>


GPT-OSS models using the harmony format were ignoring the
tool_choice="none"parameter and could still trigger tool calls when tools were provided in the request. This issue arose because the_make_request_with_harmonymethod only checked for the existence ofrequest.tools, without accounting for thetool_choicesetting or theexclude_tools_when_tool_choice_noneflag.This fix ensures that harmony models respect the
exclude_tools_when_tool_choice_noneflag, aligning their behavior with other model types and OpenAI API standards. When tool_choice="none" and the flag is enabled, tool definitions are no longer included in the system message.Purpose
Modified _make_request_with_harmony to incorporate checks for tool_choice and exclude_tools_when_tool_choice_none.
Test Plan
--exclude-tools-when-tool-choice-noneTest Result
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.