Skip to content

Commit 8cda74b

Browse files
committed
fix
1 parent 5f6da08 commit 8cda74b

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

src/agents/models/openai_responses.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -469,18 +469,15 @@ def _convert_tool(cls, tool: Tool) -> tuple[ToolParam, ResponseIncludable | None
469469
}
470470
includes: ResponseIncludable | None = None
471471
elif isinstance(tool, WebSearchTool):
472-
# TODO: Remove the cast when ToolParam adds external_web_access.
473-
converted_tool = cast(
474-
ToolParam,
475-
{
476-
"type": "web_search",
477-
"filters": tool.filters.model_dump() if tool.filters is not None else None,
478-
"user_location": tool.user_location,
479-
"search_context_size": tool.search_context_size,
480-
},
481-
)
472+
converted_tool_dict: dict[str, Any] = {
473+
"type": "web_search",
474+
"filters": tool.filters.model_dump() if tool.filters is not None else None,
475+
"user_location": tool.user_location,
476+
"search_context_size": tool.search_context_size,
477+
}
482478
if tool.external_web_access is not None:
483-
converted_tool["external_web_access"] = tool.external_web_access
479+
converted_tool_dict["external_web_access"] = tool.external_web_access
480+
converted_tool = cast(ToolParam, converted_tool_dict)
484481
includes = None
485482
elif isinstance(tool, FileSearchTool):
486483
converted_tool = {

0 commit comments

Comments
 (0)