Skip to content

Instantly share code, notes, and snippets.

@clutchski
Last active October 10, 2025 20:18
Show Gist options
  • Select an option

  • Save clutchski/209af31eb8899334e09b9738204e9f9d to your computer and use it in GitHub Desktop.

Select an option

Save clutchski/209af31eb8899334e09b9738204e9f9d to your computer and use it in GitHub Desktop.
braintrust-go-sdk-v0.0.11-v0.0.12-migration-guide

Braintrust-x-Go Migration Guide: v0.0.11 to v0.0.12

There are a few backwards incompatible changes in v0.0.12. Here's a guide to quickly resolving the issues.

TL;DR: Use eval.Run()

The simplest migration is to use eval.Run() instead of eval.New(). eval.Run() exists in both v0.0.11 and v0.0.12 and is unaffected by the changes.

func main() {
    teardown, _ := trace.Quickstart()
    defer teardown()

    result, err := eval.Run(context.Background(), eval.Opts[int, int]{
        Project:    "my-project",
        Experiment: "my-experiment",
        Cases:      cases,
        Task:       task,
        Scorers:    scorers,
    })
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(result.String()) // Prints results with permalink
}

Benefits:

  • Automatic project/experiment resolution
  • Console reports
  • Less boilerplate

Breaking Changes

If you want to keep using eval.New, here's a more detailed look at the changes.

1. Eval.Run() now returns Result

Before:

myEval := eval.New(..)
err := myEval.Run(ctx)

After:

myEval := eval.New(..)
_, err := myEval.Run(ctx)
fmt.Println(_.String()) // Includes permalink to UI

2. eval.New() takes a Key object

If you want to keep using eval.New, you'll need to slightly change how you resolve the experiment before running it.

Before:

myEval := eval.New(experimentID, cases, task, scorers)

After:

key := eval.ResolveKey("my-project-name", "my-experiment") 
myEval := eval.New(key, cases, task, scorers)

3. ResolveExperimentID() returns name too

Before:

experimentID, err := eval.ResolveExperimentID("my-experiment", projectID)

After:

experimentID, experimentName, err := eval.ResolveExperimentID("my-experiment", projectID)

4. DatasetInfo is removed

This didn't have much use for tracing and evals so it is now private.

Quick Migration Checklist

  • ✅ Use eval.Run() instead of manually creating evals
  • ✅ Update Eval.Run() calls to handle Result return value
  • ✅ If using eval.New(), update to use eval.Key

For questions: https://github.com/braintrustdata/braintrust-x-go/issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment