From 3580c5b047ef146e1cc1eb129cb3d6d87f814f4e Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 27 Nov 2026 20:13:02 +0000 Subject: [PATCH 1/2] docs: use bt for python eval and function workflows MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > 🤖 **This text was AI-generated.** The Python SDK examples point to its bundled CLI even where the standalone CLI can run the same workflow. Install bt alongside the SDK and run evals with `bt eval eval_tutorial.py` on macOS and Linux. Use `bt functions push` to publish code functions. Keep the Python SDK CLI for native Windows evals and custom reporter exit codes. Co-authored-by: Abhijeet Prasad --- README.md | 13 ++++++++++--- examples/evals/README.md | 14 +++++++++++++- py/README.md | 13 ++++++++++--- py/src/braintrust/__init__.py | 11 +++++++++-- py/src/braintrust/framework.py | 6 +++--- py/src/braintrust/framework2.py | 4 ++-- 6 files changed, 47 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index e0a9cc737..d585e19c0 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ uv add braintrust autoevals pip install braintrust autoevals ``` -Create `tutorial_eval.py`: +Create `eval_tutorial.py`: ```python from autoevals import LevenshteinScorer @@ -39,10 +39,17 @@ Eval( ) ``` -Run it: +On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash -BRAINTRUST_API_KEY= braintrust eval tutorial_eval.py +BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py +``` + +On native Windows, use the Python SDK CLI. If you installed the SDK with `uv add`, prefix the command with `uv run`. + +```powershell +$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" +braintrust eval eval_tutorial.py ``` ## Packages diff --git a/examples/evals/README.md b/examples/evals/README.md index 6ee5e40d4..9291b98a2 100644 --- a/examples/evals/README.md +++ b/examples/evals/README.md @@ -7,8 +7,20 @@ Two minimal `Eval()` examples: ## Run +On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run from this directory: + ```bash -export BRAINTRUST_API_KEY=... +export BRAINTRUST_API_KEY="YOUR_API_KEY" + +uv sync +bt eval simple_eval.py +bt eval eval_example.py +``` + +On native Windows, use the Python SDK CLI: + +```powershell +$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" uv sync uv run braintrust eval simple_eval.py diff --git a/py/README.md b/py/README.md index e87274450..25ed5df5e 100644 --- a/py/README.md +++ b/py/README.md @@ -14,7 +14,7 @@ pip install braintrust ## Quickstart -Run a simple evaluation: +Save this evaluation as `eval_tutorial.py`: ```python from braintrust import Eval @@ -35,10 +35,17 @@ Eval( ) ``` -Then run: +On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash -BRAINTRUST_API_KEY= braintrust eval tutorial_eval.py +BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py +``` + +On native Windows, use the Python SDK CLI: + +```powershell +$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" +braintrust eval eval_tutorial.py ``` ## Optional Extras diff --git a/py/src/braintrust/__init__.py b/py/src/braintrust/__init__.py index 850d8e4bb..58de6ccc8 100644 --- a/py/src/braintrust/__init__.py +++ b/py/src/braintrust/__init__.py @@ -39,10 +39,17 @@ def is_equal(expected, output): ) ``` -Finally, run the script with `braintrust eval eval_hello.py`. +On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash -BRAINTRUST_API_KEY= braintrust eval eval_hello.py +BRAINTRUST_API_KEY="YOUR_BRAINTRUST_API_KEY" bt eval eval_hello.py +``` + +On native Windows, use the Python SDK CLI: + +```powershell +$env:BRAINTRUST_API_KEY = "YOUR_BRAINTRUST_API_KEY" +braintrust eval eval_hello.py ``` ### API Reference diff --git a/py/src/braintrust/framework.py b/py/src/braintrust/framework.py index 08dc33a30..5fb8c3696 100644 --- a/py/src/braintrust/framework.py +++ b/py/src/braintrust/framework.py @@ -339,7 +339,7 @@ class Evaluator(Generic[Input, Output, Expected]): optimal performance, it is recommended to provide asynchronous implementations). You should not create Evaluators directly if you plan to use the Braintrust eval framework. Instead, you should - create them using the `Eval()` method, which will register them so that `braintrust eval ...` can find them. + create them using the `Eval()` method, which will register them so that `bt eval ...` can find them. """ project_name: str @@ -584,7 +584,7 @@ class ReporterDef(SerializableDataClass, Generic[Input, Output, Expected, EvalRe report_run: Callable[[list[EvalReport], bool, bool], bool | Awaitable[bool]] """ A function that takes all evaluator results and returns a boolean indicating whether the run was successful. - If you return false, the `braintrust eval` command will exit with a non-zero status code. + If you return false, the Python SDK's `braintrust eval` command will exit with a non-zero status code. """ async def _call_report_eval( @@ -786,7 +786,7 @@ async def make_empty_summary(): else: if isinstance(reporter, str): raise ValueError( - "Must specify a reporter object, not a name. Can only specify reporter names when running 'braintrust eval'" + "Must specify a reporter object, not a name. Specify reporter names when running an eval from the CLI." ) reporter = reporter or default_reporter diff --git a/py/src/braintrust/framework2.py b/py/src/braintrust/framework2.py index 914ac5c9b..9e646d245 100644 --- a/py/src/braintrust/framework2.py +++ b/py/src/braintrust/framework2.py @@ -647,7 +647,7 @@ def add_parameters(self, parameters: CodeParameters): def publish(self): if _is_lazy_load(): - eprint(f"{bcolors.WARNING}publish() is a no-op when running `braintrust push`.{bcolors.ENDC}") + eprint(f"{bcolors.WARNING}publish() is a no-op when the CLI loads definitions.{bcolors.ENDC}") return login() @@ -656,7 +656,7 @@ def publish(self): definitions: list[dict[str, Any]] = [] if self._publishable_code_functions: eprint( - f"{bcolors.WARNING}Code functions cannot be published directly. Use `braintrust push` instead.{bcolors.ENDC}" + f"{bcolors.WARNING}Code functions cannot be published directly. Use `bt functions push` instead.{bcolors.ENDC}" ) for prompt in self._publishable_prompts: From fd7291725e2aa70c0291a621e92c0c4b2afaabec Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Fri, 27 Nov 2026 20:19:11 +0000 Subject: [PATCH 2/2] docs: remove platform caveats from bt eval examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit > 🤖 **This text was AI-generated.** Present the same `bt eval` quickstart across the SDK docs and examples. Remove the temporary platform-specific alternatives ahead of Windows support. Co-authored-by: Abhijeet Prasad Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- README.md | 9 +-------- examples/evals/README.md | 12 +----------- py/README.md | 9 +-------- py/src/braintrust/__init__.py | 9 +-------- 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index d585e19c0..9b0fbf98b 100644 --- a/README.md +++ b/README.md @@ -39,19 +39,12 @@ Eval( ) ``` -On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: +[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py ``` -On native Windows, use the Python SDK CLI. If you installed the SDK with `uv add`, prefix the command with `uv run`. - -```powershell -$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" -braintrust eval eval_tutorial.py -``` - ## Packages | Package | Purpose | PyPI | Docs | diff --git a/examples/evals/README.md b/examples/evals/README.md index 9291b98a2..64227f118 100644 --- a/examples/evals/README.md +++ b/examples/evals/README.md @@ -7,7 +7,7 @@ Two minimal `Eval()` examples: ## Run -On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run from this directory: +[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run from this directory: ```bash export BRAINTRUST_API_KEY="YOUR_API_KEY" @@ -17,14 +17,4 @@ bt eval simple_eval.py bt eval eval_example.py ``` -On native Windows, use the Python SDK CLI: - -```powershell -$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" - -uv sync -uv run braintrust eval simple_eval.py -uv run braintrust eval eval_example.py -``` - The second example is async, so the scorer prints span info to stdout as the eval runs. diff --git a/py/README.md b/py/README.md index 25ed5df5e..368e6f150 100644 --- a/py/README.md +++ b/py/README.md @@ -35,19 +35,12 @@ Eval( ) ``` -On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: +[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash BRAINTRUST_API_KEY="YOUR_API_KEY" bt eval eval_tutorial.py ``` -On native Windows, use the Python SDK CLI: - -```powershell -$env:BRAINTRUST_API_KEY = "YOUR_API_KEY" -braintrust eval eval_tutorial.py -``` - ## Optional Extras Install extras as needed for specific workflows: diff --git a/py/src/braintrust/__init__.py b/py/src/braintrust/__init__.py index 58de6ccc8..2fc7f362c 100644 --- a/py/src/braintrust/__init__.py +++ b/py/src/braintrust/__init__.py @@ -39,19 +39,12 @@ def is_equal(expected, output): ) ``` -On macOS or Linux, [install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: +[Install the standalone `bt` CLI](https://github.com/braintrustdata/bt#install) and run: ```bash BRAINTRUST_API_KEY="YOUR_BRAINTRUST_API_KEY" bt eval eval_hello.py ``` -On native Windows, use the Python SDK CLI: - -```powershell -$env:BRAINTRUST_API_KEY = "YOUR_BRAINTRUST_API_KEY" -braintrust eval eval_hello.py -``` - ### API Reference """