Autoevals
There are several pre-built scorers available via the open-source autoevals library, which offers standard evaluation methods that you can start using immediately. Autoeval scorers offer a strong starting point for a variety of evaluation tasks. Some autoeval scorers require configuration before they can be used effectively. For example, you might need to define expected outputs or certain parameters for specific tasks. To edit an autoeval scorer, you must copy it first. While autoevals are a great way to get started, you may eventually need to create your own custom scorers for more advanced use cases.Custom scorers
For more specialized evals, you can create custom scorers in TypeScript, Python, or as an LLM-as-a-judge. Code-based scorers (TypeScript/Python) are highly customizable and can return scores based on your exact requirements, while LLM-as-a-judge scorers use prompts to evaluate outputs. You can create custom scorers in TypeScript, Python, or as an LLM-as-a-judge either in the Braintrust UI or via the command line usingbraintrust push. These scorers will be available to use as functions throughout your project.
Create custom scorers via UI
Navigate to Scorers > + Scorer to create custom scorers in the UI.TypeScript and Python scorers
Add your custom code to the TypeScript or Python tabs. Your scorer will run in a sandboxed environment.Scorers created via the UI run with these available packages:
anthropicasyncioautoevalsbraintrustjsonmathopenairerequeststyping

LLM-as-a-judge scorers
In addition to code-based scorers, you can also create LLM-as-a-judge scorers through the UI. Define a prompt that evaluates the AI’s output and maps its choices to specific scores. You can also configure whether to use techniques like chain-of-thought (CoT) reasoning for more complex evaluations.

Create custom scorers via CLI
As with tools, when writing custom scorers in the UI, there may be restrictions on certain imports or functionality, but you can always write your scorers in your own environment and upload them for use in Braintrust viabraintrust push.
This works for both code-based scorers and LLM-as-a-judge scorers.
TypeScript scorers
Both code-based and LLM-as-judge scorers can be written in TypeScript. Write your scorer:scorer.ts
esbuild to bundle your code and its dependencies together. This works for most dependencies, but it does not support native (compiled) libraries like SQLite.
If you have trouble bundling your dependencies, file an issue in the braintrust-sdk repo.
Python scorers
Both code-based and LLM-as-judge scorers can be written in Python.Python scorers created via the CLI run with these default available packages:
autoevalsbraintrustopenaipydanticrequests
--requirements flag with braintrust push.scorer.py
- Scorers must be pushed from within their directory (e.g.
braintrust push scorer.py); pushing a scorer with relative paths (e.g.braintrust push path/to/scorer.py) is unsupported and will result in import errors at runtime. - Scorers using local imports must be defined at the project root.
--requirements flag with braintrust push, for example:
scorer-with-external-dep.py
requirements.txt
--requirements flag:
Use a scorer in the UI
You can use both autoevals and custom scorers in a Braintrust playground. In your playground, navigate to Scorers and select from the list of available scorers. You can also create a new custom scorer from this menu.