Contributed by Ankur Goyal on 2023-10-29
This tutorial will teach you how to use Braintrust to generate better titles for Github issues, based on their
content. This is a great way to learn how to work with text and evaluate subjective criteria, like summarization quality.
We’ll use a technique called model graded evaluation to automatically evaluate the newly generated titles
against the original titles, and improve our prompt based on what we find.
Before starting, please make sure that you have a Braintrust account. If you do not, please sign up. After this tutorial, feel free to dig deeper by visiting the docs.
Installing dependencies
To see a list of dependencies, you can view the accompanying package.json file. Feel free to copy/paste snippets of this code to run in your environment, or use tslab to run the tutorial in a Jupyter notebook.Downloading the data
We’ll start by downloading some issues from Github using theoctokit SDK. We’ll use the popular open source project next.js.
Generating better titles
Let’s try to generate better titles using a simple prompt. We’ll use OpenAI, although you could try this out with any model that supports text generation. We’ll start by initializing an OpenAI client and wrapping it with some Braintrust instrumentation.wrapOpenAI
is initially a no-op, but later on when we use Braintrust, it will help us capture helpful debugging information about the model’s performance.