Skip to content

Commit 0987153

Browse files
committed
fix
1 parent 129104c commit 0987153

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

src/agents/models/openai_responses.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,17 @@ def _convert_tool(cls, tool: Tool) -> tuple[ToolParam, ResponseIncludable | None
469469
}
470470
includes: ResponseIncludable | None = None
471471
elif isinstance(tool, WebSearchTool):
472-
# TODO: revist the type: ignore comment when ToolParam is updated in the future
473-
converted_tool = {
474-
"type": "web_search",
475-
"filters": tool.filters.model_dump() if tool.filters is not None else None, # type: ignore [typeddict-item]
476-
"user_location": tool.user_location,
477-
"search_context_size": tool.search_context_size,
478-
"external_web_access": tool.external_web_access,
479-
}
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+
"external_web_access": tool.external_web_access,
481+
},
482+
)
480483
includes = None
481484
elif isinstance(tool, FileSearchTool):
482485
converted_tool = {

src/agents/tool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ class WebSearchTool:
233233
"""The amount of context to use for the search."""
234234

235235
external_web_access: bool | None = None
236-
"""Control whether the web search tool fetches live content or uses only cached/indexed results in the Responses API. Set external_web_access: false on the web_search tool to run in offline/cache-only mode. Default is true (live access) if you do not set it.
236+
"""Control whether the web search tool fetches live content or uses only cached/indexed
237+
results in the Responses API. Set external_web_access: false on the web_search tool to run
238+
in offline or cache-only mode. Default is true (live access) if you do not set it.
237239
"""
238240

239241
@property

0 commit comments

Comments
 (0)