openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

`ActionOpenPage` mismatched API response

Open salty-flower opened this issue 5 months ago • 1 comments

Confirm this is an issue with the Python library and not an underlying OpenAI API

  • [x] This is an issue with the Python library

Describe the bug

I got a open_page with "url": null when using official API, so I believe the SDK should count for that. Currently, it was required. https://github.com/openai/openai-python/blob/847ff0b83841d9262ba0d9c4fdf46f0478004ad0/src/openai/types/responses/response_function_web_search.py#L35

{
  "id": "ws_68c2a7a61e888197b3e9ef5afd5492360a7d1f9fc76c2c97",
  "type": "web_search_call",
  "status": "completed",
  "action": {
    "type": "open_page",
    "url": null
  }
}

To Reproduce

I was using o4-mini-deep-research from Batch API, with web_search_preview enabled.

Alternatively, for OpenAI folks with permission, maybe you could check ws_68c2a7a61e888197b3e9ef5afd5492360a7d1f9fc76c2c97.

Code snippets


OS

Windows

Python version

3.13.5

Library version

1.107.1

salty-flower avatar Sep 11 '25 11:09 salty-flower

Describe the bug

I confirm this bug is still in latest pydantic definitions. So far I have encountered:

  1. Missing find_in_page action
  2. ActionSearch.query is None
  3. ActionOpenPage.url is None

The generated Pydantic classes should explicitly allow None and support the find_in_page action.

OS Linux

Python version 3.12

pydantic version 2.12.0

openai library version 2.9.0

To reproduce Query OpenAI and include 'web_search_call.action.sources'

Code snippets

prompt = 'Investigate about this complex subject ...'
resp = OpenAI().responses.create(
        model='gpt-5.1'
        reasoning={'effort': 'high'}
        tool_choice='auto',
        tools=[
            {
                'type': 'web_search',
                'search_context_size': 'high',
                'user_location': {'type': 'approximate', 'country': 'ca'},
            }
        ],
        include=['web_search_call.action.sources'],
        input=prompt,
        store=False,
    )

reech-martin avatar Dec 05 '25 10:12 reech-martin