wrap braintrust to get llm usage data - #637
Conversation
🦋 Changeset detectedLatest commit: 142a8af The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
helps us see the stacktrace when StagehandDefaultError is thrown
There was a problem hiding this comment.
can change back but nice to have
cd6e068 to
3bc4a7c
Compare
| "@browserbasehq/stagehand": patch | ||
| --- | ||
|
|
||
| Fix: forward along the stack trace in StagehandDefaultError |
There was a problem hiding this comment.
now it's throwing the error multiple times, need a fast follow PR to only throw StagehandDefaultError once
| @@ -1,19 +1,22 @@ | |||
| import { Stagehand } from "@/dist"; | |||
There was a problem hiding this comment.
Currently not running these in CI. Will add in a fast-follow PR
There was a problem hiding this comment.
what is the run command for these? what is the benefit in taking them out of the tasks directory? Also make sure you remove the step from CI, otherwise it will keep failing
| "regression_text_extract", | ||
| "regression_dom_extract", | ||
| "llm_clients", | ||
| "unit", |
There was a problem hiding this comment.
currently running neither in CI, will add in a fast-follow PR
There was a problem hiding this comment.
PR Summary
This PR centralizes Stagehand initialization to support Braintrust LLM metrics and standardizes error logging across evaluations.
- /evals/evals.config.json: Reassigned evaluation categories and removed obsolete tasks.
- /evals/initStagehand.ts: Removed modelName support; now requires a pre-initialized llmClient.
- /evals/index.eval.ts: Wrapped LLM client initialization with Braintrust proxy and unified error forwarding.
- /evals/tasks/*: All tasks now accept an externally provided stagehand instance (plus debugUrl/sessionUrl), eliminating internal initStagehand calls.
- /evals/logger.ts & /lib/StagehandPage.ts: Improved error logging with full stack trace and message forwarding.
88 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile
| constructor(error?: unknown) { | ||
| if (error instanceof Error || error instanceof StagehandError) { | ||
| super( | ||
| `\nHey! We're sorry you ran into an error. \nIf you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack\n\nFull error:\n${error.message}`, | ||
| ); | ||
| } | ||
| } |
There was a problem hiding this comment.
logic: Ensure the constructor always calls super, even when error is undefined or not an instance of Error.
| constructor(error?: unknown) { | |
| if (error instanceof Error || error instanceof StagehandError) { | |
| super( | |
| `\nHey! We're sorry you ran into an error. \nIf you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack\n\nFull error:\n${error.message}`, | |
| ); | |
| } | |
| } | |
| constructor(error?: unknown) { | |
| if (error instanceof Error || error instanceof StagehandError) { | |
| super( | |
| `\nHey! We're sorry you ran into an error. \nIf you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack\n\nFull error:\n${error.message}`, | |
| ); | |
| } else { | |
| super('An unknown error occurred. If you need help, please open a Github issue or reach out to us on Slack: https://stagehand.dev/slack'); | |
| } | |
| } |
| sessionUrl: string; | ||
| useTextExtract: boolean; | ||
| stagehandConfig: ConstructorParams; | ||
| }; |
There was a problem hiding this comment.
MoveStagehandInitResult to types/evals.ts
Co-authored-by: Sean McGuire <75873287+seanmcguire12@users.noreply.github.com>
2801646 to
78a21b1
Compare
* temp * temp * custom openai * unit and evals * changeset * fix evals config * fix evals config * Update evals/taskConfig.ts * rebase * temp * all eval tasks * address comments and remove hn from ci * press enter * dont use braintrust ai proxy * fix amazon eval * remove WRITE_FILE check * revert amazon to act category * unify regression evals * update CI * fix job naming * wrap in try catch * fix yml * update other amazon eval * vanta_h experimental * add text_extract eval category to CI ---------
why
what changed
unitCI test for testing core features inactinitStagehandin each evaltest plan
this is it