Skip to content

Conversation

miguelg719
Copy link
Collaborator

No description provided.

Copy link

linear bot commented Feb 26, 2025

BB-820 Review Python Client + ensure forwards/backwards compatibility

TODO:

  • Update types to support latest versions
  • Act->observe->act pipeline (will be supported by Sameel's PR)
    • observe->act
  • StagehandContext
  • Test client side lock
  • Update examples
  • Update readme

BB-924 Types update Python SDK

Add updated types (might be missing last minute updates), fix closing session (call api /end) and update examples / overload of methods + new functionality updates

@miguelg719 miguelg719 marked this pull request as draft February 26, 2025 22:14
Copy link
Contributor

@kamath kamath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mainly just removing print statements and enforcing snake_case over camelCase

print("Navigation complete with local Playwright.")

await stagehand.page.navigate("https://www.google.com")
await page.navigate("https://www.google.com")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we wanna use goto

Comment on lines 219 to 232
# if self._playwright_page:
# self._log("Closing the Playwright page...", level=1)
# await self._playwright_page.close()
# self._playwright_page = None

if self._context:
self._log("Closing the context...", level=1)
await self._context.close()
self._context = None
# if self._context:
# self._log("Closing the context...", level=1)
# await self._context.close()
# self._context = None

if self._browser:
self._log("Closing the browser...", level=1)
await self._browser.close()
self._browser = None
# if self._browser:
# self._log("Closing the browser...", level=1)
# await self._browser.close()
# self._browser = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete comment

except json.JSONDecodeError:
self._log(f"Could not parse line as JSON: {line}", level=2)
continue
try:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up where unnecessary, avoid print statements and use logger instead

browserbase_session_id (Optional[str]): Session ID for resuming Browserbase sessions.
model_name (Optional[str]): Name of the model to use.
model_client_options (Optional[Dict[str, Any]]): Configuration options for the model client.
selfHeal (Optional[bool]): Enable self-healing functionality.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self_heal

model_name: Optional[str] = Field(None, alias="modelName", description="Name of the model to use")
model_client_options: Optional[Dict[str, Any]] = Field(default_factory=dict, alias="modelClientOptions", description="Options for the model client")
model_name: Optional[str] = Field(AvailableModel.GPT_4O, alias="modelName", description="Name of the model to use")
selfHeal: Optional[bool] = Field(True, description="Enable self-healing functionality")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self_heal

action: str = Field(..., description="The action command to be executed by the AI.")
useVision: Optional[Union[bool, str]] = None
variables: Optional[Dict[str, str]] = None
modelName: Optional[AvailableModel] = None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

camel case

@miguelg719 miguelg719 marked this pull request as ready for review February 27, 2025 01:27
@miguelg719 miguelg719 merged commit c60cd13 into main Feb 27, 2025
@filip-michalsky filip-michalsky deleted the miguel/bb-924-types-update-python-sdk branch March 11, 2025 01:46
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.

2 participants