Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions vllm/entrypoints/openai/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,12 @@ def check_tool_usage(cls, data):

# if "tool_choice" is not specified but tools are provided,
# default to "auto" tool_choice
if "tool_choice" not in data and "tools" in data:
data["tool_choice"] = "auto"
if "tool_choice" not in data:
if data.get("tools"):
data["tool_choice"] = "auto"

# if "tool_choice" is specified -- validation
if "tool_choice" in data:
elif "tool_choice" in data:

# ensure that if "tool choice" is specified, tools are present
if "tools" not in data or data["tools"] is None:
Expand Down