Skip to content

Commit ab5f3b3

Browse files
authored
fix: add ActionFindInPage and allow null url in ActionOpenPage
Added ActionFindInPage class to handle searching patterns within a page and updated Action type alias to include it.
1 parent 847ff0b commit ab5f3b3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/openai/types/responses/response_function_web_search.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from ..._utils import PropertyInfo
77
from ..._models import BaseModel
88

9-
__all__ = ["ResponseFunctionWebSearch", "Action", "ActionSearch", "ActionSearchSource", "ActionOpenPage", "ActionFind"]
9+
__all__ = ["ResponseFunctionWebSearch", "Action", "ActionSearch", "ActionSearchSource", "ActionOpenPage", "ActionFind", "ActionFindInPage"]
1010

1111

1212
class ActionSearchSource(BaseModel):
@@ -32,7 +32,7 @@ class ActionOpenPage(BaseModel):
3232
type: Literal["open_page"]
3333
"""The action type."""
3434

35-
url: str
35+
url: Optional[str] = None
3636
"""The URL opened by the model."""
3737

3838

@@ -47,7 +47,18 @@ class ActionFind(BaseModel):
4747
"""The URL of the page searched for the pattern."""
4848

4949

50-
Action: TypeAlias = Annotated[Union[ActionSearch, ActionOpenPage, ActionFind], PropertyInfo(discriminator="type")]
50+
class ActionFindInPage(BaseModel):
51+
pattern: str
52+
"""The pattern or text to search for within the page."""
53+
54+
type: Literal["find_in_page"]
55+
"""The action type."""
56+
57+
url: str
58+
"""The URL of the page searched for the pattern."""
59+
60+
61+
Action: TypeAlias = Annotated[Union[ActionSearch, ActionOpenPage, ActionFind, ActionFindInPage], PropertyInfo(discriminator="type")]
5162

5263

5364
class ResponseFunctionWebSearch(BaseModel):

0 commit comments

Comments
 (0)