Skip to content

Commit cdc5c49

Browse files
committed
fix 1) formatting 2) test for api key
1 parent 76edbd1 commit cdc5c49

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

stagehand/config.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ class StagehandConfig(BaseModel):
7171
alias="domSettleTimeoutMs",
7272
description="Timeout for DOM to settle (in ms)",
7373
)
74-
browserbase_session_create_params: Optional[Union[BrowserbaseSessionCreateParams, dict[str, Any]]] = Field(
74+
browserbase_session_create_params: Optional[
75+
Union[BrowserbaseSessionCreateParams, dict[str, Any]]
76+
] = Field(
7577
None,
7678
alias="browserbaseSessionCreateParams",
7779
description="Browserbase session create params",
@@ -117,16 +119,16 @@ class StagehandConfig(BaseModel):
117119
)
118120

119121
model_config = ConfigDict(populate_by_name=True)
120-
121-
@field_validator('browserbase_session_create_params', mode='before')
122+
123+
@field_validator("browserbase_session_create_params", mode="before")
122124
@classmethod
123125
def validate_browserbase_params(cls, v, info):
124126
"""Validate and convert browserbase session create params."""
125-
if isinstance(v, dict) and 'project_id' not in v:
127+
if isinstance(v, dict) and "project_id" not in v:
126128
values = info.data
127-
project_id = values.get('project_id') or values.get('projectId')
129+
project_id = values.get("project_id") or values.get("projectId")
128130
if project_id:
129-
v = {**v, 'project_id': project_id}
131+
v = {**v, "project_id": project_id}
130132
return v
131133

132134
def with_overrides(self, **overrides) -> "StagehandConfig":

tests/integration/local/test_core_local.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def local_config(self):
2020
self_heal=True,
2121
wait_for_captcha_solves=False,
2222
system_prompt="You are a browser automation assistant for testing purposes.",
23-
model_client_options={"apiKey": os.getenv("MODEL_API_KEY")},
23+
model_client_options={"apiKey": os.getenv("MODEL_API_KEY") or os.getenv("OPENAI_API_KEY")},
2424
use_api=False,
2525
)
2626

0 commit comments

Comments
 (0)