Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion py/src/braintrust/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
BraintrustTransportError,
BraintrustTransportRetryExhaustedError,
)
from .experiments import ExperimentsAPI
from .experiments import (
BaseExperiment,
ExperimentComparison,
ExperimentMetric,
ExperimentRecord,
ExperimentsAPI,
ExperimentScore,
)
from .functions import FunctionsAPI
from .policies import RetryMode, RetryPolicy
from .projects import ProjectsAPI
Expand All @@ -25,6 +32,7 @@
__all__ = [
"AttachmentsAPI",
"AuthAPI",
"BaseExperiment",
"BraintrustAPIError",
"BraintrustClient",
"BraintrustHTTPError",
Expand All @@ -35,6 +43,10 @@
"ClientContext",
"DatasetsAPI",
"EndpointRouter",
"ExperimentComparison",
"ExperimentMetric",
"ExperimentRecord",
"ExperimentScore",
"ExperimentsAPI",
"FunctionsAPI",
"LoginResult",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
interactions:
- request:
body: null
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '0'
User-Agent:
- python-requests/2.34.2
method: POST
uri: https://www.braintrust.dev/api/apikey/login
response:
body:
string: '{"org_info":[{"id":"5abfae3a-7aa7-4653-a9c8-b3efcb18f584","name":"Braintrust
SDKs","api_url":"https://api.braintrust.dev","git_metadata":{"collect":"some","fields":["commit","branch","tag","dirty","author_name","author_email","commit_message","commit_time"]},"is_universal_api":null,"proxy_url":"https://api.braintrust.dev","realtime_url":"wss://realtime.braintrustapi.com"}]}'
headers:
Access-Control-Allow-Credentials:
- 'true'
Access-Control-Allow-Headers:
- X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5,
Content-Type, Date, X-Api-Version
Access-Control-Allow-Methods:
- GET,OPTIONS,PATCH,DELETE,POST,PUT
Access-Control-Allow-Origin:
- '*'
Cache-Control:
- public, max-age=0, must-revalidate
Content-Length:
- '376'
Content-Security-Policy:
- 'script-src ''self'' ''unsafe-eval'' ''wasm-unsafe-eval'' ''strict-dynamic''
''nonce-ZTAyYmVhODEtNDU1Mi00ZTAzLWIxMTYtMDIyNmY3MTU1ZDY0'' *.js.stripe.com
js.stripe.com maps.googleapis.com ; style-src ''self'' ''unsafe-inline'' *.braintrust.dev
btcm6qilbbhv4yi1.public.blob.vercel-storage.com fonts.googleapis.com www.gstatic.com
d4tuoctqmanu0.cloudfront.net; font-src ''self'' data: fonts.gstatic.com btcm6qilbbhv4yi1.public.blob.vercel-storage.com
cdn.jsdelivr.net d4tuoctqmanu0.cloudfront.net fonts.googleapis.com mintlify-assets.b-cdn.net
fonts.cdnfonts.com; object-src ''none''; base-uri ''self''; form-action ''self''
https://www.facebook.com; frame-ancestors ''self''; worker-src ''self'' blob:;
report-uri https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16;
report-to csp-endpoint-0'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 12 Aug 2026 15:17:38 GMT
Etag:
- '"13vsc5ye8flag"'
Reporting-Endpoints:
- csp-endpoint-0="https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16"
Server:
- Vercel
Strict-Transport-Security:
- max-age=63072000
X-Bt-Was-Udf-Cached:
- 'true'
X-Clerk-Auth-Message:
- Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid,
token-carrier=header)
X-Clerk-Auth-Reason:
- token-invalid
X-Clerk-Auth-Status:
- signed-out
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-Matched-Path:
- /api/apikey/login
X-Nonce:
- ZTAyYmVhODEtNDU1Mi00ZTAzLWIxMTYtMDIyNmY3MTU1ZDY0
X-Vercel-Cache:
- MISS
X-Vercel-Id:
- yul1::iad1::vrzs6-1786547858136-19160ee5c180
status:
code: 200
message: OK
- request:
body: '{"project_name": "python-sdk-api-experiment-service-fresh-vcr", "project_id":
null, "org_id": "5abfae3a-7aa7-4653-a9c8-b3efcb18f584", "update": true, "experiment_name":
"fresh-experiment-without-base", "repo_info": {"commit": null, "branch": null,
"tag": null, "dirty": null, "author_name": null, "author_email": null, "commit_message":
null, "commit_time": null, "git_diff": null}, "public": false}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '399'
Content-Type:
- application/json
User-Agent:
- python-requests/2.34.2
method: POST
uri: https://www.braintrust.dev/api/experiment/register
response:
body:
string: '{"project":{"id":"eb1d7d8e-9088-4937-9543-58f894306ac7","org_id":"5abfae3a-7aa7-4653-a9c8-b3efcb18f584","name":"python-sdk-api-experiment-service-fresh-vcr","description":null,"created":"2026-08-12T15:14:54.955Z","deleted_at":null,"user_id":"c1f71e19-b3ce-4f59-89a9-055901f7755b","settings":null},"experiment":{"id":"cbe48deb-473d-498f-af94-facb1c90ac68","project_id":"eb1d7d8e-9088-4937-9543-58f894306ac7","name":"fresh-experiment-without-base","description":null,"created":"2026-08-12T15:14:54.955Z","repo_info":{},"commit":"abc202c350c7f6f4d6b85e128c9bb3a1013517a8","base_exp_id":null,"deleted_at":null,"dataset_id":null,"dataset_version":null,"internal_metadata":null,"parameters_id":null,"parameters_version":null,"public":false,"user_id":"c1f71e19-b3ce-4f59-89a9-055901f7755b","metadata":null,"tags":null}}'
headers:
Cache-Control:
- public, max-age=0, must-revalidate
Content-Security-Policy:
- 'script-src ''self'' ''unsafe-eval'' ''wasm-unsafe-eval'' ''strict-dynamic''
''nonce-OTA2ZDgxMjMtZTVhNC00NmMzLWFlYTAtYzkyYmMyYWVkYWI1'' *.js.stripe.com
js.stripe.com maps.googleapis.com ; style-src ''self'' ''unsafe-inline'' *.braintrust.dev
btcm6qilbbhv4yi1.public.blob.vercel-storage.com fonts.googleapis.com www.gstatic.com
d4tuoctqmanu0.cloudfront.net; font-src ''self'' data: fonts.gstatic.com btcm6qilbbhv4yi1.public.blob.vercel-storage.com
cdn.jsdelivr.net d4tuoctqmanu0.cloudfront.net fonts.googleapis.com mintlify-assets.b-cdn.net
fonts.cdnfonts.com; object-src ''none''; base-uri ''self''; form-action ''self''
https://www.facebook.com; frame-ancestors ''self''; worker-src ''self'' blob:;
report-uri https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16;
report-to csp-endpoint-0'
Content-Type:
- application/json; charset=utf-8
Date:
- Wed, 12 Aug 2026 15:17:38 GMT
Etag:
- W/"12h4qcgnnqaz7"
Reporting-Endpoints:
- csp-endpoint-0="https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16"
Server:
- Vercel
Strict-Transport-Security:
- max-age=63072000
Transfer-Encoding:
- chunked
X-Clerk-Auth-Message:
- Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid,
token-carrier=header)
X-Clerk-Auth-Reason:
- token-invalid
X-Clerk-Auth-Status:
- signed-out
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-Matched-Path:
- /api/experiment/register
X-Nonce:
- OTA2ZDgxMjMtZTVhNC00NmMzLWFlYTAtYzkyYmMyYWVkYWI1
X-Vercel-Cache:
- MISS
X-Vercel-Id:
- yul1::iad1::v8n4z-1786547858299-2a4f4df48f96
content-length:
- '1267'
status:
code: 200
message: OK
- request:
body: '{"id": "cbe48deb-473d-498f-af94-facb1c90ac68"}'
headers:
Accept:
- '*/*'
Accept-Encoding:
- gzip, deflate, zstd
Connection:
- keep-alive
Content-Length:
- '46'
Content-Type:
- application/json
User-Agent:
- python-requests/2.34.2
method: POST
uri: https://www.braintrust.dev/api/base_experiment/get_id
response:
body:
string: Missing read access to experiment id cbe48deb-473d-498f-af94-facb1c90ac68,
or the experiment does not exist [user_email=redacted] [user_org=Braintrust
SDKs] [timestamp=1786547858.705] [request_id=yul1::xm6c7-1786547858606-847e928224d9]
headers:
Cache-Control:
- public, max-age=0, must-revalidate
Content-Length:
- '254'
Content-Security-Policy:
- 'script-src ''self'' ''unsafe-eval'' ''wasm-unsafe-eval'' ''strict-dynamic''
''nonce-NDJiYjMwOTItYmI0Zi00NTBjLWI3MGItMjg5YTM4ZWVlY2Fm'' *.js.stripe.com
js.stripe.com maps.googleapis.com ; style-src ''self'' ''unsafe-inline'' *.braintrust.dev
btcm6qilbbhv4yi1.public.blob.vercel-storage.com fonts.googleapis.com www.gstatic.com
d4tuoctqmanu0.cloudfront.net; font-src ''self'' data: fonts.gstatic.com btcm6qilbbhv4yi1.public.blob.vercel-storage.com
cdn.jsdelivr.net d4tuoctqmanu0.cloudfront.net fonts.googleapis.com mintlify-assets.b-cdn.net
fonts.cdnfonts.com; object-src ''none''; base-uri ''self''; form-action ''self''
https://www.facebook.com; frame-ancestors ''self''; worker-src ''self'' blob:;
report-uri https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16;
report-to csp-endpoint-0'
Content-Type:
- text/plain; charset=utf-8
Date:
- Wed, 12 Aug 2026 15:17:38 GMT
Etag:
- '"slqvuufn5l72"'
Reporting-Endpoints:
- csp-endpoint-0="https://o4507221741076480.ingest.us.sentry.io/api/4507221754380288/security/?sentry_key=27fa5ac907cf7c6ce4a1ab2a03f805b4&sentry_environment=production&sentry_release=16"
Server:
- Vercel
Strict-Transport-Security:
- max-age=63072000
X-Clerk-Auth-Message:
- Invalid JWT form. A JWT consists of three parts separated by dots. (reason=token-invalid,
token-carrier=header)
X-Clerk-Auth-Reason:
- token-invalid
X-Clerk-Auth-Status:
- signed-out
X-Content-Type-Options:
- nosniff
X-Frame-Options:
- SAMEORIGIN
X-Matched-Path:
- /api/base_experiment/get_id
X-Nonce:
- NDJiYjMwOTItYmI0Zi00NTBjLWI3MGItMjg5YTM4ZWVlY2Fm
X-Vercel-Cache:
- MISS
X-Vercel-Id:
- yul1::iad1::xm6c7-1786547858606-847e928224d9
status:
code: 400
message: Bad Request
version: 1
Loading