-
Notifications
You must be signed in to change notification settings - Fork 314
/
Copy pathstagehand.config.ts
29 lines (28 loc) · 1.18 KB
/
stagehand.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import type { ConstructorParams, LogLine } from "@/dist";
import dotenv from "dotenv";
import { logLineToString } from "@/lib/utils";
dotenv.config();
const StagehandConfig: ConstructorParams = {
env:
process.env.BROWSERBASE_API_KEY && process.env.BROWSERBASE_PROJECT_ID
? "BROWSERBASE"
: "LOCAL",
apiKey: process.env.BROWSERBASE_API_KEY /* API key for authentication */,
projectId: process.env.BROWSERBASE_PROJECT_ID /* Project identifier */,
debugDom: true /* Enable DOM debugging features */,
headless: false /* Run browser in headless mode */,
logger: (message: LogLine) =>
console.log(logLineToString(message)) /* Custom logging function */,
domSettleTimeoutMs: 30_000 /* Timeout for DOM to settle in milliseconds */,
browserbaseSessionCreateParams: {
projectId: process.env.BROWSERBASE_PROJECT_ID!,
},
enableCaching: true /* Enable caching functionality */,
browserbaseSessionID:
undefined /* Session ID for resuming Browserbase sessions */,
modelName: "gpt-4o" /* Name of the model to use */,
modelClientOptions: {
apiKey: process.env.OPENAI_API_KEY,
} /* Configuration options for the model client */,
};
export default StagehandConfig;