Skip to content

Commit

Permalink
feat(typespec): Add types for remote_browser tools
Browse files Browse the repository at this point in the history
Signed-off-by: Diwank Singh Tomer <[email protected]>
  • Loading branch information
creatorrr committed Oct 30, 2024
1 parent 97deb72 commit 2c0a2f9
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 4 deletions.
153 changes: 151 additions & 2 deletions agents-api/agents_api/autogen/Tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,14 @@ class BaseIntegrationDef(BaseModel):
populate_by_name=True,
)
provider: Literal[
"dummy", "weather", "wikipedia", "spider", "brave", "browserbase", "email"
"dummy",
"weather",
"wikipedia",
"spider",
"brave",
"browserbase",
"email",
"remote_browser",
]
"""
The provider of the integration
Expand Down Expand Up @@ -203,7 +210,14 @@ class BaseIntegrationDefUpdate(BaseModel):
)
provider: (
Literal[
"dummy", "weather", "wikipedia", "spider", "brave", "browserbase", "email"
"dummy",
"weather",
"wikipedia",
"spider",
"brave",
"browserbase",
"email",
"remote_browser",
]
| None
) = None
Expand Down Expand Up @@ -696,6 +710,7 @@ class CreateToolRequest(BaseModel):
| BrowserbaseUpdateSessionIntegrationDef
| BrowserbaseGetSessionLiveUrlsIntegrationDef
| BrowserbaseGetSessionConnectUrlIntegrationDef
| RemoteBrowserIntegrationDef
| None
) = None
"""
Expand Down Expand Up @@ -961,6 +976,7 @@ class PatchToolRequest(BaseModel):
| BrowserbaseUpdateSessionIntegrationDefUpdate
| BrowserbaseGetSessionLiveUrlsIntegrationDefUpdate
| BrowserbaseGetSessionConnectUrlIntegrationDefUpdate
| RemoteBrowserIntegrationDefUpdate
| None
) = None
"""
Expand All @@ -982,6 +998,137 @@ class PatchToolRequest(BaseModel):
bash_20241022: Bash20241022DefUpdate | None = None


class RemoteBrowserArguments(BaseModel):
"""
The arguments for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
action: Literal[
"key",
"type",
"mouse_move",
"left_click",
"left_click_drag",
"right_click",
"middle_click",
"double_click",
"screenshot",
"cursor_position",
"navigate",
"refresh",
"wait_for_load",
]
"""
The action to perform
"""
text: str | None = None
"""
The text
"""
coordinate: list | None = None
"""
The coordinate to move the mouse to
"""


class RemoteBrowserArgumentsUpdate(BaseModel):
"""
The arguments for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
action: (
Literal[
"key",
"type",
"mouse_move",
"left_click",
"left_click_drag",
"right_click",
"middle_click",
"double_click",
"screenshot",
"cursor_position",
"navigate",
"refresh",
"wait_for_load",
]
| None
) = None
"""
The action to perform
"""
text: str | None = None
"""
The text
"""
coordinate: list | None = None
"""
The coordinate to move the mouse to
"""


class RemoteBrowserIntegrationDef(BaseIntegrationDef):
"""
The integration definition for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
provider: Literal["remote_browser"] = "remote_browser"
setup: RemoteBrowserSetup
method: Literal["perform_action"] = "perform_action"
arguments: RemoteBrowserArguments


class RemoteBrowserIntegrationDefUpdate(BaseIntegrationDefUpdate):
"""
The integration definition for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
provider: Literal["remote_browser"] = "remote_browser"
setup: RemoteBrowserSetupUpdate | None = None
method: Literal["perform_action"] = "perform_action"
arguments: RemoteBrowserArgumentsUpdate | None = None


class RemoteBrowserSetup(BaseModel):
"""
The setup parameters for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
connect_url: AnyUrl
"""
The connection URL for the remote browser
"""


class RemoteBrowserSetupUpdate(BaseModel):
"""
The setup parameters for the remote browser
"""

model_config = ConfigDict(
populate_by_name=True,
)
connect_url: AnyUrl | None = None
"""
The connection URL for the remote browser
"""


class SpiderFetchArguments(BaseModel):
"""
Arguments for Spider integration
Expand Down Expand Up @@ -1240,6 +1387,7 @@ class Tool(BaseModel):
| BrowserbaseUpdateSessionIntegrationDef
| BrowserbaseGetSessionLiveUrlsIntegrationDef
| BrowserbaseGetSessionConnectUrlIntegrationDef
| RemoteBrowserIntegrationDef
| None
) = None
"""
Expand Down Expand Up @@ -1316,6 +1464,7 @@ class UpdateToolRequest(BaseModel):
| BrowserbaseUpdateSessionIntegrationDef
| BrowserbaseGetSessionLiveUrlsIntegrationDef
| BrowserbaseGetSessionConnectUrlIntegrationDef
| RemoteBrowserIntegrationDef
| None
) = None
"""
Expand Down
Loading

0 comments on commit 2c0a2f9

Please sign in to comment.