[Bugfix] Handle malformed namespace tools (#53763)
Signed-off-by: Taneem Ibrahim <taneem.ibrahim@gmail.com>
This commit is contained in:
@@ -622,8 +622,15 @@ class ResponsesRequest(OpenAIBaseModel):
|
||||
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")
|
||||
namespaced_tools = tool.get("tools")
|
||||
if not isinstance(namespaced_tools, list):
|
||||
return data
|
||||
for namespaced_tool in namespaced_tools:
|
||||
namespaced_name = (
|
||||
namespaced_tool.get("name")
|
||||
if isinstance(namespaced_tool, dict)
|
||||
else getattr(namespaced_tool, "name", None)
|
||||
)
|
||||
tool_names.add(namespaced_name)
|
||||
tool_names.add(f"{namespace}__{namespaced_name}")
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user