-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
[Bugfix] ensure tool_choice is popped when tool_choice:null
is passed in json payload
#19679
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
base: main
Are you sure you want to change the base?
Conversation
👋 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 🚀 |
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 @gcalmettes, 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 addresses a bug in the chat completions endpoint where providing "tool_choice": null
in the request body resulted in a server error. The change modifies the input validation to gracefully handle this specific case, preventing the error and allowing the request to proceed as if tool_choice
was not specified.
Highlights
- Bugfix: Fixes a 500 Internal Server Error that occurred when the
tool_choice
field was explicitly set tonull
in the JSON payload for chat completions. - Input Handling: Adds specific handling in the
check_tool_usage
validation logic to correctly process requests wheretool_choice
is provided with anull
value.
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 configureGemini 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 PR fixes a bug where a 500 Internal Server Error
occurs when tool_choice
is set to null
in the request payload. The change removes tool_choice
from the request data if it's None
. A suggestion has been made to use data.get("tool_choice")
instead of direct dictionary access to prevent a KeyError
if tool_choice
is missing.
6e170e3
to
7c17a1c
Compare
@aarnphm any chance you could look at this small fix ? |
fyi: #17177 |
@aarnphm it seems that PR #17177 deals with the case when the valid Currently, the below request will results in a
|
What is the behaviour if you just don't specify tool_choice? |
if The problem is that some external integration are always passing the |
Right, then it seems like these tools aren't respecting the openai spec https://platform.openai.com/docs/api-reference/responses/create#responses-create-tool_choice 🤦 fwiw I think we ought to update vllm/vllm/entrypoints/openai/protocol.py Line 690 in 6f68c49
none ...
I'm not against merging this, just that this is prone to getting removed, as I plan to clean this up a bit later, so probably some inline docs would also be helpful. If possible, can you also open a ticket from the zed-editor side to mention about this? |
7c17a1c
to
85f243c
Compare
This is what I had originally done, but then decided to make it a separate block, as not specifying In fact, based on your input, I know think that the best solution would be to validate that On a second note, I also realized the I have amended the PR, let me think if you think this is more reasonable. |
85f243c
to
2bb092d
Compare
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.
Yep, I think this makes more sense. Thanks for this.
any chance you have the permission to restart the failed tests ? It seems that they are due to errors unrelated to the changes introduced in this PR ? Or should I push an empty commit to trigger the ci again ? |
Signed-off-by: Guillaume Calmettes <[email protected]>
Head branch was pushed to by a user without write access
2bb092d
to
e9a674a
Compare
re-up on this one @aarnphm 🙏 |
When request is made with
"tool_choice":null,"tools":[]
in a json payload, vllm returns a500 Internal Server Error
.The minimalist example below triggers the error:
This is due to the fact that the
tool_choice
field is then present on the request, and deserialized asNone
, but this case is not handled, in the currentcheck_tool_usage
routine.This PR fixes the issue.