From cac60f7c2e5b7b87b82b4749c1f890f55e348a43 Mon Sep 17 00:00:00 2001 From: "minke.yu" Date: Fri, 13 Nov 2026 23:22:21 +0800 Subject: [PATCH] fix(protocol): effective_tool_choice preserves namespace/type --- python/sglang/srt/entrypoints/openai/protocol.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/entrypoints/openai/protocol.py b/python/sglang/srt/entrypoints/openai/protocol.py index cae26539da..d5ce0a7802 100644 --- a/python/sglang/srt/entrypoints/openai/protocol.py +++ b/python/sglang/srt/entrypoints/openai/protocol.py @@ -2115,7 +2115,10 @@ class ResponsesRequest(PDRoutingFields): "name" ) if tool_choice.get("type") in ("function", "custom") and name: - return {"type": "function", "name": name} + choice = {"type": tool_choice["type"], "name": name} + if "namespace" in tool_choice: + choice["namespace"] = tool_choice["namespace"] + return choice return "auto" def to_sampling_params(