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.17.0.tar.gz (569.9 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.17.0-py3-none-any.whl (663.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for braintrust-0.17.0.tar.gz
Algorithm Hash digest
SHA256 49631b1185d7edd646639d0ba5443e56c1371b085873cbddcd2e9a45dfe4a62b
MD5 024c81c5c85d4a4624e16fcaed9975f4
BLAKE2b-256 f220f57a1035a129eabb756827378fd71056c07e72ac24b164e886e0d99dc21f

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.17.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.17.0-py3-none-any.whl.

File metadata

  • Download URL: braintrust-0.17.0-py3-none-any.whl
  • Upload date:
  • Size: 663.5 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.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6bf0411a507a87b331742018b840e8d89b0d4373047f74e5ca6423084d9c1577
MD5 aa0d1a8044403db8872cd6b8470cbe4e
BLAKE2b-256 b76d8a71d190fcc7665e12172224f4d7d7b368c94a13a94d74ebf228efd1f1b2

See more details on using hashes here.

Provenance

The following attestation bundles were made for braintrust-0.17.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