refactor(evals): extract EvalRunner interface (Braintrust Eval() default; no behavior change)#2354
Open
miguelg719 wants to merge 1 commit into
Conversation
|
Contributor
There was a problem hiding this comment.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Architecture diagram
sequenceDiagram
participant Runner as runEvals()
participant EvalRunner as EvalRunner Interface
participant Braintrust as BraintrustEvalRunner
participant BraintrustLib as @braintrust/core (Eval/flush)
participant Task as task callback
participant Progress as onProgress callback
Note over Runner,Progress: Eval execution flow (no behavior change)
Runner->>EvalRunner: run(config)
activate EvalRunner
EvalRunner->>Braintrust: Eval(projectName, {experimentName, metadata, data, task, scores, maxConcurrency, trialCount}, {noSendLogs})
Braintrust->>Task: invoke for each testcase
activate Task
alt cooperative abort active
Task->>Progress: {type: "failed", error: "aborted"}
Task-->>Braintrust: {_success: false, error: "aborted by user"}
else normal execution
Task->>Progress: {type: "started"}
Task->>Task: executeTask(input, resolvedTask, options)
alt success
Task->>Progress: {type: "passed"}
else failure
Task->>Progress: {type: "failed", error}
end
Task-->>Braintrust: TaskResult
end
deactivate Task
Braintrust-->>EvalRunner: evalResult
alt sendLogs == true
EvalRunner->>Braintrust: flush()
Braintrust-->>EvalRunner: done
end
EvalRunner-->>Runner: EvalRunnerResult
deactivate EvalRunner
Note over Runner,Progress: Post-eval (unchanged)
Runner->>Runner: shutdownTracing() if otel
c9a9f41 to
7e05a8a
Compare
…l; no behavior change) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ceaf31f to
24f88b9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
why
Isolates the Braintrust
Eval()coupling behind a thin seam so a future backend swap is mechanical instead of a rewrite. Pure structural refactor.what changed
framework/evalRunner.ts(new):EvalRunnerinterface +BraintrustEvalRunnerwrapping the existingEval()call verbatim (same progress/reporter/noSendLogs/flushsemantics)framework/runner.ts:runEvalsbuilds a config and delegates; everything else (trajectories, summary mapping, otel init/shutdown, offline mode, abort handling) unchangedtest plan
noSendLogs) behavior identicalStack 4/5 · base: #2353
🤖 Generated with Claude Code
Summary by cubic
Extracted an
EvalRunnerinterface and a defaultBraintrustEvalRunnerto decouple eval execution from Braintrust. No behavior change;runEvalsnow builds a config and delegates via the interface.framework/evalRunner.tswithEvalRunner,EvalRunnerConfig,EvalRunnerResult, andBraintrustEvalRunnerthat wrap BraintrustEval()/flush, use internal silent progress/reporter, and respectnoSendLogs.framework/runner.tsto build the runner config, passsendLogsviahasBraintrustApiKey(), and delegate execution; abort logic, offline mode, concurrency/trials, and summary mapping are unchanged.Written for commit 24f88b9. Summary will update on new commits.