-
Notifications
You must be signed in to change notification settings - Fork 68
updates for BB-820: first crack #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
BB-820 Review Python Client + ensure forwards/backwards compatibility
TODO:
BB-924 Types update Python SDK
Add updated types (might be missing last minute updates), fix closing session (call api |
There was a problem hiding this 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
examples/example.py
Outdated
print("Navigation complete with local Playwright.") | ||
|
||
await stagehand.page.navigate("https://www.google.com") | ||
await page.navigate("https://www.google.com") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we wanna use goto
stagehand/client.py
Outdated
# 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 |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self_heal
stagehand/config.py
Outdated
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") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self_heal
stagehand/schemas.py
Outdated
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
camel case
No description provided.