SDK for integrating Braintrust
Project description
Braintrust
A Python library for logging data to Braintrust. braintrust is distributed as
a library on PyPI. It is open source and
available on GitHub.
Quickstart
Install the library with pip.
pip install braintrust
Performance tip: For 3-5x faster JSON serialization, install with the optional performance extra:
pip install braintrust[performance]
Or install orjson separately:
pip install orjson
The SDK automatically detects and uses orjson if available, with seamless fallback to standard json. See ORJSON_OPTIMIZATION.md for details.
Then, run a simple experiment with the following code (replace YOUR_API_KEY with
your Braintrust API key):
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",
},
], # Replace with your eval dataset
task=lambda input: "Hi " + input, # Replace with your LLM call
scores=[is_equal],
)
Performance Optimization
For 3-5x faster JSON serialization, install orjson. The SDK automatically detects and uses orjson if available, with seamless fallback to standard json.
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.5.5.tar.gz.
File metadata
- Download URL: braintrust-0.5.5.tar.gz
- Upload date:
- Size: 331.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dc2bc5d58bccf846d179a860eb26acce0244b00cdcf2fbbeef19be46c52710e
|
|
| MD5 |
3a9801252c89481a4eade34ec8a361c6
|
|
| BLAKE2b-256 |
20b265c5f9dbacc6c9e8ba34d531d4e144587abaca9e014a892c3fcf972dd0f7
|
Provenance
The following attestation bundles were made for braintrust-0.5.5.tar.gz:
Publisher:
publish-py-sdk.yaml on braintrustdata/braintrust-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
braintrust-0.5.5.tar.gz -
Subject digest:
8dc2bc5d58bccf846d179a860eb26acce0244b00cdcf2fbbeef19be46c52710e - Sigstore transparency entry: 920749211
- Sigstore integration time:
-
Permalink:
braintrustdata/braintrust-sdk@a88b44d6852fae824705415d2795f5c5201f2dde -
Branch / Tag:
refs/tags/py-sdk-v0.5.5 - Owner: https://github.com/braintrustdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py-sdk.yaml@a88b44d6852fae824705415d2795f5c5201f2dde -
Trigger Event:
push
-
Statement type:
File details
Details for the file braintrust-0.5.5-py3-none-any.whl.
File metadata
- Download URL: braintrust-0.5.5-py3-none-any.whl
- Upload date:
- Size: 384.0 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 |
9efd7ff0d5c963c6426c64a26befc7d3e2249df19321658c07e85a906d3322da
|
|
| MD5 |
5128ea21d2a0ae074d70cb6335fe76ba
|
|
| BLAKE2b-256 |
7ff96107b08fc075a4c198a8661f3f617e4a5ebeae630bdf64c63a00c355a359
|
Provenance
The following attestation bundles were made for braintrust-0.5.5-py3-none-any.whl:
Publisher:
publish-py-sdk.yaml on braintrustdata/braintrust-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
braintrust-0.5.5-py3-none-any.whl -
Subject digest:
9efd7ff0d5c963c6426c64a26befc7d3e2249df19321658c07e85a906d3322da - Sigstore transparency entry: 920749312
- Sigstore integration time:
-
Permalink:
braintrustdata/braintrust-sdk@a88b44d6852fae824705415d2795f5c5201f2dde -
Branch / Tag:
refs/tags/py-sdk-v0.5.5 - Owner: https://github.com/braintrustdata
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-py-sdk.yaml@a88b44d6852fae824705415d2795f5c5201f2dde -
Trigger Event:
push
-
Statement type: