[Bugfix] Honor tool_choice="none" in Chat Completions streaming (#42752)

Signed-off-by: hoobnn <111053672+hoobnn@users.noreply.github.com>
Signed-off-by: sfeng33 <4florafeng@gmail.com>
Co-authored-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
hoobnn
2026-06-03 13:27:45 -07:00
committed by GitHub
co-authored by sfeng33
parent dad95e34d8
commit 2b237c7a41
2 changed files with 40 additions and 0 deletions
+3
View File
@@ -706,6 +706,9 @@ class DelegatingParser(Parser):
tool_call_id_type: str = "random",
function_name_returned: bool = False,
) -> tuple[DeltaMessage | None, bool]:
if request.tool_choice == "none":
return (DeltaMessage(content=delta_text) if delta_text else None), False
assert self._tool_parser is not None
supports_required_and_named = self._tool_parser.supports_required_and_named
if (