Skip to content

braintrustdata/braintrust-sdk-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,299 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Braintrust JavaScript SDKs

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 braintrust SDK package (./js)
  • Integration packages under ./integrations
  • Shared tooling and smoke tests for JavaScript SDK development

Quickstart

Install the main SDK and autoeval scorers:

npm install braintrust autoevals

Create 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],
});

Run it:

BRAINTRUST_API_KEY=<YOUR_API_KEY> npx braintrust eval tutorial.eval.ts

Packages

Package Purpose npm Docs
braintrust Core JavaScript/TypeScript SDK for logging, tracing, evals, and CLI. npm: braintrust js/README.md
@braintrust/browser Browser-focused SDK integration with AsyncLocalStorage polyfill support. npm: @braintrust/browser integrations/browser-js/README.md
@braintrust/langchain-js LangChain.js callback handler integration for automatic Braintrust logging. npm: @braintrust/langchain-js integrations/langchain-js/README.md
@braintrust/openai-agents OpenAI Agents tracing integration for Braintrust. npm: @braintrust/openai-agents integrations/openai-agents-js/README.md
@braintrust/otel OpenTelemetry span processor and compatibility helpers for Braintrust tracing. npm: @braintrust/otel integrations/otel-js/README.md
@braintrust/temporal Temporal client/worker plugin and workflow interceptors for Braintrust tracing. npm: @braintrust/temporal integrations/temporal-js/README.md

Documentation

License

Apache-2.0

Repository History

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.

Contributors

Thanks to everyone who contributed to the Braintrust JavaScript SDK!