Skip to content

Commit e9a674a

Browse files
committed
fix: ensure tool_choice is not None if present in payload
Signed-off-by: Guillaume Calmettes <[email protected]>
1 parent 37a7d5d commit e9a674a

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
@@ -819,7 +819,7 @@ def check_tool_usage(cls, data):
819819
return data
820820

821821
# if "tool_choice" is specified -- validation
822-
if "tool_choice" in data:
822+
if "tool_choice" in data and data["tool_choice"] is not None:
823823

824824
# ensure that if "tool choice" is specified, tools are present
825825
if "tools" not in data or data["tools"] is None:
@@ -831,7 +831,7 @@ def check_tool_usage(cls, data):
831831
if data["tool_choice"] not in [
832832
"auto", "required"
833833
] and not isinstance(data["tool_choice"], dict):
834-
raise NotImplementedError(
834+
raise ValueError(
835835
f'Invalid value for `tool_choice`: {data["tool_choice"]}! '\
836836
'Only named tools, "none", "auto" or "required" '\
837837
'are supported.'

0 commit comments

Comments
 (0)