Skip to content

Commit 2bb092d

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

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
@@ -682,7 +682,7 @@ def check_tool_usage(cls, data):
682682
return data
683683

684684
# if "tool_choice" is specified -- validation
685-
if "tool_choice" in data:
685+
if "tool_choice" in data and data["tool_choice"] is not None:
686686

687687
# ensure that if "tool choice" is specified, tools are present
688688
if "tools" not in data or data["tools"] is None:
@@ -694,7 +694,7 @@ def check_tool_usage(cls, data):
694694
if data["tool_choice"] not in [
695695
"auto", "required"
696696
] and not isinstance(data["tool_choice"], dict):
697-
raise NotImplementedError(
697+
raise ValueError(
698698
f'Invalid value for `tool_choice`: {data["tool_choice"]}! '\
699699
'Only named tools, "none", "auto" or "required" '\
700700
'are supported.'

0 commit comments

Comments
 (0)