Skip to main content

SDK for integrating Braintrust

Project description

Braintrust Python SDK

PyPI version

The official Python SDK for logging, tracing, and evaluating AI applications with Braintrust.

Installation

Install the SDK:

pip install braintrust

Quickstart

Run a simple evaluation:

from braintrust import Eval


def is_equal(expected, output):
    return expected == output


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

Then run:

BRAINTRUST_API_KEY=<YOUR_API_KEY> braintrust eval tutorial_eval.py

Optional Extras

Install extras as needed for specific workflows:

pip install "braintrust[cli]"
pip install "braintrust[openai-agents]"
pip install "braintrust[otel]"
pip install "braintrust[temporal]"
pip install "braintrust[all]"

Available extras:

  • performance: installs orjson for faster JSON serialization
  • cli: installs optional dependencies used by the Braintrust CLI
  • openai-agents: installs OpenAI Agents integration support
  • otel: installs OpenTelemetry integration dependencies
  • temporal: installs Temporal integration dependencies
  • all: installs all optional extras

Documentation

License

Apache-2.0

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

braintrust-0.25.0.tar.gz (660.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

braintrust-0.25.0-py3-none-any.whl (772.3 kB view details)

Uploaded Python 3

File details

Details for the file braintrust-0.25.0.tar.gz.

File metadata

  • Download URL: braintrust-0.25.0.tar.gz
  • Upload date:
  • Size: 660.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for braintrust-0.25.0.tar.gz
Algorithm Hash digest
SHA256 f650df16022a2b45345da1640e07df6584a5725cceb6f341d3eab1ee1cfdec96
MD5 e206fa536da92d784d6babd9d9f4bc7b
BLAKE2b-256 8e6d13582cd0e3d8c20819d1739f6c50428518954cbe65077ccaf847d809d5b4

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.25.0.tar.gz:

Publisher: publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file braintrust-0.25.0-py3-none-any.whl.

File metadata

  • Download URL: braintrust-0.25.0-py3-none-any.whl
  • Upload date:
  • Size: 772.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for braintrust-0.25.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c6de86bf6f40c416af259f9b857fba46b5bbc8ae7a0a1bb8f60214ad40005fb
MD5 84968dcbc7b6949db57bcee9f4f97f79
BLAKE2b-256 496c967cfb1d7b7c39e01a3860d37c6a236105890b0899bd3cd7393d0065dff7

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.25.0-py3-none-any.whl:

Publisher: publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page