We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e0f63e4 commit 98df153Copy full SHA for 98df153
vllm/entrypoints/openai/protocol.py
@@ -859,6 +859,15 @@ def check_tool_usage(cls, data):
859
'are supported.'
860
)
861
862
+ # if tool_choice is "required" but the "tools" list is empty,
863
+ # override the data to behave like "none" to align with
864
+ # OpenAI’s behavior.
865
+ if data["tool_choice"] == "required" and isinstance(
866
+ data["tools"], list) and len(data["tools"]) == 0:
867
+ data["tool_choice"] = "none"
868
+ del data["tools"]
869
+ return data
870
+
871
# ensure that if "tool_choice" is specified as an object,
872
# it matches a valid tool
873
correct_usage_message = 'Correct usage: `{"type": "function",' \
0 commit comments