Skip to content

Latest commit

History

1,774 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

Braintrust

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

PackagePurposenpmDocs
braintrustCore JavaScript/TypeScript SDK for logging, tracing, evals, and CLI.npm: braintrustjs/README.md
@braintrust/browserBrowser-focused SDK integration with AsyncLocalStorage polyfill support.npm: @braintrust/browserintegrations/browser-js/README.md
@braintrust/langchain-jsDeprecated; use the LangChain integration in braintrust instead.npm: @braintrust/langchain-jsintegrations/langchain-js/README.md
@braintrust/openai-agentsDeprecated; use the OpenAI Agents integration in braintrust instead.npm: @braintrust/openai-agentsintegrations/openai-agents-js/README.md
@braintrust/otelOpenTelemetry span processor and compatibility helpers for Braintrust tracing.npm: @braintrust/otelintegrations/otel-js/README.md
@braintrust/temporalTemporal client/worker plugin and workflow interceptors for Braintrust tracing.npm: @braintrust/temporalintegrations/temporal-js/README.md

CLI bt

The bt cli is installed alongside braintrust, use it with npx bt or pnpm exec bt. See the documentation.

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!

About

JavaScript Tracing & Evals library for Braintrust

Resources

Stars

27 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages