[Frontend] Support OpenAI Responses API namespace tools (#47024)

Signed-off-by: zhongjing123 <jimzhong5193@gmail.com>
Co-authored-by: zhongjing123 <jimzhong5193@gmail.com>
This commit is contained in:
Zhong
2026-07-06 06:21:27 +00:00
committed by GitHub
co-authored by zhongjing123
parent 990c2a0187
commit 98ba9b9583
8 changed files with 383 additions and 22 deletions
+13 -4
View File
@@ -592,10 +592,19 @@ class ResponsesRequest(OpenAIBaseModel):
)
elif is_named_tool_choice and tools is not None:
tool_name = tool_choice.get("name")
tool_names = {
t.get("name") if isinstance(t, dict) else getattr(t, "name", None)
for t in tools
}
tool_names = set()
for tool in tools:
if isinstance(tool, dict):
if tool.get("type") == "namespace":
namespace = tool.get("name")
for namespaced_tool in tool.get("tools", []):
namespaced_name = namespaced_tool.get("name")
tool_names.add(namespaced_name)
tool_names.add(f"{namespace}__{namespaced_name}")
else:
tool_names.add(tool.get("name"))
else:
tool_names.add(getattr(tool, "name", None))
if not tool_name or tool_name not in tool_names:
raise VLLMValidationError(
"Tool choice 'function' not found in 'tools' parameter.",