Skip to content

Commit 7aaa2bd

Browse files
authored
[Bugfix] ensure tool_choice is popped when tool_choice:null is passed in json payload (#19679)
Signed-off-by: Guillaume Calmettes <[email protected]>
1 parent 2f5c14d commit 7aaa2bd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vllm/entrypoints/openai/protocol.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ def check_tool_usage(cls, data):
841841
return data
842842

843843
# 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:
845845

846846
# ensure that if "tool choice" is specified, tools are present
847847
if "tools" not in data or data["tools"] is None:
@@ -853,7 +853,7 @@ def check_tool_usage(cls, data):
853853
if data["tool_choice"] not in [
854854
"auto", "required"
855855
] and not isinstance(data["tool_choice"], dict):
856-
raise NotImplementedError(
856+
raise ValueError(
857857
f'Invalid value for `tool_choice`: {data["tool_choice"]}! '\
858858
'Only named tools, "none", "auto" or "required" '\
859859
'are supported.'

0 commit comments

Comments
 (0)