Skip to content

Commit 0cb93c9

Browse files
docs: use bt for python eval and function workflows (#1199)
## Summary Ahead of deprecating the Python SDK CLI, teach Python users the standalone [`bt`](https://github.com/braintrustdata/bt) CLI wherever it has parity. - `README.md`, `py/README.md`, `examples/evals/README.md`, `braintrust/__init__.py` docstring: install `bt` separately (still `pip install braintrust`, since bt's runner imports the SDK) and run `bt eval ...` on macOS/Linux. - User-facing hints in `framework.py` / `framework2.py`: `braintrust eval` → `bt eval`, `braintrust push` → `bt functions push`. No CLI implementation or deprecation warnings changed. **Left on the Python CLI:** native Windows evals (`bt eval` is Unix-only today), remote `Eval()` sandbox registration, AWS CloudFormation `braintrust install ...`. Link to Devin session: https://braintrust.devinenterprise.com/sessions/d799f1f664d04d3483da9ab700ea7bc2 Open in Devin Desktop: https://braintrust.devinenterprise.com/desktop/session/d799f1f664d04d3483da9ab700ea7bc2?variant=devin --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Abhijeet Prasad <abhijeet@braintrustdata.com>
1 parent 7fd4377 commit 0cb93c9

6 files changed

Lines changed: 18 additions & 16 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ uv add braintrust autoevals
2222
pip install braintrust autoevals
2323
```
2424

25-
Create `tutorial_eval.py`:
25+
Create `eval_tutorial.py`:
2626

2727
```python
2828
from autoevals import LevenshteinScorer
@@ -39,10 +39,10 @@ Eval(
3939
)
4040
```
4141

42-
Run it:
42+
[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run:
4343

4444
```bash
45-
BRAINTRUST_API_KEY=<YOUR_API_KEY> braintrust eval tutorial_eval.py
45+
BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py
4646
```
4747

4848
## Packages

‎examples/evals/README.md‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ Two minimal `Eval()` examples:
77

88
## Run
99

10+
[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run from this directory:
11+
1012
```bash
11-
export BRAINTRUST_API_KEY=...
13+
export BRAINTRUST_API_KEY="YOUR_API_KEY"
1214

1315
uv sync
14-
uv run braintrust eval simple_eval.py
15-
uv run braintrust eval eval_example.py
16+
bt eval simple_eval.py
17+
bt eval eval_example.py
1618
```
1719

1820
The second example is async, so the scorer prints span info to stdout as the eval runs.

‎py/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ pip install braintrust
1414

1515
## Quickstart
1616

17-
Run a simple evaluation:
17+
Save this evaluation as `eval_tutorial.py`:
1818

1919
```python
2020
from braintrust import Eval
@@ -35,10 +35,10 @@ Eval(
3535
)
3636
```
3737

38-
Then run:
38+
[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run:
3939

4040
```bash
41-
BRAINTRUST_API_KEY=<YOUR_API_KEY> braintrust eval tutorial_eval.py
41+
BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py
4242
```
4343

4444
## Optional Extras

‎py/src/braintrust/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ def is_equal(expected, output):
3939
)
4040
```
4141
42-
Finally, run the script with `braintrust eval eval_hello.py`.
42+
[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run:
4343
4444
```bash
45-
BRAINTRUST_API_KEY=<YOUR_BRAINTRUST_API_KEY> braintrust eval eval_hello.py
45+
BRAINTRUST_API_KEY="YOUR_BRAINTRUST_API_KEY" bt eval eval_hello.py
4646
```
4747
4848
### API Reference

‎py/src/braintrust/framework.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class Evaluator(Generic[Input, Output, Expected]):
339339
optimal performance, it is recommended to provide asynchronous implementations).
340340
341341
You should not create Evaluators directly if you plan to use the Braintrust eval framework. Instead, you should
342-
create them using the `Eval()` method, which will register them so that `braintrust eval ...` can find them.
342+
create them using the `Eval()` method, which will register them so that `bt eval ...` can find them.
343343
"""
344344

345345
project_name: str
@@ -584,7 +584,7 @@ class ReporterDef(SerializableDataClass, Generic[Input, Output, Expected, EvalRe
584584
report_run: Callable[[list[EvalReport], bool, bool], bool | Awaitable[bool]]
585585
"""
586586
A function that takes all evaluator results and returns a boolean indicating whether the run was successful.
587-
If you return false, the `braintrust eval` command will exit with a non-zero status code.
587+
If you return false, the Python SDK's `braintrust eval` command will exit with a non-zero status code.
588588
"""
589589

590590
async def _call_report_eval(
@@ -786,7 +786,7 @@ async def make_empty_summary():
786786
else:
787787
if isinstance(reporter, str):
788788
raise ValueError(
789-
"Must specify a reporter object, not a name. Can only specify reporter names when running 'braintrust eval'"
789+
"Must specify a reporter object, not a name. Specify reporter names when running an eval from the CLI."
790790
)
791791

792792
reporter = reporter or default_reporter

‎py/src/braintrust/framework2.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ def add_parameters(self, parameters: CodeParameters):
647647

648648
def publish(self):
649649
if _is_lazy_load():
650-
eprint(f"{bcolors.WARNING}publish() is a no-op when running `braintrust push`.{bcolors.ENDC}")
650+
eprint(f"{bcolors.WARNING}publish() is a no-op when the CLI loads definitions.{bcolors.ENDC}")
651651
return
652652

653653
login()
@@ -656,7 +656,7 @@ def publish(self):
656656
definitions: list[dict[str, Any]] = []
657657
if self._publishable_code_functions:
658658
eprint(
659-
f"{bcolors.WARNING}Code functions cannot be published directly. Use `braintrust push` instead.{bcolors.ENDC}"
659+
f"{bcolors.WARNING}Code functions cannot be published directly. Use `bt functions push` instead.{bcolors.ENDC}"
660660
)
661661

662662
for prompt in self._publishable_prompts:

0 commit comments

Comments
 (0)