chore(websearch): justify new mutable annotations for the type-discipline gate

Adds the required mutable-ok reasons to the five annotations this
change introduced; no logic changes.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Aidan Sinclair 2026-09-09 09:27:41 -04:00
parent 038a4bb384
commit 6cc3a60221
3 changed files with 5 additions and 5 deletions

View file

@ -1523,7 +1523,7 @@ class WebSearchInterceptionLogger(CustomLogger):
objective = tool_input.get("objective")
valid_objective = objective if isinstance(objective, str) and objective.strip() else None
raw_queries = tool_input.get("search_queries")
valid_queries: list[str] | None = None
valid_queries: list[str] | None = None # mutable-ok: matches litellm.asearch's list[str] query parameter
if isinstance(raw_queries, Sequence) and not isinstance(raw_queries, str):
queries = [q for q in raw_queries if isinstance(q, str) and q.strip()]
if queries:
@ -1619,7 +1619,7 @@ class WebSearchInterceptionLogger(CustomLogger):
# Forward the model's richer shape (objective + keyword queries)
# only to providers whose search API takes it natively; everyone
# else keeps the single query string the model also provided.
query_arg: str | list[str] = query
query_arg: str | list[str] = query # mutable-ok: litellm.asearch declares query as str | list[str]
if rich and self._provider_supports_rich_search(search_provider):
rich_queries = rich.get("search_queries")
if rich_queries:
@ -1847,7 +1847,7 @@ class WebSearchInterceptionLogger(CustomLogger):
for tool_call in tool_calls:
# Handle both Anthropic-style input and OpenAI-style function.arguments
query = None
tool_args: dict | None = None
tool_args: dict | None = None # mutable-ok: the tool call's own arguments dict
if "input" in tool_call and isinstance(tool_call["input"], dict):
tool_args = tool_call["input"]
query = tool_args.get("query")

View file

@ -17,7 +17,7 @@ _WEB_SEARCH_TOOL_DESCRIPTION: Final = (
)
def _web_search_input_schema() -> dict[str, object]:
def _web_search_input_schema() -> dict[str, object]: # mutable-ok: plain-dict tool shape, as the get_* builders
"""
JSON schema for the web search tool's input, shared by every tool format.

View file

@ -39,7 +39,7 @@ class RichWebSearchInput(TypedDict, total=False):
objective: ReadOnly[str]
"""Natural-language description of the goal behind the search."""
search_queries: ReadOnly[list[str]]
search_queries: ReadOnly[list[str]] # mutable-ok: forwarded verbatim as litellm.asearch's list[str] query argument
"""Two to five short keyword queries covering different angles."""