From c68832f7c70ace47587a03d9da7ecf450b75ab26 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 28 May 2026 11:28:23 -0700 Subject: [PATCH 1/2] fix(types): make `query` optional in `ActionSearch` The `query` field on the web search `search` action is marked [DEPRECATED] and the API no longer returns it, sending only the plural `queries` instead. Typing it as a required `str` causes validation failures when parsing real `web_search_call` payloads. Make it `Optional[str] = None` to match the API. --- src/openai/types/responses/response_function_web_search.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openai/types/responses/response_function_web_search.py b/src/openai/types/responses/response_function_web_search.py index de6001e146..2ea436c70b 100644 --- a/src/openai/types/responses/response_function_web_search.py +++ b/src/openai/types/responses/response_function_web_search.py @@ -29,7 +29,7 @@ class ActionSearchSource(BaseModel): class ActionSearch(BaseModel): """Action type "search" - Performs a web search query.""" - query: str + query: Optional[str] = None """[DEPRECATED] The search query.""" type: Literal["search"] From 55f15dbcca28727a863258e00548be0a210821d6 Mon Sep 17 00:00:00 2001 From: Brian Strauch Date: Thu, 28 May 2026 11:39:50 -0700 Subject: [PATCH 2/2] fix(types): make `query` optional in `ActionSearch` params Mirror the response-side change on the input/param TypedDict so web search `search` actions round-trip: the deprecated `query` field is no longer sent by the API, so it should not be `Required` when passing `web_search_call` items back as input. Dropping `Required` (under the existing `total=False`) makes the key omittable. --- .../types/responses/response_function_web_search_param.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openai/types/responses/response_function_web_search_param.py b/src/openai/types/responses/response_function_web_search_param.py index 15e313b0d3..4a9575b26b 100644 --- a/src/openai/types/responses/response_function_web_search_param.py +++ b/src/openai/types/responses/response_function_web_search_param.py @@ -30,7 +30,7 @@ class ActionSearchSource(TypedDict, total=False): class ActionSearch(TypedDict, total=False): """Action type "search" - Performs a web search query.""" - query: Required[str] + query: str """[DEPRECATED] The search query.""" type: Required[Literal["search"]]