A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 23:45 UTC
[Bugfix] ensure tool_choice is popped when `tool_choice:null` is passed in json payload (#19679)
Signed-off-by: Guillaume Calmettes <gcalmettes@scaleway.com>
Guillaume Calmettes committed
Jul 23, 2025 at 09:30 UTC
7aaa2bd5a83fd18121e3226c78c0b89b3a43367b
1 file changed
+2
-2
vllm/entrypoints/openai/protocol.py
+2
-2
@@ -841,7 +841,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
841
return data
842
843
# if "tool_choice" is specified -- validation
844
- if "tool_choice" in data:
844
+ if "tool_choice" in data and data["tool_choice"] is not None:
845
846
# ensure that if "tool choice" is specified, tools are present
847
if "tools" not in data or data["tools"] is None:
@@ -853,7 +853,7 @@ class ChatCompletionRequest(OpenAIBaseModel):
853
if data["tool_choice"] not in [
854
"auto", "required"
855
] and not isinstance(data["tool_choice"], dict):
856
- raise NotImplementedError(
856
+ raise ValueError(
857
f'Invalid value for `tool_choice`: {data["tool_choice"]}! '\
858
'Only named tools, "none", "auto" or "required" '\
859
'are supported.'