[Bugfix] Fix Qwen3 tool parser for Responses API tools (#38848)

Signed-off-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Flora Feng
2026-04-08 10:08:51 +08:00
committed by GitHub
parent 7b80cd8ac3
commit 9ea7d670d8
4 changed files with 99 additions and 113 deletions
+14
View File
@@ -142,6 +142,20 @@ def _extract_tool_info(
raise TypeError(f"Unsupported tool type: {type(tool)}")
def find_tool_properties(
tools: list[Tool] | None,
tool_name: str,
) -> dict[str, Any]:
"""Find a tool by name and return its properties dict, or {}."""
if not tools:
return {}
for tool in tools:
name, params = _extract_tool_info(tool)
if name == tool_name:
return (params or {}).get("properties", {})
return {}
def _get_tool_schema_from_tool(tool: Tool) -> dict:
name, params = _extract_tool_info(tool)
params = params if params else {"type": "object", "properties": {}}