SDK for integrating Braintrust
Project description
Braintrust Python SDK
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: installsorjsonfor faster JSON serializationcli: installs optional dependencies used by the Braintrust CLIopenai-agents: installs OpenAI Agents integration supportotel: installs OpenTelemetry integration dependenciestemporal: installs Temporal integration dependenciesall: installs all optional extras
Documentation
- Python SDK docs: https://www.braintrust.dev/docs/reference/sdks/python
- Braintrust docs: https://www.braintrust.dev/docs
- Repo publishing guide: https://github.com/braintrustdata/braintrust-sdk-python/blob/main/docs/publishing.md
- Source code: https://github.com/braintrustdata/braintrust-sdk-python/tree/main/py
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file braintrust-0.14.0.tar.gz.
File metadata
- Download URL: braintrust-0.14.0.tar.gz
- Upload date:
- Size: 492.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4631cb26cc4b2be78c310716f33b56cf3f963a0ac746a67d2b0dd6239021f12d
|
|
| MD5 |
02ae8fed30f649bd5d4c4ae6f6ed4547
|
|
| BLAKE2b-256 |
5169b1efdf4dd959d9a1799ee3ffed5efdbb04b07a86b45c0548d6ce91f278f1
|
Provenance
The following attestation bundles were made for braintrust-0.14.0.tar.gz:
Publisher:
publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
braintrust-0.14.0.tar.gz -
Subject digest:
4631cb26cc4b2be78c310716f33b56cf3f963a0ac746a67d2b0dd6239021f12d - Sigstore transparency entry: 1272170169
- Sigstore integration time:
-
Permalink:
braintrustdata/braintrust-sdk-python@3b34248d528d3f2d4783235c9ee871c0318f481b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/braintrustdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py-sdk.yaml@3b34248d528d3f2d4783235c9ee871c0318f481b -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file braintrust-0.14.0-py3-none-any.whl.
File metadata
- Download URL: braintrust-0.14.0-py3-none-any.whl
- Upload date:
- Size: 572.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1451f0de4eef104d585b968e83e5c773b6daf610f0d4d2c6b2c0cb67bea5735e
|
|
| MD5 |
ecd1346067bf114dc0d65b27660c0ad2
|
|
| BLAKE2b-256 |
353ff702bdd22eb364e013340af2e8b5ac4b4b2f74af183a6a2595a28db79c49
|
Provenance
The following attestation bundles were made for braintrust-0.14.0-py3-none-any.whl:
Publisher:
publish-py-sdk.yaml on braintrustdata/braintrust-sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
braintrust-0.14.0-py3-none-any.whl -
Subject digest:
1451f0de4eef104d585b968e83e5c773b6daf610f0d4d2c6b2c0cb67bea5735e - Sigstore transparency entry: 1272170306
- Sigstore integration time:
-
Permalink:
braintrustdata/braintrust-sdk-python@3b34248d528d3f2d4783235c9ee871c0318f481b -
Branch / Tag:
refs/heads/main - Owner: https://github.com/braintrustdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py-sdk.yaml@3b34248d528d3f2d4783235c9ee871c0318f481b -
Trigger Event:
workflow_dispatch
-
Statement type: