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(