Skip to content

braintrustdata/braintrust-sdk-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1,298 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Braintrust Python 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 Python SDKs and integrations, including:

  • The main braintrust SDK package in ./py
  • Integration packages under ./integrations
  • Examples, tests, and local development tooling for Python SDK development

Quickstart

Install the main SDK and scorer package:

pip install braintrust autoevals

Create tutorial_eval.py:

from autoevals import LevenshteinScorer
from braintrust import Eval

Eval(
    "Say Hi Bot",
    data=lambda: [
        {"input": "Foo", "expected": "Hi Foo"},
        {"input": "Bar", "expected": "Hello Bar"},
    ],
    task=lambda input: "Hi " + input,
    scores=[LevenshteinScorer],
)

Run it:

BRAINTRUST_API_KEY=<YOUR_API_KEY> braintrust eval tutorial_eval.py

Packages

Package Purpose PyPI Docs
braintrust Core Python SDK for logging, tracing, evals, and CLI workflows. PyPI - braintrust py/README.md
braintrust-langchain LangChain callback integration for automatic Braintrust logging. PyPI - braintrust-langchain integrations/langchain-py/README.md
braintrust-adk Deprecated Google ADK integration package. New ADK support lives in braintrust. PyPI - braintrust-adk integrations/adk-py/README.md

Documentation

License

Apache-2.0

About

Python Tracing & Evals library for Braintrust

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Languages