From 14a7ce47969eef5d466c4c721d6d12f40a0d689b Mon Sep 17 00:00:00 2001 From: anish k Date: Thu, 30 Apr 2026 02:38:05 +0000 Subject: [PATCH] fix(types): make `action` optional in `ResponseFunctionWebSearch` The `action` field in `ResponseFunctionWebSearch` was typed as a required non-optional `Action`, but the API can return `action=None` for `web_search_call` items (for example, when a search has already completed). This mismatch caused `AttributeError` at runtime when code relied on the type annotation to assume `action` was always present. Signed-off-by: anish k --- 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..0a333f5d60 100644 --- a/src/openai/types/responses/response_function_web_search.py +++ b/src/openai/types/responses/response_function_web_search.py @@ -78,7 +78,7 @@ class ResponseFunctionWebSearch(BaseModel): id: str """The unique ID of the web search tool call.""" - action: Action + action: Optional[Action] = None """ An object describing the specific action taken in this web search call. Includes details on how the model used the web (search, open_page, find_in_page).