← All AI Engineer talks

AI Engineer World's Fair 2025

[Evals Workshop] Mastering AI Evaluation: From Playground to Production

Read the talk

Building an evaluation loop from playground to production

A changelog generator provides a practical path through prompt comparisons, code-defined evals, production tracing, and human feedback that improves both the application and its judges.

From a talk by Carlos Esteban and Doug

Before you start: Basic familiarity with LLM prompts, TypeScript, and a Node-based development workflow will help you follow the exercises.

How do you know a change makes an AI application better?

How do you move from trying a prompt to knowing whether an AI feature works well enough for users? Carlos Esteban and Doug, introducing themselves as Braintrust solutions engineers, structure this workshop around that progression: evaluation fundamentals, hands-on work in the UI, the SDK, production logging, and human review. Doug brings a background in data and finance; Carlos previously worked with Terraform and Vault at HashiCorp. The workshop guide, distributed through Slack and a QR code, accompanies the exercises.

The practical questions are specific: Which model should you use? What does acceptable quality cost? Does the application handle edge cases, maintain the right brand voice, and improve as you change it? A prompt edit can look better on the example in front of you while causing regressions elsewhere. Evals turn those development decisions into questions you can test across examples.

Carlos connects that testing discipline to faster releases, less manual review, better model economics, and participation from both technical and nontechnical colleagues. He mentions customer improvements in productivity and product quality without supplying numerical results. The working loop has three connected concerns: prompt engineering changes the behavior, evaluation measures the change, and observability reveals what happens when users encounter it.

0:481:01
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

0:48 · section reference included

Task, dataset, scorer

An eval is a structured test of quality, reliability, and correctness across user scenarios. Its basic contract has three parts:

IngredientWhat it supplies
TaskThe prompt or application code being tested
DatasetInputs representing examples and test cases
ScorerLogic that grades each resulting output

A task can be one model call or an entire agent workflow. The essential boundary is an input and an output. Scoring can use an LLM judge or a code function; the numeric scores discussed here fall between 0 and 1 and are displayed as percentages.

Slide with three columns defining the task, real-world test cases in a dataset, and scoring logic.
The three ingredients of an eval: task, dataset and scorer.

You do not need a mature production dataset to begin. Synthetic examples can establish the first test cases. As the application develops, bring real interactions into the dataset so its coverage increasingly reflects what users actually do.

Offline evals exercise proposed behavior during development, through the playground or SDK. Online evals grade captured live traffic. The latter reveal problems that the development dataset may never have represented: an unfamiliar request, a missing edge case, or a weak area of the product. Those discoveries become candidates for the next offline test set.

A score is useful only if it tracks the quality you care about. Compare your assessment of an output with its automated score before deciding what to fix.

Human assessmentAutomated scoreNext action
Good outputHighAgreement; retain the example
Good outputLowImprove the evaluator
Bad outputHighImprove the evaluator
Bad outputLowImprove the application

The two disagreement cases are especially valuable. They identify a measurement problem before a team spends time optimizing the application toward the wrong target.

7:207:30
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

7:20 · section reference included

Expand the task without losing the test boundary

For a single prompt, Mustache templating inserts dataset values into the message. More complex tasks keep the same input/output boundary while expanding what happens inside it:

  • Conversation history: Extra messages supply the exchanges between user and assistant, including simulated tool calls, so the evaluation can consider the conversation as a whole.
  • Tools and retrieval: A prompt can use tools to obtain information or contact external services, including retrieval-augmented generation workflows.
  • Prompt chains: One prompt's output becomes the next prompt's input. Carlos uses a three-prompt chain to illustrate evaluating the full sequence end to end.

The dataset separates the request from its reference answer and supporting information.

FieldRequired?Purpose
inputYesThe case passed into the task
expectedNoAn ideal or anticipated output
metadataNoAdditional information associated with the row

Start with a small set and expand it deliberately. Internal and staging interactions can supply realistic cases before substantial production traffic exists. Human review then improves the reference answers, especially the expected field, rather than treating the initial synthetic set as permanent ground truth.

Choose each scorer according to the question it must answer. An LLM judge suits contextual criteria that require interpretation; code suits exact conditions, required structure, and binary checks. Using both gives you different ways to inspect quality. For an LLM judge, Carlos recommends a stronger model than the cheaper model being evaluated, a single focused criterion, explicit evaluation steps, and only the relevant input/output context. The judge itself should be tested against human assessments.

The UI provides two places to work with these ingredients. Playgrounds support rapid changes and side-by-side prompt or model comparisons. Experiments retain results for comparison over time, including work originating in either the UI or SDK. Saving a playground run as an experiment gives the team a historical reference for its next change.

The first audience question exposes a boundary in the workshop's UI: its described conversation roles are assistant, user, and tool call. Representing additional user roles or branching interactions requires the SDK's flexibility. The general task contract still holds; the workflow does not have to fit a fixed number of turns or a simple prompt editor.

11:3411:43
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

11:34 · section reference included

Connect the changelog application

The local exercise requires Node, Git, a Braintrust account and organization, and a project called Unreleased AI. The demonstration uses OpenAI credentials, although Doug also describes other providers, including Bedrock and custom providers. Asked about local models, he points to the remote-evals bonus activity; the session does not demonstrate that configuration or an entirely local Braintrust installation.

Unreleased AI takes a GitHub repository URL, retrieves commits since the latest release, and summarizes them into a changelog for developers. In the workshop checkout, .env.local holds the Braintrust and OpenAI API keys, with an optional GitHub credential to reduce rate-limit problems. Running pnpm install installs dependencies and publishes workshop resources, including two changelog prompts and a dataset. The public repository has since differed in project naming and prompt count, so the two-prompt setup here follows the recording.

The connection between local files and UI objects is a publishing step. The install script invokes braintrust push, which publishes the SDK-defined resources into the Braintrust organization. This lets prompts and other assets live in version control alongside application code. Once published, the two prompt variants appear in the UI, where their Mustache variables map to values from dataset rows.

21:0821:18
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

21:08 · section reference included

Evaluate accuracy, completeness, and formatting separately

Each changelog case supplies a series of commits, the repository URL, and a since field identifying the last release. That input establishes what the model has to summarize. The workshop's resources.ts defines three checks: accuracy, completeness, and formatting. Accuracy and completeness use separate LLM judges; combining them into one instruction would make it harder to tell which quality changed. The accuracy editor shows GPT-4.1, commit and output placeholders, and criteria focused on factual correctness.

Braintrust accuracy scorer editor showing a GPT-4.1 prompt, commit and output placeholders, and factual-correctness criteria.
The changelog accuracy scorer isolates factual accuracy as its evaluation focus.

Formatting uses code because it asks whether the output matches an expected structure. For example, a changelog contract that requires three named sections can be checked directly in TypeScript:

typescript

const requiredHeadings = [
  "## Features",
  "## Fixes",
  "## Other changes",
] as const;

export function formattingScore(output: string): number {
  const lines = new Set(output.split(/\r?\n/).map(line => line.trim()));
  return requiredHeadings.every(heading => lines.has(heading)) ? 1 : 0;
}

This checks the chosen heading contract. Whether a listed feature is supported by the commits, or whether an important fix was omitted, remains a separate question for the accuracy and completeness scorers.

To compare the prompts in the playground:

  1. Configure the provider key in the Braintrust account so the selected OpenAI models can run.
  2. Load both prompt variants as tasks.
  3. Select the changelog dataset.
  4. Attach accuracy, formatting, and completeness scorers.
  5. Run the comparison. The playground processes the examples and scoring in parallel.
  6. Open the summary layout to compare the baseline task with the comparison task.

Doug also permits npm for setup, although he uses pnpm throughout the demonstration. The comparison now covers the selected dataset rather than a single hand-picked output.

The Experiments button opens a creation dialog already populated from the playground. Saving it preserves the comparison for later changes and CI workflows. When an attendee asks what completeness actually measures, Doug opens the judge: it applies the instructions in its prompt to the supplied data and generated output. That definition needs evaluation too. Changing the task model and rerunning the same cases gives evidence about the effect of the model change under those particular scoring criteria.

27:1527:25
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

27:15 · section reference included

Publish resources, then run evaluations

A setup failure in the room makes the authentication path concrete. Cloning the repository does not connect it to Braintrust. Copy .env.local.example to .env.local, create an API key in the Braintrust organization settings, and put it in that file at the cloned repository's root. After the credentials are populated, the workshop's install hook can authenticate and publish the configured resources. The file does not belong in an assumed home directory, and the key is not created in project settings.

Activity guide showing repository cloning, a Create a Braintrust API Key section with an empty placeholder, and an OpenAI API key setup heading.
Workshop setup instructions for creating a Braintrust API key and configuring local environment files.

The SDK moves the same work into a version-controlled workflow; Python is available as well as the TypeScript used here. Prompts, scores, and datasets can be defined with the application, while evaluation definitions specify the task, data, and at least one scorer. Publishing assets and running tests are separate operations:

Command in the workshop workflowPurpose
braintrust pushPublish configured resources
braintrust evalExecute evaluations and retain experiment results

The distinction is also visible in the repository's package scripts. Evaluation files use .eval.ts, allowing a directory of evaluations to be discovered without listing every file. Current documentation uses bt eval; the command names above preserve the workshop's CLI workflow. Source control supports consistent assets across environments, while published scorers can also support online scoring.

35:0835:17
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

35:08 · section reference included

Treat the judge as something to evaluate

The SDK discussion returns to a common starting barrier: waiting for a golden dataset. Doug recommends beginning with synthetic examples or logs from a newly released feature, then using the results to decide whether to improve the application or the scorer. A small set provides a place to start that investigation; waiting for a large curated collection postpones the feedback.

An attendee identifies GPT-4.1 as the completeness judge and asks whether consecutive runs can receive different scores. Carlos confirms that they can. A stronger judge does not eliminate nondeterminism. He describes a customer practice of running five trials and averaging the scores; that is an example of repeated evaluation, not a guarantee that five runs resolve every source of variation.

The percentage also needs interpretation. The judge selects a rubric category, and the configured mapping turns it into a number: Doug confirms that excellent maps to 1. A displayed percentage is a scorer value under a rubric, not automatically an empirical accuracy rate. Inspect the logged rationale to understand why an output received its score. Carlos recommends investigating a judge that gives every output full marks, and comparing changes against a baseline on the same dataset and criteria instead of demanding an arbitrary percentage. Drill into the task's calls, tool invocations, and scorer results together when the outcome looks wrong.

Asked whether that iteration could be automated, Carlos previews Loop, forecasting its first release within one or two weeks of the workshop. The proposed assistant would help improve prompts, datasets, and scorers. Doug describes a tool-using workflow that consults earlier experiments, changes prompts, and runs new comparisons under user direction. Carlos says Braintrust evaluates its own AI feature with its logs and scores, and that CEO Ankur periodically benchmarked the use case until a model met the team's expectations. He does not identify the model or provide the benchmark results.

40:4640:54
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

40:46 · section reference included

Inspect rationales and investigate disagreement

Judge rationales are accessible through the API, Doug explains, so a team can build another evaluation layer around the explanations. An attendee proposes using this to detect weaknesses in a strict, workflow-specific evaluation process. The trace view makes the immediate inspection possible: open the scorer result, read its rationale, and decide whether the explanation supports the assigned score.

Braintrust experiment detail showing a trace tree, an output score of 0.75, and rationale text in metadata; a browser sidebar overlaps the left edge.
An experiment trace exposes a judge’s score and rationale.

To build confidence, Carlos recommends human review of both the score and its appropriateness. A code scorer can provide another check on a similar criterion using regular expressions or other logic. If the judge gives a low score while the code check gives a much higher one, that disagreement identifies a case needing attention. It does not establish which evaluator is correct; the output-versus-score matrix still determines the investigation.

Another attendee asks about traditional machine learning between rule-based checks and LLM judges: intent classification, entity recognition, sentiment classification, and clustering. The exchange leaves that choice open. Carlos reports customers taking both code-focused and LLM-focused approaches, depending on their use case. The attendee also distinguishes probabilistic classifiers from deterministic code. Neither instructor offers a definitive recipe for that middle ground; their practical recommendation is to compare candidate scorers and use human judgments to determine which ones reflect the desired quality.

47:3247:43
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

47:32 · section reference included

Keep experiments as the historical record

Doug then runs the code-defined evaluation and shows it executing. Its ingredients are unchanged: task, scores, and dataset. An audience question prompts a sharper distinction between the two interfaces: the playground is the place for quick, comparatively ephemeral iteration; an experiment is the retained record for historical analysis. Their UI capabilities have converged, Carlos says, but saving an experiment preserves the work for future comparisons.

Two-column slide comparing Playgrounds and Experiments, with interface screenshots and bullets about iteration, saved work and historical analysis.
Playgrounds support quick iteration; experiments preserve runs for comparison over time.

SDK evaluations produce experiments. To retain code-defined behavior while iterating interactively in the playground, Carlos points to remote evals. The useful boundary is that application evaluation code can execute on your infrastructure while Braintrust triggers it and displays the results. The workshop refers participants to the bonus activity rather than demonstrating that setup.

53:0053:07
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

53:00 · section reference included

Trace the application and score live traffic

After deployment, the question changes from how the application performs on selected cases to how people actually use it. Logging reveals missing scenarios and makes production traces available as future dataset rows. It also gives product managers and subject-matter experts a way to inspect requests and feedback alongside developers.

Instrumentation begins with an authenticated logger bound to a Braintrust project. Wrapping an LLM client captures its prompts, responses, token counts, latency, and errors. Carlos names wrap_openai and also describes Vercel AI SDK wrapping and OpenTelemetry integration. For behavior outside the model call, trace arbitrary functions and use span.log to attach additional information such as metadata. The wrapper provides the initial visibility; explicit spans describe the application around it.

Online scoring measures selected live logs. Sampling controls how much traffic receives scores, while regression alerts should reflect the scorer's meaning and the established baseline. Tagging traces with prompt variants allows production comparisons between prompt A and prompt B. To configure the workshop's rule:

  1. Open the project's Online Scoring configuration.
  2. Add a rule and select the scorers.
  3. Set the sampling rate, starting lower if appropriate while you establish confidence in the measurements.
  4. Select the span to score: the root span by default, or a particular nested child span.

Saved views then preserve filters, sorting, and selected columns so colleagues can repeatedly inspect the same subset of logs.

For the live exercise, pnpm dev starts the application on localhost:3000. A repository selection triggers commit retrieval, changelog summarization, and categorization. In Braintrust, Doug opens the top-level generate-changelog request and follows its child operations: obtaining release information, fetching commits, and loading the prompt from Braintrust. The model span exposes prompt tokens and estimated cost; the small demonstration does not yet provide a meaningful historical trend.

The application's generate route.ts connects those traces to the code. It wraps the AI SDK model for model-call logging, then adds explicit inputs, outputs, and metadata where the application needs more detail. Metadata becomes especially useful when filtering logs into views: it preserves the context needed to distinguish otherwise similar requests.

55:1955:34
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

55:19 · section reference included

Turn scored logs into regression cases

A saved view can direct reviewers toward requests with low completeness. From a selected trace, the UI can add a span to a dataset as a new row. This closes the development loop: evaluate offline, deploy, observe a real interaction, review it, and bring that case back into offline testing.

An attendee asks whether only good responses belong in the dataset. Doug explains that both successful and unsuccessful interactions can be useful: good responses provide examples of desired behavior; failures expose cases the application needs to handle better. Once an online scoring rule exists, it supplies scores for matching logs without someone manually launching an evaluation for each interaction.

Doug configures the demonstration rule to sample all logs, explicitly distinguishing that choice from a likely normal operating rate, and generates another changelog. Doug reports an accuracy score of 25% and a completeness score of 100% for the demonstrated online changelog output. These are the rubric-derived values for that output. He then saves a view selecting accuracy scores below 50%, giving human reviewers a concrete queue to investigate.

Existing applications do not need to move all their prompts into Braintrust-managed resources to obtain tracing. In response to a comparison with LangSmith, Doug points to client wrappers and function decorators as the integration mechanism. Turning a logged span into a dataset row does have a structural requirement: the logged data must map to the dataset's schema.

For event-conditioned scoring, Carlos suggests creating a span only when the relevant condition occurs and targeting the scoring rule at that span. Sampling then applies to occurrences of the conditional span rather than the whole stream of root traces. Selecting every occurrence of that span can ensure the event receives evaluation without scoring every unrelated request.

1:04:291:04:37
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

1:04:29 · section reference included

Use human feedback to improve the application and the judge

Human review supplies domain knowledge that automation can miss. Doug describes product managers, subject-matter experts, and doctors reviewing outputs, identifying hallucinations, and establishing reference judgments. Their assessments help determine whether the product meets real expectations, including nuances that an automated grader may overlook.

There are two distinct sources of human input:

  • Reviewer annotations: People enter the platform to label, score, and audit interactions.
  • End-user feedback: People using the application submit a thumbs-up, thumbs-down, or comment about a particular result.

Use them together by filtering for negative user feedback, asking reviewers to inspect those interactions, and adding useful failure cases to the dataset. A dissatisfied user identifies a case worth reviewing; the reviewer determines what actually went wrong.

Doug submits a thumbs-up with the comment “Really good” in the changelog application. Doug shows the submitted thumbs-up as a user-feedback score of 100%, alongside the comment “Really good.” The logFeedback function associates that feedback with an already-created span, allowing saved views to select feedback values of 1 or 0. The score here encodes the submitted feedback; it is separate from the automated accuracy and completeness scores.

Human review mode hides fields that are irrelevant to reviewers. Before it is useful, configure the review fields: options, free-form input, or sliders, with binary judgments or richer categories as needed. Reviewers then assess the logged input and output through those fields. Carlos describes using a team's annotations across several criteria to evaluate an LLM judge: make the judge prompt the task in a playground, supply the reviewed cases, and compare its judgments with the human labels. The evaluator becomes the system under test.

1:10:141:10:23
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

1:10:14 · section reference included

Keep the evaluation connected to the changing application

How much preparation is enough before this loop becomes useful? Carlos recommends starting with one or two scores and ten dataset rows, then adding cases and refining criteria as evidence accumulates. The goal is to begin learning, rather than wait for a golden dataset or an extensive collection of scorers.

The next question identifies a different maintenance problem. An application's workflow can grow from two turns to five across sprints. If the evaluation contains a separate imitation of the old workflow, even an excellent scorer will be grading obsolete behavior. Carlos initially recommends durable quality criteria that survive changes in the task, but the attendee clarifies that the task implementation itself must follow the application. These are separate responsibilities: keeping the tested code current and keeping the definition of quality valid.

The resolution is to have the eval call the application's task directly. A pull request then evaluates the proposed implementation, including its changed number of steps, rather than a separately maintained mimic. The binding can be a thin TypeScript function:

typescript

export function bindEvaluationTask<Input, Output>(
  applicationTask: (input: Input) => Promise<Output>,
): (input: Input) => Promise<Output> {
  return input => applicationTask(input);
}

Pass the current application's exported task to this binding; do not reproduce its conversation or tool sequence inside the evaluation. With that arrangement, an implementation change alone does not require rewriting the .eval.ts file. Changes to the input/output contract or the qualities being measured still require deliberate maintenance.

Staffing human review remains organization-specific. Asked about Braintrust's own specialized reviewers, Carlos says the company is not then using SMEs internally and has only recently added an AI component. He describes customers in domains such as healthcare and legal technology using external annotation services or bringing reviewers into Braintrust with dedicated roles and annotation views. The session does not offer a fixed staffing formula.

The final question asks whether high-scoring examples can improve future prompts without fine-tuning. Carlos explains that dataset-row metadata can hold few-shot examples referenced during evaluations and playground runs. The attendee then distinguishes that from production behavior: can a live request automatically draw good examples from the accumulated dataset? At the time of the recording, Carlos says Braintrust does not natively provide that live-traffic-to-few-shot workflow. It can be built with custom SDK and application logic. Collecting, reviewing, and testing examples creates the material for improvement; deciding how those examples enter a production prompt is another application behavior to implement and evaluate.

1:15:441:15:56
Suggest correction

This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.

1:15:44 · section reference included

Resources

From the talk

Updates since the talk

Read the complete timestamped transcript
  1. 0:00

    [upbeat music] Hey, everyone.

  2. 0:16

    Thanks for joining us for the eval session today. This is the first workshop that we'll be leading. There's another one at 3:30, so you get to be the first people to, to go through it.

  3. 0:27

    Uh, very exciting stuff. If you've gotten a chance to sign up for Braintrust, uh, you know, please do that now. If not, we also have some workshop materials and a Slack channel for you to follow along.

  4. 0:39

    In the Slack channel, we also sent out a poll. If you'd like to respond with a little emoji underneath the message, that'd be great.

  5. 0:48

    Uh, in the Slack channel also, there is the, the workshop guide. So in, in case you're not, uh, able to get the QR code for whatever reason, uh, go into the Slack channel and you, you'll be able to pull up that document.

  6. 1:01

    Before we jump in, obviously maybe just a quick intro of, uh, Carlos and I. My name is Doug. I am a solutions engineer at Braintrust. Um, I have a background in data and finance.

  7. 1:12

    Actually, my, my third week here at Braintrust. Um, but looking forward to kind of leading you all through the platform and giving you a sense for how you can master evals with Braintrust.

  8. 1:22

    Yeah. My name's Carlos Esteban. I'm also a solutions engineer helping out with some of our great customers at Braintrust. I'm a little bit more tenured, been here six weeks, and before I was in the info world working at HashiCorp doing some, uh, stuff with Terraform and Vault.

  9. 1:38

    Uh, but yeah, super exciting to be here today at the AI World Fair. Uh, we have a lot of exciting things to go over with you.

  10. 1:46

    So just to go over the high-level agenda, we're gonna be alternating between lectures with slides and hands-on activities. Uh, so we're gonna start with understanding, you know, why even eval, what is an eval, uh, go over the different ingredients or components, if you will, there.

  11. 2:01

    Uh, then we'll jump into the actual Braintrust UI. You'll go through some activity, uh, tasks there, and then move back into the lecture, talk about the SDK, how you can do the same thing via the SDK.

  12. 2:14

    It can be a bit more powerful in certain situations as well. Uh, then go into, uh, production, like logging, so day two stuff. How are you-- how are you observing your users interacting with your production app or production feature?

  13. 2:27

    And then finally, we're gonna be incorporating some human-in-the-loop, so trying to, uh, establish some ground truth for the ideal responses, improve your datasets, and overall improve the performance of your, of your app.

  14. 2:44

    If you've gotten a chance to check out the poll in the Slack, uh, feel free to submit a response. Uh, really curious to see how everybody is currently evaluating your AI systems.

  15. 2:58

    Just as a, you know, question that I'm out of curiosity, could I ask for a, a show of hands how many people have seen Braintrust before, gone to braintrust.dev and interacted with it?

  16. 3:11

    Cool. That's great. So we have some, some, uh, pupils that have already gone and, and explored a little bit. That's exciting, and a lot of people that are brand new.

  17. 3:23

    So starting off with just an introduction. What are evals? Uh, how do you get started?

  18. 3:30

    First, I wanted to just show off some mentions of evals in the public space. Uh, you may recognize some of these names. They see the importance of evals, which, you know, may or not, uh, point you that, that this is something important that we should be thinking about when pushing changes into production, when we're developing these, these

  19. 3:50

    AI features. So why even do evals? Well, they, they, uh, they help you answer questions. That's ultimately what they're for. You know, uh, what type of model should I use?

  20. 4:04

    What's the best cost for my use case? What's going to perform best in all of the edge cases that my users will be interacting with?

  21. 4:15

    Is it gonna be consistent with my brand? Is it going to, uh, you know, uh, talk to the end cu-customer, to the end user in the same voice that I would want a human?

  22. 4:27

    Am I improving the system over time? Am I able to catch bugs? Am I able to troubleshoot effectively? So all of this can be, can be answered with the help of evals, which is what we'll be discussing today.

  23. 4:44

    The best LLMs, uh, don't always guarantee consistent performance, so this is why you need to have a testing framework in place, right? We have hallucinations, uh, occurring at a pretty high rate.

  24. 4:57

    Performance is also degrading when you make changes. It's difficult to guarantee that the change that you're putting through isn't going to regress the, the application. And, you know, the changing a prompt, even if it may seem like it's improving it, will actually regress it.

  25. 5:15

    So you need to have some, uh, scientific, empirical way of testing these changes and making sure that your AI feature is performing at the level that your users expect.

  26. 5:28

    So how do evals help your business? Well, they cut dev time. You'll be able to push changes into production a lot faster. Uh, evals will live at the center of your development life cycle.

  27. 5:40

    They will reduce costs. As the-- due to the automated nature of evals, you'll repla-replace manual review. Uh, it will then lead to faster iteration, faster releases. You'll also be able to optimize the model that you're using, make sure that it's the best bang for buck.

  28. 5:55

    Your quality will go up, and you'll be able to scale your teams. It will enable non-technical users and technical users to also have a say in the prompt choice, in the model choice, and just the overall, um- Management of the performance in, in the production traffic.

  29. 6:17

    These are some of Braintrust's customer outcomes. So we've been able to, uh, help some of these great companies move a lot faster, increase their team productivity, and increase their AI product quality.

  30. 6:32

    So now moving into some of the core concepts of Braintrust. Uh, so we're really targeting three things. Prompt engineering, right? So we're thinking about how we're writing the prompts, what's the best way to, uh, provide context on our specific use case to the prompt so that we are optimizing its response, right?

  31. 6:50

    Uh, the middle piece, evals. Are we measuring improvements? Are we measuring re-regressions? Is this being done in a statistical way, uh, that's easy to review, easy to understand? And then finally, AI observability.

  32. 7:04

    Are we capturing what's happening in production? Do we know if our users are happy with the outputs? Unhappy? Are we able to, uh, prioritize certain responses so that we can keep iterating, keep improving?

  33. 7:20

    Great. So now moving, uh, to the eval section. So what, what is an eval? So the, the definition we've come up with is that it's a structured test that checks how well your AI systems perform.

  34. 7:30

    It helps you measure quality, reliability, and correctness across various scenarios. Ideally, you're capturing every scenario that a user will live through when interacting with your AI feature.

  35. 7:44

    When it comes to Braintrust and writing evals, there's really three ingredients that you need to understand to be able to, to work effectively. The first is a task. So this is the thing that you're testing.

  36. 7:55

    Uh, this is the code or prompt that you want to evaluate. It can be a single prompt or a full agentic workflow. The complexity is really up to you.

  37. 8:04

    The one requirement is that it has an input and an output.

  38. 8:08

    Then we have our dataset. So this is the set of real-world examples or test cases that we want to, uh, push through the task to see how it performs.

  39. 8:18

    And then the score, that's the logic behind, uh, the, the evals. So how are we grading the output of our prompt on our dataset? Uh, these can be LLM-as-a-judge scores, or they can be full code, uh, functions.

  40. 8:33

    And the caveat is that they need to output a score from zero to one, which will then be converted into a percentage.

  41. 8:40

    I have a question.

  42. 8:41

    Yeah.

  43. 8:41

    Uh, what are the test cases? Is it also LL- agent generated?

  44. 8:47

    It can be at first. The question was, is the dataset synthetic? Can it be synthetic? And the answer is it's a great way to get started quickly, is having an AI generate those initial use cases.

  45. 9:00

    But as you progress, as you mature, it's great to ground those in logs, so you're capturing the real user traffic, the real interactions that users are having, and integrating those into your datasets.

  46. 9:17

    Okay.

  47. 9:18

    Great. So now I wanted to talk about offline evals and online evals. So there's two mental models to think through. Offline evals are what you're doing in development. Right.

  48. 9:28

    So this is the structured testing of the AI model, of the, the prompt, uh, that you are going to then eventually, uh, show off to, to customers in production.

  49. 9:38

    So this is for proactive identification of issues, right? Uh, this is what we'll be doing today in the playground in Braintrust and also via the SDK. Uh, but then on the other side is online eval.

  50. 9:51

    So this is in production, uh, real traffic is being captured and being measured. It's being graded just like your offline evals are being graded. And this is going to allow you to diagnose problems, monitor the overall performance, and capture user feedback in real time so that you can understand, oh, this edge case isn't included in my dataset.

  51. 10:13

    This is a weak point in my current AI product. I need to spend some time, uh, attacking it and improving it.

  52. 10:24

    A big question that we get asked is, what should I improve? Right? Uh, I have my prompt, I have my evals, you know, how do I know what's wrong?

  53. 10:35

    Uh, and I think this matrix really helps simplify this question. So if you have a good output from, you know, your own judgment looking at what the LLM is giving you, and it's a high score, then great, right?

  54. 10:48

    You've verified yourself that the output is, is high quality, and also the, the scores, the evals have also come to the same conclusion. If you think it's a good output, but it's a low score, then that's a signal that you need to improve your evals.

  55. 11:02

    Maybe the score isn't actually representing what a human would think, right? Uh, if it's a bad out- output, but a high score, same thing, right? It doesn't match what a human would think looking at the output, so you need to improve your evals.

  56. 11:14

    And then finally, if it's a bad output and a low score, your evals are working correctly. That's good. And now you need to focus on improving your AI app.

  57. 11:23

    So I hope this helps explain how you should be thinking through, uh, your scores and, and what to, what to tackle in which moment.

  58. 11:34

    So now we're gonna zoom in to each of those ingredients or components, starting off with the task. Uh, so as I mentioned, right, a task is really just an input and an output.

  59. 11:43

    It can be a single LLM call or a whole agentic workflow. It's really up to you what you want to test. Uh, so in this pattern, we're just going to be creating a simple prompt.

  60. 11:54

    Uh, this is what the activity today is gonna encompass. And, uh, you can use dynamic templating with Mustache. So you can provide your dataset rows as part of the, the prompt, and that will be tested, uh, and you'll get to see that in action soon.

  61. 12:11

    What if you have more than just a prompt? What if you have a multi-turn chat, a whole conversation that you wanna evaluate? So you can do that in Braintrust today.

  62. 12:18

    You can provide the whole conversation as extra messages, so providing that whole chain of, of, uh, messages back and forth with the user and the assistant. Uh, you can include tool calls as well to simulate those tool calls and evaluate that big chunk, that context, that whole conversation at once.

  63. 12:38

    Tools are also something supported in Braintrust, so that's oftentimes something that your AI applications will leverage, uh, talking to external services or grabbing information from somewhere else. Uh, so you can add tools to Braintrust and have the tool available for your prompt, uh, to use.

  64. 13:00

    And just to mention, that's great for RAG use cases. So I know that's a, a hot word right now. So if, if you have that in, you know, in mind, Braintrust can handle it.

  65. 13:09

    We support tools, we support RAG. Um, agents, another hot word right now. Uh, so we also allow you to chain your prompts, right? So you can have three prompts chained together.

  66. 13:20

    The output of the first prompt will become the input of the next, and so on. Uh, so you can start, uh, testing end to end, uh,

  67. 13:29

    all these prompts back and forth, right? And, and do the same thing that you would with, with a single prompt.

  68. 13:38

    Great, so now moving into datasets. So this is the test cases, right? You're gonna keep iterating over time, but initially, maybe you're using something synthetic. Um, there are three fields that you need to understand for a dataset.

  69. 13:50

    Only one of them is required though, and that's the input. So that is the, the promp- the user-provided, uh, u-use case. The, the prompt that would be provided by, by the user would be the input, you could think of it that way.

  70. 14:03

    And then you have the expected column, which is optional, which is the anticipated output or the ideal response of that, that prompt. Uh, and then finally, you have your metadata, which can allow you to, to capture any additional information that you may want to associate to that specific row in the dataset.

  71. 14:23

    Some tips for datasets is to start small and iterate. Uh, y- it doesn't need to be the largest dataset of all time. It doesn't n-need to include all of your use cases, right?

  72. 14:33

    Just get started. Use synthetic data at first. And the important piece is to keep improving, right? Keep iterating. So if you start logging your real user interactions, you know, even if it's just in staging or internally in your organization, you can start to increase the, the ca- the, the scope of the dataset, and it will start to

  73. 14:52

    become closer to the, the overall, uh, domain of, of use cases that, that users will, will interact with. And then finally, you want to start implementing human review. Uh, this will allow you to establish ground truth, improve your dataset, improve the expected column, um, which will be great for, for your evals.

  74. 15:14

    And zoo-zooming into scores. So this is, uh-- You have two options here in the type of score that you wanna use. LLM-as-a-judge, this is great for, uh, more subjective or contextual feedback.

  75. 15:28

    What would a human need to understand when looking at the output? What criteria would they consider? Uh, this is more of a qualitative question that you want an answer to, right, using that LLM-as-a-judge.

  76. 15:40

    On the code-based score, this is deterministic, right? So you would want, uh, exact or binary conditions. This is more of an objective question, um,

  77. 15:50

    and it's-- The important piece is to try to use both. So you want some LLM-as-a-judge scores, but you also would like some code-based scores, and they, they'll help you meet in the middle and understand the, the quality.

  78. 16:04

    So some tips here. Uh, you know, if you're using an LLM-as-a-judge, maybe use a, a higher quality model, a more expensive model to, to grade the, the cheaper model.

  79. 16:14

    Uh, make sure that the LLM-as-a-judge has a focus. So don't give it, you know, four or five criteria to consider. Uh, zoom into one specific piece and expand and explain, uh, the steps it should think through, uh, to, to come to its conclusion.

  80. 16:28

    If you're writing LLM-as-a-judge, maybe you should eval the judge and make sure that the prompt that you're using is matching what a human would think. Uh, so that's another great way of improving your scores.

  81. 16:39

    And, you know, just make sure that it's confined and you're not overloading it with all the context in the world, right? You want it to be focused on the relevant input and output, uh, for consistency.

  82. 16:52

    Great. Almost at the end here. So the-- there's two things to understand about the Braintrust UI specifically. So there's the, the Playgrounds, and this is for quick iteration of your prompts, uh, agent scores, datasets, right?

  83. 17:04

    Uh, it's really effective for comparing. Uh, you can do A/B testing with prompts. You can do A/B testing with, with models. And then you can save a snapshot of the playground to your experiments view.

  84. 17:16

    And the experiments is for comparison over time. Uh, so you'll be able to track how your scores change over weeks, months. Uh, and everything that your team is doing across the UI, across the SDK will also aggregate in the experiments view.

  85. 17:31

    So you can analyze everything and understand, okay, this new model came out today. How is it performing to the prompt from two weeks ago?

  86. 17:41

    Great. So now we've reached the first activity. Uh, so if you could please go to the activity document, and it will take you through the journey of, of running your first eval in the Braintrust UI.

  87. 17:54

    Please raise your hand if you have any questions or run into any issues.

  88. 17:59

    We'll be walking around and just, uh, making sure there's no blockers.

  89. 18:08

    Do we have the register document or is-

  90. 18:10

    Yeah, if you check Slack, uh, we'll also go back to the QR code

  91. 18:16

    So did every- did everybody have a chance to get these QR codes? Um, the, the middle one is gonna be the most important. This is where you're gonna access the materials for the workshop.

  92. 18:26

    Can you probably upload it to SlideDeck please?

  93. 18:34

    Yeah, I'll repeat the question. The, the question was around, uh, extra messages in the prompt, and if you are overseeing agents and, you know, multiple types of users, multiple different roles are, uh, all talking back and forth, and you wanna distinguish th- their roles, right?

  94. 18:51

    And all being all within the, the playground UI. Um,

  95. 18:56

    so you can-- right now, there is no additional delineation between, uh, the assistant, the user, the tool call, and the, um,

  96. 19:06

    I believe that's it. So having the, the user be branched and it play different roles is something that you would need to rely on the, the SDK for that additional flexibility.

  97. 19:18

    That was me. That was supposed to be my other question. You have the API, right? So that-

  98. 19:23

    Right

  99. 19:24

    ... it can do things out of the UI programmatically.

  100. 19:29

    Yeah, and, and we'll cover the SDK in the-

  101. 19:31

    Mm-hmm

  102. 19:31

    ... in the next section. I think maybe the biggest takeaway is that there is no limit really on the complexity that, that you feed to that, like, as that task, right?

  103. 19:39

    The, the only requirement is that input and that output. Like, maybe something is a little bit more tailored to the Braintrust playground and the UI, where some things are actually a little bit more tailored to that SDK.

  104. 19:50

    Uh, so that's, that's-- we can jump into that in that next section. Um, maybe it makes sense to like, as we're going through, like, the, the, the workshop, I'll kind of walk through this as well, just so you can all kind of see me go through it.

  105. 20:02

    But feel free to raise your hand. Uh, we can, we can walk around and, and answer questions.

  106. 20:07

    Sorry, we wanna get this.

  107. 20:14

    For Slack.

  108. 20:15

    Can I take your-

  109. 20:16

    Are you able to access the document via the-

  110. 20:20

    Is the-

  111. 20:20

    The-

  112. 20:20

    The SlideDeck's not public? Is that-

  113. 20:22

    It's not public.

  114. 20:23

    Oh, the-- for the SlideDeck? Is this-

  115. 20:26

    Yeah. We've, we've just-- Yeah, the question was this is all in the UI, right? Is this-- That, that, that's the only place we've been thus far, right?

  116. 20:33

    Mm-hmm.

  117. 20:33

    Uh, just talking a little bit about the, the different components of the Braintrust platform.

  118. 20:39

    Um, so let me, let me walk through that, right? And give you a sense for what we just kind of showed to you in slides, right? Um-

  119. 20:44

    So you can't access the SlideDeck?

  120. 20:48

    We, we can, we can update that.

  121. 20:49

    Yeah.

  122. 20:50

    Yeah. Um, just let-let's kind of walk through this, uh, so we can get a sense for what, what we're, what we're building here. Uh, some of the things that, that Carlos just walked through.

  123. 21:00

    Um, I have a lot of this stuff already installed. I hope that you kind of walked through this, right? We need, uh, certain things on our system to actually go and run this.

  124. 21:08

    So we have Node, we have Git. Um, we're gonna sign up for a Braintrust account. Creating a Braintrust org. Already done this, so I'm not gonna kind of bore you through that, that step right there.

  125. 21:18

    This project, unreleased AI. Um, if, if you, if you don't do that, you'll see two projects in your account. But, um, just this is where we're gonna actually create our prompts and our scores and our dataset from the repo that we're gonna clone into, uh, our local machine.

  126. 21:37

    A part of this demo requires an OpenAI API key. That's just what we're using under the hood. That's certainly not a limitation of Braintrust. Um, you can use-- and maybe just to kind of highlight something here,

  127. 21:49

    you can, uh, you can use really any AI provider out there. So y- if you've gone into Braintrust account, you've probably seen this. You've entered your OpenAI API key here.

  128. 21:58

    This is what is gonna allow you to, to run those prompts in the playground. You can see you have access to many other providers. You have access to, uh, cloud providers like, uh, Bedrock and, and so on.

  129. 22:08

    And then you can even, uh, use your own custom provider. But for this workshop right now, we are using OpenAI.

  130. 22:14

    Question. Are you able to do this local, um, with local models local?

  131. 22:19

    Sorry?

  132. 22:20

    Are you able to run evals of Braintrust, uh, locally with local models?

  133. 22:24

    Yes. Yeah.

  134. 22:25

    We can.

  135. 22:25

    The question was, "Can you run Braintrust locally using local models?"

  136. 22:29

    Yeah.

  137. 22:29

    Yeah. Um, we, we have, uh-- If you look a little bit further out, there's a section for what we call remote evals. Might not have time to get to it in this particular section, but know that you can go to that and, and play with that feature as well.

  138. 22:45

    Um, sorry, coming back down here. Um, so we're gonna clone this repo, right? This is, uh, right, this is the application that we're creating. The idea is to, uh, give it a, a, a GitHub URL and look for most recent commits since the last release, and then summarize those, right, for us as, as developers.

  139. 23:06

    So that's the application that we're gonna use. Uh, we're gonna create some different API keys locally. So if you've cloned your repo, uh, you'll have a .env.local file. Uh, I'll show you my example.

  140. 23:19

    You're gonna also input these, your, your Braintrust API key here, and then your OpenAI API key. This is optional down here. Uh, it's just if you don't wanna get rate limited by GitHub.

  141. 23:29

    Probably not, probably not gonna create a lot of requests right now, so you probably don't need this.

  142. 23:37

    Um, really important step here. So I'm gonna come back into, uh, Braintrust.

  143. 23:48

    So as part of our install, we're, we're actually gonna go create some of these resources, uh,

  144. 23:54

    within our Braintrust project that we just created. So I'm gonna run pnpm install.

  145. 23:59

    This will actually go push some of these resources, and you'll find these, uh, in the Braintrust folder, the resources, and we'll jump into that, but just wanted to highlight that.

  146. 24:09

    So now if I look back into my project, I should see that unreleased AI and the different things that we've created. We have two different prompts now, right? These are the, the prompts that we use to generate the change log, as well as the, the test cases, the dataset that we'll use as, as part of this

  147. 24:27

    Yeah Uh, real quick, could you make the font a little bigger? Yeah, yeah, of course.

  148. 24:33

    Um, code or here within the doc? Both? Uh, both, yeah.

  149. 24:40

    Yeah. All right, let me stop there. A- anybody having issues just kind of going through that initial setup phase?

  150. 24:48

    Where are the, where are the slides?

  151. 24:53

    Excuse me?

  152. 24:53

    Where are the slides?

  153. 24:55

    Uh, we haven't made those public yet. I think we're-

  154. 24:57

    Yeah, I'm trying to-

  155. 24:58

    We're working on that

  156. 24:58

    ... to do that now.

  157. 24:59

    Yeah.

  158. 25:00

    So am I supposed to just take a QR code on my phone and then send a link to it?

  159. 25:03

    Do you have, uh, do you have Slack? Uh-

  160. 25:06

    I, I do have Slack.

  161. 25:08

    Were you able to join the workshop evals channel?

  162. 25:10

    The Wi-Fi is just, like, terrible. I can't really... I don't know. It's, like, on, um-

  163. 25:15

    Same.

  164. 25:16

    Yeah, the, the Wi-Fi's not working.

  165. 25:18

    It's really slow.

  166. 25:19

    It's slow.

  167. 25:19

    Okay. Well, I'll, I'll walk you through. Yeah.

  168. 25:22

    How are we connecting the clone repo to the, to the project UI if I have it like that? Yeah.

  169. 25:27

    Um, yeah, so th... when we ran pnpm install, we ran a, a script in the background called just Braintrust push, and if I look at, uh, that file here, there's different things that we've configured, right?

  170. 25:39

    We've configured, uh, my change log. So this is actually the Braintrust, uh, SDK under the hood. Uh, this is where we're creating that prompt in that project unreleased AI.

  171. 25:49

    And so th- there's a couple things that we can do here from an S- SDK perspective. This is like, you think about, uh, you know, version controlling all of these different things and actually, uh, pushing them into the Braintrust UI.

  172. 26:00

    So there, there's a lot of different ways to work with Braintrust, I think we mentioned earlier, either via just like the, the UI or actually via the SDK. But that's, that's how a lot of this stuff got created.

  173. 26:11

    Okay.

  174. 26:13

    Cool. Let's, let's kind of walk through this, uh, this first activity. Um, we're gonna, we're gonna access the unreleased AI project. So if we go to the prompts, so this is what we just created.

  175. 26:27

    Uh, we created two different prompts, right? This is essentially what we can start to play around with, right? We have this one, uh, and you... and Carlos mentioned earlier there, there's this mustache syntax we can actually input, uh, variables here into, into our prompts, and this is gonna actually map to the, the different data sets that we

  176. 26:43

    can actually use as part of this project. So here's our first prompt. It's about impossible to see. That was impossible? Okay. Well, it's- No, no, that's fine. I appreciate that.

  177. 26:52

    Thank you. [laughs] And the lighting is hard, so-

  178. 26:54

    Yeah.

  179. 26:55

    Oh, maybe we can-

  180. 26:56

    Change the appearance to light mode? I don't know.

  181. 26:59

    Yeah, where's that?

  182. 27:00

    Try with the user appearance.

  183. 27:04

    How's that?

  184. 27:07

    Oh.

  185. 27:07

    It's daytime.

  186. 27:07

    Thank you. No, I appreciate that. How's this?

  187. 27:14

    Looks good.

  188. 27:15

    Okay, cool. Um, so really just reviewing the stuff that we created. We created these two prompts. Here's our data set that we're gonna use when we run our evals and our experiments.

  189. 27:25

    Uh, you can get a sense for, for this. Here's my input. I have a series of commits, and then I have a repository URL, and I have the, the...

  190. 27:35

    when the, the last release was. The, that's that since field. So these, this is, again, the, the thing that we'll use inside of that playground to create, uh, to create evals and, and to use to iterate from.

  191. 27:47

    And then the last thing that, uh, I'll call out here

  192. 27:51

    is the scores. Uh, so we created a few different scores that we'll wanna use to actually score, uh, these prompts. So we have an accuracy, formatting, and completeness score.

  193. 28:02

    And again, this is just in that, that repo, in that resources.ts file. Uh, we have, maybe just to, to point out, uh, linking a little bit of what Carlos was talking about to the actual code that you're seeing.

  194. 28:12

    We have LLM-as-judge scores, as you can see here. Uh, really again, trying to pinpoint here the accuracy, right? Uh, we're not overloading a single LLM-as-a-judge score with accuracy, completeness, and formatting.

  195. 28:26

    Gonna be very, uh, sort of, um, detailed or, you know, scoped down to that particular thing. And then the last one, we have a code-based score, right? So this is a little bit more, uh, binary, right?

  196. 28:37

    Is the, uh, the formatting of this change log that the LLM generated, does it map to what we expect? And so we can use some code to do that.

  197. 28:45

    So that's what we created via that script.

  198. 28:49

    Question.

  199. 28:50

    Yeah.

  200. 28:51

    How do we get that sandbox project into our Braintrust project?

  201. 28:57

    Yeah, so if you go back to the, the lab setup, when you run, when you run that install... So I'm using pnpm.

  202. 29:05

    All right, I don't know if, if you use that. If you're using that locally, you can s- you can also use NPM.

  203. 29:10

    So what is the key for OpenAI API key?

  204. 29:13

    What is the key? Do you not have an OpenAI API key?

  205. 29:16

    No. If... And the instruction says that, uh, reach out to us if you do not have the key. Read it, it says, uh, if in case you don't have API key, please let us know.

  206. 29:27

    Okay. Um, I don't know if we have one to distribute at the moment.

  207. 29:33

    Yeah, if you don't have-

  208. 29:37

    Excuse me. Can I do this later?

  209. 29:38

    Well, if you, if you go, like, the part of the setup here, Reverend, we go to... If you, if you come in here to a playground as an example.

  210. 29:49

    All right, and we're gonna pull in one of those prompts, or we can pull in both of these prompts to do, again, like what Carlos was talking about, that, that sort of like AB testing.

  211. 29:58

    It's gonna ask for some OpenAI models, right? It's g- If you don't configure, uh, an OpenAI API key inside of your Braintrust account-

  212. 30:06

    Oh, sorry

  213. 30:06

    ... you don't have a provider to actually run this, this task against.

  214. 30:10

    Oh, okay.

  215. 30:13

    Um, but, but this is, this is the playground, right? This is what Carlos was talking a little bit about earlier, uh, about being able to do some AB testing, right?

  216. 30:20

    I have, uh, my two prompts that I've loaded in. The idea here is to, to load in those different ingredients, right? Our tasks, our, our data set, and then our scores.

  217. 30:30

    So you'll, you'll look down here. We're gonna select that data set. And then we're gonna select the different scores that we wanna score this task against, and I'll load in my accuracy, formatting, and completeness.

  218. 30:43

    Um, can do a couple things here. I can click Run. This will actually, in parallel, go through that, uh, that dataset and use each task that we've defined, and then it will score those, right?

  219. 30:53

    So the idea here is to, again, like this provides that sort of rapid it- rapid iterative, uh, feedback loop that we oftentimes need to build these types of products.

  220. 31:02

    So here are my, you know, like my example rows. Again, these could be synthetic. These could be a, a small subset of rows that are coming back from my application.

  221. 31:10

    But now I can get a sense for prompt A, prompt B, how are these performing with my scores, uh, you know, relative to the things that I have here.

  222. 31:19

    But, uh, then I'm able to do a lot of different things here. I, I can, uh, look at maybe a summary layout, get a sense for, uh, the scores.

  223. 31:27

    So, uh, at the top, this is sort of like my baseline. Up here is my base task, and this is my comparison task. So you can get a very high-level, uh, look at these different scores and how they fared with the different prompts that we've loaded in here.

  224. 31:41

    Now, the other thing that we can do that Carlos mentioned is, uh, experiments. So oftentimes we'll want to capture this-- the, these scores over time, so when we do make changes, we understand how those scores fared a week ago, a month ago, or, or whatever it is.

  225. 31:55

    So I can click this Experiments button, and you'll see the different things that we've loaded up into this playground are already, uh, here within this, uh, modal. We'll click Create, and this will actually create the experiment that you can go to here.

  226. 32:09

    And again, this'll, uh, if I click maybe one out, this is-- allow us to track this over time. This is what we can also lay in, uh, uh, in our CI kind of workflow.

  227. 32:19

    So we go make a change to that prompt and make a change to that model. What are the impacts to, uh, the, the scores relative to what we had over history?

  228. 32:29

    What is the completeness score? Uh-

  229. 32:31

    S-sorry. Can you-

  230. 32:32

    What is the completeness score?

  231. 32:34

    What is the completeness score? Yeah, we can dig into that a little bit. Um,

  232. 32:38

    this is an LLM-as-a-judge score. So the idea, right, we're just gonna give it, um, instructions. The LLM is gonna score the output based on what we've provided in this prompt.

  233. 32:50

    Uh, you'll also note I'm just really pulling in the, uh, the structure of my dataset, right? And so y-you obviously can write... And, and another thing that Carlos mentioned is like scoring the score or eval-evaling the score.

  234. 33:03

    So how well is this thing actually doing, um, based on the output that, that we are seeing within our application?

  235. 33:19

    Okay. That's really activity one, right? It's, uh, reviewing some of that stuff, and then it's creating that playground and showing you all like the, the sort of way that we can, uh, iterate here within Braintrust to create better AI or gen AI products, right?

  236. 33:34

    Like, this allows me to now-- Well, okay, so maybe this isn't the right model. Maybe if I do, uh, maybe I want to see this new GPT model, I can run this, and now I can see how the, the model changed for that particular score, uh, how the scores change when I change the underlying model, right?

  237. 33:53

    But now I have these-- You have like all of these different inputs that could happen to th-these applications. It's a way for us to track and understand when I do go and tweak this thing, there's actual data behind it, right?

  238. 34:04

    This isn't like vibe check. This isn't, um, "Yep, I think that looks good. I looked at this row. It seems like it's better output." This is data behind it, and we can actually understand as we tweak that prompt, tweak that model, how does that impact our, uh, our scoring?

  239. 34:18

    And then again, you can like overlay this within CI and, and so on.

  240. 34:24

    Question.

  241. 34:26

    Yeah.

  242. 34:26

    So, um, I pulled the project down, and, uh, I have the, uh, Braintrust account-

  243. 34:34

    Mm-hmm

  244. 34:34

    ... with the OpenAI, uh, key and everything. I just don't, uh, don't know where it should, like, be right now in the project. How do I get the, um, GitHub, uh, project that is on my machine to the-

  245. 34:49

    Yeah. Okay. So you, you cloned the repo.

  246. 34:52

    Yeah. [clears throat] Can I-- And can we get a sense of where people are?

  247. 34:57

    Yeah, please. Uh, g- uh, we can back up considerably. I, I can s-- I can just, you know, with you, we can fix this. Um, you've cloned the repo, correct?

  248. 35:08

    Yeah.

  249. 35:08

    Okay. In your .env.local, do you have a .env.local file?

  250. 35:15

    I should have, yeah.

  251. 35:17

    Uh, there is a .env.local.example file, so you can copy that into the .env.local. Those are the, the keys that we wanna fill in. Have you filled those in?

  252. 35:26

    No, I did not.

  253. 35:27

    Okay. So if you haven't within your Braintrust org created an API key-

  254. 35:36

    Do all the people already did that? I mean, am I the only one?

  255. 35:40

    I'm guessing no.

  256. 35:41

    Yeah, I don't think so. I think the internet connection is probably the biggest thing we're fighting here.

  257. 35:46

    Yeah.

  258. 35:47

    Yeah.

  259. 35:47

    Luckily, all this in-- all the instructions will be available after the workshop, same with the slides. I'm about to share the, the slide link. So tough to update with the connection, but, um,

  260. 35:59

    at least seeing Doug go through the same process will give you an understanding of, you know, what we were hoping you'd have that hands-on experience doing. Um, we don't have too much time to, to wait on this specific activity, so I think in a few minutes we'll keep going, and

  261. 36:15

    hopefully you'll be able to set up your keys so that you can catch up when, when you have some time.

  262. 36:23

    Yeah. Just in the interest of time, we'll, we'll probably move forward. But just to complete that, if you go into your settings within your project, uh, or excuse me, within your, uh, Braintrust org, you'll see API keys.

  263. 36:34

    This is where you're gonna create this API key. You did that. Okay, perfect. Create that. You put that in that .env.local file, and then you run pnpm install.

  264. 36:45

    So that is, that is my-- in my, uh, home directory, right?

  265. 36:50

    That's-- It's wherever you cloned that repo.

  266. 36:53

    Yeah. Okay.

  267. 36:53

    So at the root of that, uh, you put the, the Braintrust API key in your .env.local file.

  268. 37:00

    All right.

  269. 37:00

    And you should have a spot for it already if you're using sort of the template from the example.

  270. 37:06

    And then when you run pnpm install... Again, just to highlight this,

  271. 37:13

    it's actually running this command, Braintrust push. So we're taking the, the resources that we've configured in our, in our project and it's pushing it via our API key to the Braintrust org.

  272. 37:26

    Got it.

  273. 37:27

    Cool. All right. Uh, maybe going forward a, a little bit here to talk about, uh, the, the flip side of this,

  274. 37:52

    right? We've been kind of in the UI for the most part, uh, in our playground doing that, that iteration, changing prompts, changing models, and so on. Uh, I think it's important to understand that we can do a lot of this via the SDK as well.

  275. 38:06

    Uh, we also have a Python SDK, if that's the kind of, uh, flavor you're, you're most, uh, used to using or the, the language. But, uh, that, that top portion here, uh, is essentially what we did, right?

  276. 38:18

    In that, that install or that post-install script. We defined our assets in code. We defined scores. We defined prompts. Um, we defined a dataset even, and then we pushed that into our Braintrust org.

  277. 38:29

    The, the benefit here is that, again, we can use our, our repo, right? We can leverage version control to ensure that the things that we want, uh, to change are actually version controlled alongside of everything else that we're building within that application.

  278. 38:41

    So there are really two modes to actually work with, with the Braintrust platform. It's its UI or its SDK. Again, there's really no limits that we place on, on the, on the user of the platform.

  279. 38:50

    It's gonna cater to maybe a different, uh, persona, a different use ty-- uh, use case. Uh, but you can use kind of both of these different things. The other thing that we haven't done yet, uh, well, that we did, uh, wi-within the playground when we ran that experiment, we ran, we ran those evals, right?

  280. 39:04

    We actually evaluated, uh, the task against the dataset with our scores. You can also define evals in code, right? You can define the evals within your repo, uh, in a very similar command, Braintrust Eval.

  281. 39:17

    Now we can push that up to the Braintrust platform and essentially run that same thing. Track it in that experiments. I have now, uh, an understanding over time how my, uh, my evals are performing as I go and change things, all those different things.

  282. 39:32

    A little bit more, uh, insight here you probably saw with some of that code. This is the, uh, the, the, the command we're gonna run Braintrust push, and you essentially give it either the name of a file that have evals in it, or you can give it the name of a folder, uh, as long as your, uh,

  283. 39:47

    your files have .eval.ts as their naming convention, and we're just gonna go run those evals in that parallel fashion that you saw within the UI.

  284. 39:58

    A couple things maybe, uh, I, I mentioned earlier, but just important to highlight. You should do this when you want source-controlled prompt versioning. You want consistent usage across your, your different environments, and you also wanna leverage online scoring.

  285. 40:13

    Uh, mentioned this, uh, obviously, the, the .eval.ts. That's essentially what the SDK is looking for, uh, when we go and run those evals. It makes it really easy to run a, a larger subset of those without specifying each single file that you wanna go run those evals for.

  286. 40:29

    Um, but you can see, uh, and I'll, I'll-- Let me jump into the actual activity. You can see the eval that we've created. It's, it's what we've been talking about, right?

  287. 40:37

    The three ingredients that we need. We need that task, we need that dataset, and then we need at least, uh, one scorer there as well.

  288. 40:46

    How do you bootstrap a dataset, like with multiple examples? Is there human feedback in loop or is an LLM being used to create the dataset as well?

  289. 40:54

    Yeah. So, uh, the question was like, how do you bootstrap a dataset? Um, I, I think it's a good question. I, I think you could certainly start with syn-synthetic data, or you could even start with, um, you know-- You, you release a feature, right?

  290. 41:06

    You're, you're gonna l-- you're gonna start logging that feature. This is another thing that we haven't yet covered. But you can actually use the logs from that to add to the dataset.

  291. 41:14

    So now you have actual real-life data. The thing to not do is wait until you have a hundred, two hundred, like you have this golden dataset. If you think back to that matrix that Carlos was showing, there are the different ways in which we could start to think about improving the application based on what we observe.

  292. 41:31

    So start with something small, and again, it could be synthetic, but then you can-- Once you start to evaluate it, then you have a different, um, you have different inputs on what you need to do to go and improve an, uh, a scorer or improve the application.

  293. 41:45

    But it's, it's really, I think, maybe up to you. The, the, the, like the best practice or the thing that I would think about is like, don't, don't stop yourself because you only have a small subset of data.

  294. 41:57

    Got it.

  295. 42:00

    Okay. Yeah.

  296. 42:04

    So for the, for the, the tests you're running, if you're using an LLM as a judge, so like for the percent completeness score-

  297. 42:13

    Mm-hmm

  298. 42:13

    ... you're using GPT-4.1 as a judge. That's subjectively scoring the test that you're running, right? So like for the, for the sa-- for two runs that are-- that happen one after the other, you could end up with different scores, right?

  299. 42:31

    If you're using like LLM as a judge to run the evaluation.

  300. 42:35

    Um, so the, the question was like, would I get different scores- Um, because I'm using an LLM to do this, right? And it's not really n- deterministic. Um, I, I think that's the, the reason why you would use a better model so you don't see something like that.

  301. 42:53

    Um, I don't know, Carlos, do you have any other thoughts there?

  302. 42:57

    Yeah. I mean, I think you're speaking to the nature of an LLM being non-deterministic. So yes, there may be some variability. What we see our customers do, especially with the SDK, is, uh, do trial evals.

  303. 43:09

    So you will run it maybe five times and then take the average of those. Uh, so there are things that you can do to try to beat that, but it, it is the nature of the beast and you have to learn to work with it.

  304. 43:20

    And then the other thing is, how are you scoring, like, a percent completeness if the task of the LLM is, like, to judge, like, put it in categories like excellent, good.

  305. 43:32

    Are, are you, like, mapping those to, [coughing] to scores or?

  306. 43:36

    Yeah. So the, I, I think the, the question is, and if I come to the score and you look at the completeness, so the LLM here-

  307. 43:45

    Okay.

  308. 43:45

    Yeah.

  309. 43:46

    Got it.

  310. 43:46

    It has to decide-

  311. 43:47

    Yeah

  312. 43:47

    ... based, again, on, like, the criteria that we give it, um, if it comes up with excellent, that maps to one and, and so on. But again, this, this score that it gives has to be between zero and one.

  313. 44:00

    Yeah.

  314. 44:01

    Yeah.

  315. 44:01

    It's really helpful when you're using an L- LLM as a judge to go through the Braintrust logs and read the rationale. So it will explain why it chose, you know, 100% or 75%, and you can use that to tune the LLM as a judge and improve it.

  316. 44:18

    Um, it likely will not... You know, you don't want it to say 100% for everything, right? If, if that's the case, you need to improve your evals. Uh, and even if it's saying, you know, 30% for everything, it doesn't necessarily mean that it's performing horribly.

  317. 44:36

    Uh, what really matters is the baseline that you're comparing it to. You know, how did it perform yesterday on these scores, on this data set? Uh, you shouldn't be comparing just, you know...

  318. 44:46

    It needs to be 80%. Not necessarily. It matters what happened yesterday, what you're comparing to, uh, previously.

  319. 44:54

    Yeah. And this is where it becomes really beneficial to, to be able to actually drill into what happened within that task. Uh, so being able to not only understand the, the calls that the LLM makes, the tools that it invokes, but actually drilling into those scores that we're using and then, like Carlos mentioned, what is the rationale

  320. 45:10

    that it gave, uh, to give it a good score here? Does that make sense? This becomes, again, another way of, like, this is the, the human review portion or part of building a GenAI app.

  321. 45:22

    Yeah.

  322. 45:22

    Does Braintree offer, um, any kind of, like, optimization or prompt optimization features? So assuming you have your eval down, you got tons of, uh, different, like, data points to test from.

  323. 45:34

    Um, can you kind of do Braintree to offline the prompts itself?

  324. 45:39

    Yeah, that's a good question, and it's something that we're thinking a lot about is how can we add LLMs to optimize this process for you, not just for prompts, like you mentioned, but also for datasets and for scores.

  325. 45:51

    We're one to two weeks away from releasing our first version of this. Uh, we're gonna call it Loop, and it will do exactly what you're saying. It will help you optimize the prompts and improve your evals.

  326. 46:04

    Just to build on that, imagine, like, this, um, this feature Loop, it has access to previous results as it's doing it, so it understands when it makes that change, is it better than it was previously.

  327. 46:15

    So it's, it's, it's sort of like that agentic type workflow where it has access to tools, but it's able to, uh, to iterate on that prompt and run those experiments, uh, with you, of course, like, in the middle to, to prompt it to do different things.

  328. 46:29

    But it has access to those previous experience, experiments and the results of that, so it knows, like, the general direction it needs to go to get improvements. Yeah.

  329. 46:38

    So how do you build that? [laughs]

  330. 46:42

    We use Braintrust. Yeah, exactly. It's a way of dogfooding. Uh, so h- the question was how do we eval our AI feature, and it's, you know-

  331. 46:49

    Yeah

  332. 46:49

    ... of course, we have to use Braintrust. And it's, it's honestly really cool to, to look at the project and see all the logs coming in and, and looking at the scores that we've chosen to go with.

  333. 46:58

    Um, but yeah, Braintrust is really helping, and it was actually something that Ankur, our CEO, has talked about, uh, the process of, of actually getting to a point where we were excited to release something like this.

  334. 47:11

    Previously, the models were not performing to the level that we were needing them to perform to. So every few months, he would run a new benchmark on this specific use case, and it wasn't until, you know, the last month that a model finally, uh, reached that, that expectation.

  335. 47:30

    Yeah.

  336. 47:30

    They gave me a mic, so hopefully you can hear me.

  337. 47:32

    Yep.

  338. 47:32

    Um, cascading off the gentleman in the front's question around, um, the subjectivity of using the LLMs as a judge in these types of cases,

  339. 47:43

    do you offer any way to gain access to that rationale programmatically, such that you could evaluate the thought process of the LLM as it's doing? It's kind of meta, like one-step review-

  340. 47:54

    Yeah

  341. 47:54

    ... but adding in that second layer where you could identify weak spots, perhaps if there's something that's hyper workflow oriented or has a very strict process you're looking for the LLM to follow.

  342. 48:06

    Yeah. I, I mean, I, I think you probably saw when I highlighted here, correct me or thumbs up if you saw this or... Yeah. Okay. This is all accessible via, via API.

  343. 48:15

    Uh, coming back down here. So, like, the, the rationale that the LLM gave, [coughing] you could certainly build something o- on top of, uh, the, the, these rationales, uh, and then generate, you know, again, like eval the eval type of workflow.

  344. 48:35

    Cool. Yeah.

  345. 48:38

    You had a question.

  346. 48:40

    Uh, so just curious, like, uh-

  347. 48:43

    There's a mic if you'd like it. Yeah

  348. 48:47

    Yeah. So, uh, yeah. I'm, I'm just curious, like, how should we build our confidence around, like, you know, the result of LLM-as-a-judge because, I mean, uh, you know, how do we trust the eval result?

  349. 48:59

    Because it's after the model, like, evaluate the dataset, and it's could ... Like, we could get, like, you know, uh, maybe a good result, but actually it's ... Like, maybe large model is just overconfidence or something like that.

  350. 49:14

    Is it, like, we need to evaluate our eval results using, like, humans, like, at the beginning so that we can build the confidence? Like, yeah, just, uh, curious any experience, like, you have here.

  351. 49:26

    Yeah, definitely. That's a great question. So, um, I guess everybody heard. Don't need to repeat. Um,

  352. 49:32

    I think there's two things that you can do. One that you mentioned, which is involving a human reviewing that LLM-as-a-judge and confirming that is ... it's thinking the right way, it's outputting the correct score.

  353. 49:45

    Um, another approach that you could do as well as the human in the loop is, uh, using deterministic scores, so full coding functions that are trying to grade the same type of criteria using regular expressions or some other logic.

  354. 50:00

    Uh, that, and you can approximate, right? So if the LLM-as-a-judge is giving a zero, but the, you know, the deterministic code score is giving a way higher score, then you know that there's something that needs attention, needs to be fixed.

  355. 50:13

    The matrix as well that we showed at the beginning that pointed to, you know, should you improve your evals or improve your AI app, that's also a great resource.

  356. 50:23

    Yes.

  357. 50:24

    Thank you. Um, how are you guys thinking about the role, if you think there is a role, um, for traditional machine learning models in evals? I mean, you know, on one hand you have totally deterministic code, and then on the other you have LLM-as-a-judge.

  358. 50:38

    Do you think there's kind of a middle ground for things like intent classification models, entity, uh, recognition, uh, sentiment classification and clustering, and, and kind of more traditional machine learning approaches that kind of sit somewhere in between, you know, the, the, the totally deterministic versus totally non-deterministic spectrum of code versus LLMs?

  359. 50:59

    Like, do, do you think that there's a role for those type of models, and what do you think that looks like?

  360. 51:04

    Yeah, that's a good question. Um, I think it's still to be determined how this all shakes out. There are some, uh, customers, companies that we talk to that are going full deterministic.

  361. 51:17

    They don't use LLM as a judge. And then there are others that are very much going in the LLM-as-a-judge route. And I think the reason that there's a split is 'cause they both work.

  362. 51:26

    Uh, so you know, I don't know. I don't know how this will eventually shake out, if we'll reach in the middle or if, you know, determinism will win. Um, what I can say, though, is that it, it's highly dependent on the use case, the problem that you're solving.

  363. 51:39

    And experiment with both, and then you can determine which one is working best.

  364. 51:45

    I guess those are, like, also largely code-based, right? The, the things that you're talking about, and some of it, they lean a little bit more to- towards that.

  365. 51:53

    Yeah. I, I mean, I'd say there's still kind of parallel approaches-

  366. 51:56

    Mm-hmm

  367. 51:56

    ... are still non-deterministically mystic, but thank you.

  368. 52:01

    Yeah. No, I, I gotcha. Um, it's, it's sort of like that, that middle ground. Um,

  369. 52:07

    yeah, I don't, I don't have a great answer for you. Uh, I do think, uh,

  370. 52:11

    using Braintrust, uh, you, you do have the ability to at least configure both of these, the, the LLM as a, as a judge and then the scorer. And then you can, again, using the, the human review process, uh, find the ones that, that actually map to the, the right output the best, and then that's how you start

  371. 52:28

    to build your application. But it's, it's a really good question.

  372. 52:32

    Thank you.

  373. 52:36

    How is the activity going? I know we are getting, you know, last 25 minutes of, of the session. We still have two more, uh, little slide chunks to go through.

  374. 52:48

    So maybe in, you know, two minutes or now we could move to the slides and then, uh, keep it going. Again, this will all be available after, uh, so feel free to keep working on it.

  375. 53:00

    Yeah. Maybe just really quick we could run the, the eval. Just from here you could see, um,

  376. 53:07

    we're actually gonna take the, the eval defined here, right? So we have our, our task, we have our scores, then we have our dataset. Essentially what we just, uh, did within the UI, pushing that into the Braintrust platform.

  377. 53:21

    Uh, and then you can even see, like, this is where it's running right now.

  378. 53:27

    So again, being able to do these i- in a couple different ways, either via the, the SDK or from the, the playground itself.

  379. 53:40

    I, I think you explained this already, and I maybe I was distracted by the Wi-Fi, but how do I think about the difference between the playground and the experiment?

  380. 53:48

    Yeah. That's, that's a great question. Let's see if we can just quickly go back to the slide.

  381. 54:01

    Playground you can think of as quick iteration.

  382. 54:04

    Experiment ... So a playground ephemeral, right? Experiments long-lived, historical analysis.

  383. 54:11

    If that helps answer your question. Um, they're becoming more and more the same. You know, historically the experiments had a bit more bells and whistles, uh, so I ...

  384. 54:20

    You know, typically teams would gravitate towards the experiments. But we found that they really liked the quick iteration. They really liked using the UI. And so we started beefing it up, and now they've become pretty much the same.

  385. 54:33

    So, so yeah. Playground more ephemeral, quick iteration. You want to save the work that you've done to an experiment so that you can later review it and see the scores update and change over, over time.

  386. 54:46

    I guess that was my ... So when I do an eval from the SDK it always is an experiment. Like, what if I just wanna iterate in my-

  387. 54:53

    I, I should use the UI, the Playground UI for that

  388. 54:56

    Yes, and remote evals, which will allow you to define via the SDK, the eval, but then expose it into the Playground. Uh, so some of-- It's, it's like the bonus activity in the document at the very end, so maybe you should check that out and...

  389. 55:13

    W-we won't have time in this session, but if you come to the one at three thirty, we will.

  390. 55:19

    Any other questions? Okay, cool. So moving into lecture three, uh, so this is, you know, once you've finished development, it's reaching customers, you're in production, right? Now what do you do?

  391. 55:34

    Well, the, the important thing is logging. You want some observability. You wanna understand what's going on. How are they using it? Are there any gaps? Are they unhappy?

  392. 55:44

    It can help you debug, uh, a lot faster. It can allow you to measure quality instantly on that live traffic. You can turn those production traces, what you're logging, you can turn it into a dataset and bring it back into the Playground, keep improving the prompt.

  393. 56:04

    And, you know, it, it allows a lot of non-technical people to understand what the end user is thinking. So you can close this feedback loop. We have a lot of PMs, SMEs using Braintrust, and going through the logs and, and looking at that user feedback to understand what gaps and, and improvements may exist.

  394. 56:27

    So how do you log into Braintrust? Uh, well, this is done via the SDK, right? It needs to plug into your production code. Uh, so these are some of the, the steps here, the, the tools that you can use.

  395. 56:38

    So, you know, you ne- you need to an-initialize a logger that will authenticate into Braintrust. It will connect it to a project. So now your logs will go to a specific project in Braintrust.

  396. 56:48

    Um, some great ways to, to get started with really one line of code is to wrap your LLM client. Uh, so you can use wrap_openai, uh, around that LLM client, and now any communication will get logged, uh, with your prompt, response.

  397. 57:07

    It also, uh, metrics, so how many tokens were sent back and forth, the latency, all errors, everything, uh, just by adding that, that wrap_openai. You can do the same with Vercel AI SDK, uh, or you could use Otel.

  398. 57:21

    So we also integrate with Otel, um, so if you want to go that route, it's also available.

  399. 57:26

    If you want to log and trace arbitrary functions, we also support that. You can just use a trace decorator around the function. Um,

  400. 57:37

    really helpful for keeping track of any, uh, functions that are helpful to, to understand and, and keep track of. And then if you need to add additional information like metadata, you can use span.log.

  401. 57:50

    So it's, it's very capable, very flexible, but there's still these, you know, one line code ways to, to get started.

  402. 58:01

    So now that you're pushing all of your logs into Braintrust, you're capturing, you're observing real user traffic, now we're gonna get into that, you know, online scoring piece as opposed to offline, right?

  403. 58:13

    So online is measuring the quality of live traffic. So you can decide how many logs that are coming in will get evaluated and scored. Uh, it could be a hundred percent, it could be one percent, it's up to you.

  404. 58:28

    This allows you to set early regression alerts. So if it starts dropping below, you know, seventy percent, sixty percent, ultimately it depends on the score that you're using and what you've established as the baseline, but if it starts dropping below a critical amount, you can set up alerts and notify the correct team.

  405. 58:44

    Uh, you can also A/B test different prompts. You can, uh, set up tagging and understand, oh, this trace coming from this user, uh, is from prompt A versus this one from prompt B, and you can compare, uh, the, the grades, right, the, the score results coming back in.

  406. 59:02

    So this is great for just improving feedback, moving quickly, and understanding if there's been a drop in quality.

  407. 59:11

    How do you create an online scoring rule? Well, everything is done via the UI. You go to your project configurations, click on Online Scoring, and then you can add your rule.

  408. 59:21

    This is where you'll define what scores you want to be used on that live traffic, and then, uh, crucially, that sampling rate. Uh, so, uh, maybe at the beginning you start with a lower sampling rate, and then you can increase it, uh, once you trust the metrics coming in.

  409. 59:37

    You can also choose what span you want this online score to run on. So it defaults to the root span, but you can get more granular and specify, you know, I want this nested child span to be, uh, scored.

  410. 59:56

    Once you start collecting these logs, collecting these online scores, oftentimes teams want to view them in interesting ways and customize the lenses on those logs. So that's where custom views come in.

  411. 1:00:08

    Uh, you can apply filters, sorts. You can customize columns on the logs with whatever information you'd like. And now you can start saving those views and making them available for the rest of your team to just come to the logs and select, "Oh, I wanna go to, you know, the logs under a fifty percent view," or, you

  412. 1:00:30

    know, their own custom view that they've made that's specific to what they care about. Uh, so it's, it's a great way of collaborating and, and, uh, speeding up the process of viewing the important things to you.

  413. 1:00:45

    Great. So, you know, we went through the slides. Now we would jump back in to the,

  414. 1:00:52

    to the activity document. There we can look at the actual, uh, code, see where the, the logging is being captured in our files. spin up the application so you can actually view the application in your dev environment, interact with it, and you'll see those prompts and outputs being logged in Braintrust.

  415. 1:01:13

    Uh, so if, if you've gotten that far and you have the, the dependencies installed, then I would recommend doing a pnpm dev, and now you'll have your application up and running.

  416. 1:01:22

    Interact with it a few times, and, uh, you'll see that populate in your project logs.

  417. 1:01:29

    Once you do that, then you can go to your online scoring settings, set up a rule, and you can keep interacting with the app, and now you'll see it, um, populate with that online score that you just enabled.

  418. 1:01:48

    Maybe a quick example for, for those that are still having sort of Wi-Fi issues. Uh, come back down here.

  419. 1:01:59

    So I'm gonna come and, uh, spin this up. So as Carlos mentioned, uh, pnpm dev. This is gonna, uh, spin up that server on [REDACTED:url]. Uh, you should see

  420. 1:02:11

    something that looks like this. Uh, there's a few things that you can just click these. This is sort of like the easy button to get going. Uh, this is the, the GitHub URL.

  421. 1:02:20

    It's, again, it's looking for the, the commits that, uh, have been made since the last release, and it's gonna summarize, uh, again, using the, the prompts that we've configured here, and then start to categorize them.

  422. 1:02:31

    But now the, the, the interesting part of this, if you come back into the Braintrust platform,

  423. 1:02:37

    is if you look at the logs. So this is what just happened on the Braintrust side. Uh, so we sort of have this top level, uh, trace, the generate change log request, and then essentially the, the, the tool calls you can think of as, right?

  424. 1:02:50

    We're getting the commits, we're getting the latest release, we're fetching those commits, we're then loading that prompt. So we're actually loading the prompt from, from Braintrust, and then you can start to...

  425. 1:02:59

    You know, you can click through a lot of these, and as Carlos mentioned, when you use those wrappers, you get all of this sort of goodness out of the box, right?

  426. 1:03:05

    So what are the, the number of prompt tokens? What is the estimated cost? This is, uh, this becomes really helpful as you start to monitor over time, right? Uh, probably not set up yet because we don't have, uh, too much going on, but, like, actually understanding what does that token, uh, amount look like over time?

  427. 1:03:21

    What does the cost look like over time as we change models, uh, and so on. But that's how really easy this is, and maybe just to complete that, that loop, if you come over to the, uh, resour- not the resources, the app generate route.ts, you'll start to see some of this stuff.

  428. 1:03:38

    So I'll just highlight a c- a couple things. We're wrapping this SDK, uh, AI SDK model. So this, again, is, is how we're really getting all of that, that, that metrics and, uh, it's, it's really allowing for us to log a lot of that information with very little lift from, from ourselves as developers.

  429. 1:03:54

    But then you also have the ability to, uh, configure things in a different way. So maybe we have, um, different inputs or different outputs that we want to actually log in a particular span, or actually we wanna log metadata, right?

  430. 1:04:05

    This becomes really powerful when we wanna actually go into those views, right? And we can actually start to filter these things down. We can even filter by that metadata.

  431. 1:04:13

    So, uh, this is where, again, you can y- hit the easy button. We're gonna wrap our, our LLM client with those SDKs, or we can actually get a little bit more detailed and start to log, uh, the, the particular input and output information that we want, metadata, and now we can sort of, uh, set these different things.

  432. 1:04:29

    So if I come out here, uh, I can even create, uh... Actually, when we lo- when we add in the scores here, we can create filters based on those scores.

  433. 1:04:37

    So I wanna create a view that says, "Hey, anytime my completeness score goes below 50%, I wanna create a view for this." This is gonna enable my human reviewers to go in and actually understand that.

  434. 1:04:47

    And then if you look up here in the top right, we can actually add this span to a dataset really easily. So we find this thing, right, that'll actually add a lot of value in that offline eval ki- type of process.

  435. 1:04:57

    Click this. Now we have a net new row in that dataset that now adds a lot of value, right? This is sort of like that, that feedback loop, right?

  436. 1:05:03

    We've, we've done that offline eval type of work. We have, uh, found the right prompt, the right model, all these different things. It's in production. We are logging it.

  437. 1:05:11

    Now we're sort of, um, understanding that in maybe in a human review type of way. Add that span to the dataset. This adds, again, to the, the offline type of portion.

  438. 1:05:20

    Again, you just see this, like, this sort of flywheel effect of creating really powerful gen AI apps.

  439. 1:05:31

    Yes.

  440. 1:05:31

    Is there an eval score, uh, generated for this online log as well? Like, as we run it, is there an eval score created for it? And do we add it to the dataset based on if the eval score is good because we don't want, like, bad examples in the dataset?

  441. 1:05:46

    That's one way of thinking it. You don't need to run an eval as the user's interacting with it. That's what the online scoring does. So once you set up the on- online scoring rule, it'll output a score based on the judge that you've chosen as the, the online scoring rule.

  442. 1:06:04

    Okay.

  443. 1:06:04

    Um, and exactly what you said, right? You could either filter it and select the good responses, add those to a dataset, or vice versa, s- select the bad responses and understand why are they bad, how do I improve them, make them better.

  444. 1:06:21

    Just to complete that and, and kind of, uh, how do we configure this, right? We, we-- Carlos walked through, like, what this would look like. Um, this is, you know, my sc- my rule, right?

  445. 1:06:30

    Obviously, you would call that something a little bit better, but I actually wanna, you know, uh, add in my scores for those online logs, right? Then you would-- You probably wouldn't do 100%, but we're just gonna do that for, for this instance.

  446. 1:06:43

    And now when I come back to, uh, my application here,

  447. 1:06:47

    right, maybe I wanna do, uh... I'm gonna just do a quick refresh.

  448. 1:06:53

    So now when these logs, uh, happen within the Braintrust side, we're actually gonna run those scores against that output. So we'll understand, based on what happened here, how did it score on formatting?

  449. 1:07:02

    How did it score on correctness, um- And then this also, uh, can now layer into-- So you can see here, right, we have a twenty-five percent on the accuracy, on-- a hundred percent on the, um, the completeness.

  450. 1:07:18

    So maybe we have a little bit work to do. But now if I click into this, this is where you can start to now create different things within, uh, the, the, like, the, the view portion here to ensure, like-- So this is a filter.

  451. 1:07:30

    So maybe I wanna change this to anything that is less than, let's say, fifty percent.

  452. 1:07:37

    Now I can save this as a view, and my human reviewers are able to now come in here, open up this view, and look at for, look, look at all of the logs where my, uh, accuracy score is less than fifty percent, and now we can again create that sort of, uh, iterative feedback loop.

  453. 1:08:01

    Any questions on this section? Yeah, maybe a good segue to, uh, the, the human in the loop. Um, this, this becomes really, uh, y-you almost, you almost really...

  454. 1:08:18

    Oh, sorry.

  455. 1:08:20

    Um, I had a question about using Braintrust and implementing it on existing projects. Is it, is it something that's easy to do with, like, a, um,

  456. 1:08:32

    something like LangSmith, you can just add, like, a couple lines, and it'll trace everything for you? Is it the same in Braintrust as it, or do you have to refactor all your prompts to use, like, the Braintrust prompts?

  457. 1:08:44

    No, it's, it's essentially the same thing. So, like, you have-- LangSmith has code to wrap, uh, an LLM client, right? Or it has, uh, decorators to, uh, put on functions.

  458. 1:08:53

    Mm-hmm.

  459. 1:08:53

    It's the exact same thing on the, on the Braintrust side.

  460. 1:08:56

    Got it.

  461. 1:08:57

    Yeah.

  462. 1:08:57

    So then if you do that, is it easy to then use, um, like, create datasets from those logs?

  463. 1:09:04

    Yeah, absolutely. As long as you're, uh... th-the, the logs that you're producing map to the structure of the dataset that you've created, then absolutely. It becomes really just you click that button, we're gonna add that span to the dataset, and it becomes really easy to connect those two things.

  464. 1:09:21

    Mm-hmm. Cool. Thanks.

  465. 1:09:23

    Yeah. Yeah, of course.

  466. 1:09:24

    Yeah, good question.

  467. 1:09:28

    Um, okay, yeah. So let's talk maybe a little bit really quickly about the, the human-

  468. 1:09:31

    Oh, there's a question over here.

  469. 1:09:32

    Oh.

  470. 1:09:33

    Or no.

  471. 1:09:33

    Super, super quick. Uh, with the sampling rate, is there a way to just override that, where if certain inputs are received, you can force that to be included in your sample set?

  472. 1:09:43

    Like, if you have some manual user input, you know, just push that back into the system automatically if it's not hitting your sample rate.

  473. 1:09:51

    The way that you would go about that is changing the span that is targeted. So instead of it applying to the root span, you would specify a span that only happens if a certain criteria is met, right?

  474. 1:10:04

    Okay.

  475. 1:10:04

    So y- then it could be a hundred percent or fifty percent of just when that span appears. Yeah.

  476. 1:10:14

    Okay, so yeah. This is where, uh, we could, we could, uh, bring sort of, like, the human-in-the-loop, uh, type of workflow. This is where we wanna actually maybe bring in subject matter experts.

  477. 1:10:23

    And, and Carlos mentioned, like, uh, product managers, maybe SMEs. We also have doctors coming into the platform and actually evaluating some of this stuff, right? These are the people that actually understand whether or not that output that's created by that large language model is valid, is good, right?

  478. 1:10:37

    And this is, uh, a really powerful thing to have as part of the process to, to building really powerful AI applications. Uh, we can catch hallucinations. Uh, being able to establish that solid foundation or that ground truth is oftentimes, um, you know, having that human-in-the-review, uh, in-the-loop type of person becomes really, uh, beneficial here.

  479. 1:11:00

    Uh, so why does this mattor- matter? Excuse me. Uh, it's, it's really critical for quality and reliability. Uh, like we were just talking about, like, with LLMs and being able to trust whether or not they can do the same thing over and over again.

  480. 1:11:11

    It's non-deterministic. Uh, automations can miss that nuance, right? We wanna be able to sort of apply that, that human type of, um, review to the, the, the things that we're doing on the AI side with LLM, LLM as a judge type scorer.

  481. 1:11:25

    Uh, we also want to, um, help you make sure the final product meets the, the actual expectations of the user, right? So, uh, th-the user is gonna have a much better understanding of how to...

  482. 1:11:37

    or, like, what the, uh, final output should be. So having that person in the loop to look at those outputs, um, becomes really powerful to ensuring that you build really, uh, really strong gen AI applications.

  483. 1:11:51

    Uh, two types of human-in-the-loop. Uh, there is the, uh, the human review. Uh, so this is where these, uh, these people are actually gonna go into the Braintrust platform and actually manually label, score, and audit those interactions that the, uh, that the user had with the, the AI application.

  484. 1:12:08

    And then there's actual feedback from the user real-time. Uh, so this is, like, you know, a thumbs up, thumbs down button within the application saying, "Hey, you did a really good job," "You did a really bad job."

  485. 1:12:18

    But now we can-- Y-you can, like, sort of use these together as well. I can now create a, a view within Braintrust that filters down to any of my user feedbacks of zero, so thumbs down, and actually wanna review whether or not those things are bad.

  486. 1:12:31

    And if they are bad, I can add those to the dataset, again, creating that, that sort of flywheel effect.

  487. 1:12:38

    Um, just really quick here. If, if you go-- If you look at that application, you're able to actually, uh, click one of these, you know, thumbs up or thumbs down, uh, create a comment, "Really good," and then this is now logged back to the Braintrust application.

  488. 1:12:53

    So if you look back at our logs,

  489. 1:12:57

    I'll remove our filter. Uh, so we should have a user feedback score now here of a hundred percent, and then we should have a comment over here as well, "Really good."

  490. 1:13:05

    But then again, these are the things that we can now, if I open this back up, I can create a filter on my user feedback score. Uh, now I wanna understand all of my, uh, my logs where user feedback is one or zero, and then I can do something from there.

  491. 1:13:17

    But this is, this is done very easily via the log feedback function within, within Braintrust. You provide it sort of, like, the, the span that, that was already created within that log, and then you just, you log, uh, you, you provide that user feedback to it.

  492. 1:13:42

    Um, you, you can also enter, uh, really quickly here in the platform, you can enter, uh, human review mode. So this is a way in which, um, i- it's sort of hiding away some of the, the different, uh, you know, some fields that may not be really relevant for those people that are coming in and doing human

  493. 1:13:59

    review. Oh, I haven't actually configured any scores yet, so you can actually see, uh, you would come out here, and you would create different, uh, scores for that human to go in and do that review, whether it's, uh, sort of like an option-based, uh, free form input, uh, slider.

  494. 1:14:16

    So is this, you know, maybe thumbs up, thumbs down, sort of like yes or no, or maybe you could do something a little bit more verbose, um, A, B, C, D, whatever it is.

  495. 1:14:24

    But this is where you, you create these scores. Now they exist as part of those logs. Those humans can go in and now look at the input and the output, give their review of it.

  496. 1:14:33

    Again, adding to, uh, that, that again, like that, that flywheel effect that we need to create.

  497. 1:14:39

    Yeah. I wanted to add there as well, this is really helpful for eval-ing your LLM as a judge. Oftentimes, we see customers use this process to provide some ground truth for their datasets and also for the LLM as a judge, right?

  498. 1:14:55

    So you can imagine having a team of SMEs come in, they review, uh, they do thumbs up, thumbs down on maybe five different, uh, criteria qualities that they're measuring, and then they provide that data to, uh, a playground where the prompt is the LLM as a judge, and they go through the playground, and they test to make

  499. 1:15:16

    sure that the LLM as a judge prompt matches what the humans thought. So just something there to think about. Uh, but as Doug is saying, it's a great feedback loop.

  500. 1:15:24

    It's a great, uh, flywheel effect that can be created when you add this human to, to verify and confirm.

  501. 1:15:34

    Cool. That, that is it for, uh, the, the workshop. We, we do have a few minutes left. Could certainly answer a couple more questions.

  502. 1:15:44

    So, uh, for people who are successful with this, how much time are they spending going backwards and forwards, putting humans in and validating the tests themselves before they get into like more live testing?

  503. 1:15:56

    And then how often are they going back? What's the kind of balance of like time on task?

  504. 1:16:02

    Offline versus online evals, like...

  505. 1:16:05

    Yeah. And how much, and how much you have to do upfront to really get the best results, or can you really just put something down, figure it out later and optimize on the fly?

  506. 1:16:13

    Um, you know, 'cause you don't wanna get stuck in analysis mode for just a bunch of-

  507. 1:16:17

    Right. Yeah, the question, just to repeat it, is how much time do you have to invest upfront to get value? Should you keep going over and over it to try to optimize or better to just start quickly with minimal scores, minimal dataset, and then, uh, keep improving?

  508. 1:16:34

    And I would say the latter, right? You don't want to, to be fixated on creating a golden set-- dataset or 20 scores. Like if you have one or two scores and you have 10 rows in a dataset, it's going to be tremendously helpful.

  509. 1:16:47

    And then from there, it's all about iteration. So just going back and improving, adding some more rows, adding another score, tweaking the scores. But you really just wanna get started quickly.

  510. 1:16:59

    Yeah.

  511. 1:17:00

    Um, so, um, you've mentioned, um, some elements, uh, of this, um, uh, scoring. Uh, that's the, the function that you want to test, that you have to define the, the test steps, if you will.

  512. 1:17:13

    Um, one of the challenges that we are finding is our actual application does change and, uh, it could change bi-weekly. It could change monthly. Is there a way to look at, um, uh, trying to automate changing the actual function that you now need to change to match the way that your application logic has just

  513. 1:17:37

    changed, uh, this week from two weeks ago?

  514. 1:17:41

    Would you say-

  515. 1:17:42

    So-

  516. 1:17:42

    Oh, go for it.

  517. 1:17:44

    Yeah, I guess I was just gonna, again, uh, clarify to, to make sure I understood. So you're saying that the scorer, the, the actual scoring function is going to,

  518. 1:17:55

    uh, stop being useful. It's gonna become obsolete. It's gonna become too old to actually gauge the quality.

  519. 1:18:02

    Not just the scoring function, but the actual steps that you want to, uh, test. So, you know, this week there might be only two turns, just giving a very simple example, and in two weeks in the next sprint, there are now five turns in your app because the logic has changed and now you, you have to update,

  520. 1:18:22

    of course, the, the, I think the function element. There's probably no way around it. I'm just curious about, uh, whether, uh, you guys have, uh, thoughts about how that could be improved or, or made easier.

  521. 1:18:37

    Well, I think your, your task al- will, will always change, right? Right. The thing that we're trying to, to build-

  522. 1:18:43

    Yes

  523. 1:18:43

    ... that's where Braintrust helps because we're gonna understand when we do go make that change.

  524. 1:18:48

    Yes.

  525. 1:18:48

    We actually understand whether or not that change improved our application or regressed it. So like we're not gonna say stop making changes to the underlying-

  526. 1:18:56

    Yes. Yes. No, I'm-- I, I real- I understand that. So it, it is inevitable that the, the application is going to be, uh, changing.

  527. 1:19:05

    Yeah. I-

  528. 1:19:05

    And you're gonna have to constantly update the current-- the, the test, uh, the test that-- the function that you're actually wanting to mimic in your test.

  529. 1:19:15

    It's very similar to traditional software testing.

  530. 1:19:18

    Yeah.

  531. 1:19:18

    You don't wanna write a test that lasts for a day or, you know, a week, right? You want to think of, of robust, uh, tests that will live on for months or years and will actually measure the underlying quality of the application that will be long-lived.

  532. 1:19:37

    So the-- I, I think it's more of how do you optimize the scores to measure qualities that will still be around, even if you add some additional steps in the task.

  533. 1:19:48

    ... than that because unless you have those additional steps in your function, you're not mimicking your, your application's, uh, logic. Y- you're still using the logic from two, you know, last sprint.

  534. 1:20:01

    So no matter how good your scoring could be, it's not, no- it's no longer reflecting what your application is doing this week-

  535. 1:20:08

    Well, I, I think-

  536. 1:20:09

    ... or, or this sprint.

  537. 1:20:09

    I, I think like regardless of like how many steps you have, like there's still an input and there's, there's still an output that we wanna score against.

  538. 1:20:17

    Correct?

  539. 1:20:18

    Uh, y- yes, but, um, I think one of the things you need to do is to first define how you're going to arrive at the score. The, the input comes in, and now maybe you have three turns, and then because you're mimicking your app, and then you get your output from these three turns.

  540. 1:20:38

    Your app just got upgraded. There are now seven or five turns or whatever.

  541. 1:20:43

    Yeah. So the ... When you're writing the evals, you can dynamically call the task. So even as you're working on your application and it's changing-

  542. 1:20:53

    Mm

  543. 1:20:53

    ... you're still pointing to the, the changing app. So the idea is that when you are wanting to merge into main, you open a PR, and then your evals will run on those new changes.

  544. 1:21:07

    You don't need to go in and update the .eval.ts files. They will now reference the updated, uh, task application that you're trying to understand the underlying quality for, if that makes sense.

  545. 1:21:21

    So I think the, the question again is, are the scores, is the underlying logic something that you can trust [laughs] and that will live on? Um, again, it's not easy, and it's something that is changing, uh, but that's, that's what we're hearing from customers is investing in that.

  546. 1:21:38

    Uh, at Braintrust, when you send eval to humans, SMEs, what's the name of that role, and how are you managing that? Like, I'm guessing to some extent it was originally the team, right?

  547. 1:21:53

    But that can't scale, so how are you managing that?

  548. 1:21:58

    I think it's like organization specific. I don't know if there's a, a specific-

  549. 1:22:01

    I'm saying your organization. Using your own tool, how are you managing the SMEs yourself?

  550. 1:22:07

    Hmm. Hmm. I don't think we're using any SMEs at the moment. We don't... We're not a healthcare company or a legal tech company where we heavily rely on specialized knowledge in that degree, you know?

  551. 1:22:22

    Um-

  552. 1:22:22

    But you're not doing human evals of your own product?

  553. 1:22:27

    We just now started, we just now branched into having an AI component to our application. Uh, so we haven't needed to, to go there just yet, but we, you know, we talk to a lot of customers that are working in, in those specific industries with those use cases, and they will sometimes hire external, uh, services that will

  554. 1:22:48

    do the, the, the annotations for them, or they'll bring them into Braintrust and, you know, they'll be using the platform just to, to review, so they have a specific role within Braintrust, and there's a specific view that they would operate in that's just for annotation.

  555. 1:23:05

    Got it.

  556. 1:23:05

    Yeah. Great, yeah. Another question over here.

  557. 1:23:10

    Uh, I just, I was just curious that because we're using out-of-the-box AI models here and are not really fine-tuning the model as the application progresses, are we, do we have a way to like do some few short example prompting from the dataset and the eval scores that we are already using?

  558. 1:23:28

    So is there some feature like that where I can use the datasets or the online logs that are added to the datasets? If the eval score is good, use it as an example for future prompts to just make the prompt better because the models are out of the box.

  559. 1:23:44

    Yeah. So question around few shot prompting, providing examples to the prompt of the ideal response. That's something that you can do today with in the dataset. In the metadata column is where you can provide the, the few shot examples that you want for each row, and then when you're running that eval or messing around in the playground,

  560. 1:24:02

    it'll reference the few shots in the metadata.

  561. 1:24:06

    Got it. But what about like the online testing stuff, right? Or the online logs, whatever you call it. Like when users are actually using the application and it's hitting the prompt, there can the prompt real time use those, uh, examples from the datasets as well?

  562. 1:24:22

    It... Right now it's not, it's not, not something that Braintrust facilitates. Within the SDK and building your own logic, like you could come up with a workflow like this, but natively in the platform, we're not facilitating like live traffic into few shot examples.

  563. 1:24:37

    Got it. Makes sense. Sounds good.

  564. 1:24:42

    Great. Well, thanks everyone. I know we're over time. Really great to have you all here for our first workshop of the day. I hope you can walk away with some ideas of how you can improve your eval workflow and, you know, our team is here.

  565. 1:24:55

    We have a booth, uh, just outside of this, so feel free to stop by. We can answer more questions, have a conversation. Yeah. Thanks everyone. Thank you all. [outro music]