[Frontend] Expand tools even if tool_choice="none" (#17177)

Signed-off-by: okada shintarou <okada@preferred.jp>
This commit is contained in:
Shintarou Okada
2025-07-01 12:47:38 -04:00
committed by GitHub
parent 8acb4badee
commit 3d19d47d91
5 changed files with 43 additions and 6 deletions
+1 -3
View File
@@ -686,10 +686,8 @@ class ChatCompletionRequest(OpenAIBaseModel):
if "tool_choice" not in data and data.get("tools"):
data["tool_choice"] = "auto"
# if "tool_choice" is "none" -- ignore tools if present
# if "tool_choice" is "none" -- no validation is needed for tools
if "tool_choice" in data and data["tool_choice"] == "none":
# ensure that no tools are present
data.pop("tools", None)
return data
# if "tool_choice" is specified -- validation