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

`find_in_page` type missing

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

Output items like

{
  "id": "ws_redacted",
  "type": "web_search_call",
  "status": "completed",
  "action": {
    "type": "find_in_page",
    "pattern": "USD",
    "url": "https://www.example.com"
  }
}

were rejected due to not present in

https://github.com/openai/openai-python/blob/847ff0b83841d9262ba0d9c4fdf46f0478004ad0/src/openai/types/responses/response_function_web_search.py#L50

To Reproduce

from openai.types.responses.response_function_web_search import ResponseFunctionWebSearch
obj = ResponseFunctionWebSearch.model_validate({
"id": "ws_redacted",
  "type": "web_search_call",
  "status": "completed",
  "action": {
    "type": "find_in_page",
    "pattern": "USD",
    "url": "https://www.example.com"
  }
})
print(obj)

uv run test_minimal.py Traceback (most recent call last): File "test_minimal.py", line 2, in obj = ResponseFunctionWebSearch.model_validate({ "id": "ws_redacted", ...<6 lines>... } }) File ".venv\Lib\site-packages\pydantic\main.py", line 705, in model_validate return cls.pydantic_validator.validate_python( ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ obj, strict=strict, from_attributes=from_attributes, context=context, by_alias=by_alias, by_name=by_name ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ pydantic_core._pydantic_core.ValidationError: 4 validation errors for ResponseFunctionWebSearch action.ActionSearch.query Field required [type=missing, input_value={'type': 'find_in_page', ...ttps://www.example.com'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.11/v/missing action.ActionSearch.type Input should be 'search' [type=literal_error, input_value='find_in_page', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/literal_error action.ActionOpenPage.type Input should be 'open_page' [type=literal_error, input_value='find_in_page', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/literal_error action.ActionFind.type Input should be 'find' [type=literal_error, input_value='find_in_page', input_type=str] For further information visit https://errors.pydantic.dev/2.11/v/literal_error

Code snippets


OS

Windows

Python version

3.13.5

Library version

1.107.1

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

@RobertCraigie Would love eyes on this!

DouweM avatar Dec 11 '25 15:12 DouweM