Braintrust is a platform for evaluating and shipping AI products. Learn more at braintrust.dev and in the docs.
This repository contains Braintrust's JavaScript/TypeScript SDKs and integrations, including:
- The main
braintrustSDK package (./js) - Integration packages under
./integrations - Shared tooling and smoke tests for JavaScript SDK development
Install the main SDK and autoeval scorers:
npm install braintrust autoevalsCreate tutorial.eval.ts:
import { Eval } from "braintrust";
import { LevenshteinScorer } from "autoevals";
Eval("Say Hi Bot", {
data: () => [
{ input: "Foo", expected: "Hi Foo" },
{ input: "Bar", expected: "Hello Bar" },
],
task: (input) => "Hi " + input,
scores: [LevenshteinScorer],
});Install the bt CLI separately using the standalone installation instructions in the CLI quickstart, then run it:
BRAINTRUST_API_KEY=<YOUR_API_KEY> bt eval tutorial.eval.ts| Package | Purpose | npm | Docs |
|---|---|---|---|
braintrust |
Core JavaScript/TypeScript SDK for logging, tracing, and evals. | js/README.md | |
@braintrust/browser |
Browser-focused SDK integration with AsyncLocalStorage polyfill support. | integrations/browser-js/README.md | |
@braintrust/otel |
OpenTelemetry span processor and compatibility helpers for Braintrust tracing. | integrations/otel-js/README.md | |
@braintrust/temporal |
Temporal client/worker plugin and workflow interceptors for Braintrust tracing. | integrations/temporal-js/README.md |
The bt CLI is installed separately from braintrust.
See the standalone installation instructions in the CLI quickstart.
- Publishing packages: PUBLISHING.md
- TypeScript SDK docs: https://docs.braintrust.dev/sdks/typescript/versions/latest
- Release notes: https://docs.braintrust.dev/changelog
Apache-2.0
This repository was previously named braintrust-sdk and was renamed to braintrust-sdk-javascript. The rename happened when Python SDK code was split out of this repository. The Python code now lives in a dedicated Braintrust Python SDK repository.
Thanks to everyone who contributed to the Braintrust JavaScript SDK!