Skip to content

fix(types): make action optional in ResponseFunctionWebSearch#3181

Open
anishesg wants to merge 1 commit intoopenai:mainfrom
proudhare:fix/ph-issue-3179
Open

fix(types): make action optional in ResponseFunctionWebSearch#3181
anishesg wants to merge 1 commit intoopenai:mainfrom
proudhare:fix/ph-issue-3179

Conversation

@anishesg
Copy link
Copy Markdown

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.

The fix is in src/openai/types/responses/response_function_web_search.py: change action: Action to action: Optional[Action] = None. This is backward compatible — callers that only access action when it is non-None continue to work, and callers that previously assumed it was always set will now need to guard with a None check (which the broken behavior already required in practice).

  • I understand that this repository is auto-generated and my pull request may not be merged

Changes being requested

Make ResponseFunctionWebSearch.action optional (Optional[Action] = None) to match actual API responses where the field can be absent on completed web search calls.

Additional context & links

Fixes #3179

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 <ak8686@princeton.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ResponseFunctionWebSearch doesn't match returned payload

1 participant