Skip to content
Merged
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
28 changes: 27 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Did you have something else in mind? Reach out on Slack or Discord and let us kn
- Install Docker [→](https://docs.docker.com/get-docker/)
- Install `uv` [→](https://docs.astral.sh/uv/)
- Install Python (3.10+) (e.g. `uv python install 3.10` + )
- Install Node.js (we use v22) and `npm` [→](https://nodejs.org/en)

### Tests

Expand Down Expand Up @@ -159,7 +160,32 @@ cargo test-unit

#### Dashboard

Refer to the instructions in `dashboard/README.md`.
For development, the UI runs against hardcoded fixtures in `ui/fixtures/`.
It depends on a running ClickHouse instance that has been initialized with the TensorZero data model.
We include some fixture data as well in order to exercise some functionality.

It also requires a one-time build of a WebAssembly module from Rust source code that is used to ensure consistent templating of messages across the gateway and UI.

The steps below assume you are in the `ui/` directory.

Here are the steps in order to run or test the UI assuming you have the prerequisites installed and this repository checked out:

1. Install npm dependencies: `npm install --legacy-peer-deps cmdk`
2. Build the WebAssembly module following instructions in `ui/app/utils/minijinja/README.md`.
3. Create a `.env` file and set the following environment variables for the server:

```bash
OPENAI_API_KEY=<your-key>
FIREWORKS_API_KEY=<your-key>
FIREWORKS_ACCOUNT_ID=<your-account-id>
CLICKHOUSE_URL=<your-clickhouse-url> # For testing, set to http://localhost:8123/tensorzero
TENSORZERO_UI_CONFIG_PATH=<path-to-config-file> # For testing, set to ./fixtures/config/tensorzero.toml
```

4. Run the dependencies: `docker compose -f fixtures/docker-compose.yml up`

With the dependencies running, you can run the tests with `npm run test`.
Similarly, you can start a development server with `npm run dev`.

---

Expand Down
31 changes: 30 additions & 1 deletion RELEASE_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ docker buildx create \
--bootstrap
```

Every time you want to build the Docker container, you need to run:
Every time you want to build the Docker container, you need to run from the root of the repository:

```bash
DOCKER_BUILDKIT=1 docker buildx build \
Expand All @@ -50,6 +50,35 @@ DOCKER_BUILDKIT=1 docker buildx build \
> [!IMPORTANT]
> Make sure to replace the `XXXX.XX.X` placeholder with the actual version of the Docker container you are building.

## UI Docker Container

Before building the Docker container for the first time, you need to set up your container builder:

```bash
docker buildx create \
--name container-builder \
--driver docker-container \
--use \
--bootstrap
```

Every time you want to build the Docker container, you need to run from `ui/`:

```bash
DOCKER_BUILDKIT=1 docker buildx build \
--platform linux/amd64,linux/arm64 \
-t tensorzero/ui:latest \
-t tensorzero/ui:XXXX.XX.X \
-f Dockerfile \
--attest type=provenance,mode=max \
--attest type=sbom \
--push \
.
```

> [!IMPORTANT]
> Make sure to replace the `XXXX.XX.X` placeholder with the actual version of the Docker container you are building.

## Documentation

Make sure to merge every PR with the `merge-on-release` label.
Expand Down
2 changes: 1 addition & 1 deletion clients/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "tensorzero"
version = "2025.01.4"
version = "2025.01.5"
description = "The Python client for TensorZero"
readme = "README.md"
requires-python = ">=3.10"
Expand Down
2 changes: 1 addition & 1 deletion clients/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
14 changes: 14 additions & 0 deletions examples/chess-puzzles-best-of-n-sampling/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ services:
depends_on:
clickhouse:
condition: service_healthy
ui:
container_name: tensorzero-ui-chess-puzzles-best-of-n-sampling
image: tensorzero/ui
volumes:
- ./config:/app/config:ro
environment:
- CLICKHOUSE_URL=http://tensorzero-clickhouse-chess-puzzles-best-of-n-sampling:8123/tensorzero
env_file:
- ${ENV_FILE:-.env}
ports:
- "4000:4000"
depends_on:
clickhouse:
condition: service_healthy
2 changes: 2 additions & 0 deletions examples/chess-puzzles-best-of-n-sampling/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# uv pip compile requirements.in -o requirements.txt
anyio==4.6.0
# via httpx
appnope==0.1.4
# via ipykernel
asttokens==2.4.1
# via stack-data
certifi==2024.8.30
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ Here, capital letters represent white pieces and lowercase letters represent bla
The legal moves are:
{%- for move in legal_moves_san %}
- {{ move }}
{%- endfor -%}
{%- endfor %}

What's your next move?
14 changes: 14 additions & 0 deletions examples/chess-puzzles-mixture-of-n-sampling/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,17 @@ services:
depends_on:
clickhouse:
condition: service_healthy
ui:
container_name: tensorzero-ui-chess-puzzles-mixture-of-n-sampling
image: tensorzero/ui
volumes:
- ./config:/app/config:ro
environment:
- CLICKHOUSE_URL=http://tensorzero-chess-puzzles-mixture-of-n-sampling:8123/tensorzero
env_file:
- ${ENV_FILE:-.env}
ports:
- "4000:4000"
depends_on:
clickhouse:
condition: service_healthy
2 changes: 2 additions & 0 deletions examples/chess-puzzles-mixture-of-n-sampling/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# uv pip compile requirements.in -o requirements.txt
anyio==4.6.0
# via httpx
appnope==0.1.4
# via ipykernel
asttokens==2.4.1
# via stack-data
certifi==2024.8.30
Expand Down
14 changes: 14 additions & 0 deletions examples/gsm8k-custom-recipe-dspy/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,17 @@ services:
depends_on:
clickhouse:
condition: service_healthy
ui:
container_name: tensorzero-ui-gsm8k-custom-recipe-dspy
image: tensorzero/ui
volumes:
- ./config:/app/config:ro
environment:
- CLICKHOUSE_URL=http://tensorzero-clickhouse-gsm8k-custom-recipe-dspy:8123/tensorzero
env_file:
- ${ENV_FILE:-.env}
ports:
- "4000:4000"
depends_on:
clickhouse:
condition: service_healthy
1 change: 1 addition & 0 deletions examples/gsm8k-custom-recipe-dspy/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ dspy-ai
ipykernel
notebook
pandas
scipy
tensorzero
tqdm
13 changes: 9 additions & 4 deletions examples/gsm8k-custom-recipe-dspy/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ anyio==4.4.0
# httpx
# jupyter-server
# openai
appnope==0.1.4
# via ipykernel
argon2-cffi==23.1.0
# via jupyter-server
argon2-cffi-bindings==21.2.0
Expand Down Expand Up @@ -87,12 +89,10 @@ frozenlist==1.4.1
# via
# aiohttp
# aiosignal
fsspec[http]==2024.6.1
fsspec==2024.6.1
# via
# datasets
# huggingface-hub
greenlet==3.1.1
# via sqlalchemy
h11==0.14.0
# via httpcore
httpcore==1.0.5
Expand Down Expand Up @@ -136,7 +136,7 @@ json5==0.9.25
# via jupyterlab-server
jsonpointer==3.0.0
# via jsonschema
jsonschema[format-nongpl]==4.23.0
jsonschema==4.23.0
# via
# jupyter-events
# jupyterlab-server
Expand Down Expand Up @@ -224,6 +224,7 @@ numpy==2.1.1
# optuna
# pandas
# pyarrow
# scipy
openai==1.44.0
# via dspy-ai
optuna==4.0.0
Expand Down Expand Up @@ -328,8 +329,12 @@ rpds-py==0.20.0
# via
# jsonschema
# referencing
scipy==1.15.1
# via -r requirements.in
send2trash==1.8.3
# via jupyter-server
setuptools==75.8.0
# via jupyterlab
six==1.16.0
# via
# asttokens
Expand Down
17 changes: 16 additions & 1 deletion examples/haiku-hidden-preferences/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ services:
start_interval: 1s
timeout: 1s
gateway:
container_name: tensorzero-gateway
container_name: tensorzero-gateway-haiku-hidden-preferences
image: tensorzero/gateway
volumes:
- ./config:/app/config:ro
Expand All @@ -38,3 +38,18 @@ services:
depends_on:
clickhouse:
condition: service_healthy

ui:
container_name: tensorzero-ui-haiku-hidden-preferences
image: tensorzero/ui
volumes:
- ./config:/app/config:ro
environment:
- CLICKHOUSE_URL=http://tensorzero-clickhouse-haiku-hidden-preferences:8123/tensorzero
env_file:
- ${ENV_FILE:-.env}
ports:
- "4000:4000"
depends_on:
clickhouse:
condition: service_healthy
4 changes: 2 additions & 2 deletions examples/haiku-hidden-preferences/haiku.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"metadata": {},
"outputs": [],
"source": [
"tensorzero_client = AsyncTensorZeroGateway(\"http://localhost:3000\", timeout=5.0)"
"tensorzero_client = AsyncTensorZeroGateway(\"http://localhost:3000\", timeout=15.0)"
]
},
{
Expand Down Expand Up @@ -110,7 +110,7 @@
" episode_id=haiku_result.episode_id,\n",
" )\n",
" except Exception as e:\n",
" print(e)\n",
" print(f\"Error occurred: {type(e).__name__}: {e}\")\n",
" return None\n",
"\n",
" score = judge_result.output.parsed[\"score\"]\n",
Expand Down
15 changes: 15 additions & 0 deletions examples/ner-dicl/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,18 @@ services:
depends_on:
clickhouse:
condition: service_healthy

ui:
container_name: tensorzero-ui-ner-dicl
image: tensorzero/ui
volumes:
- ./config:/app/config:ro
environment:
- CLICKHOUSE_URL=http://tensorzero-clickhouse-ner-dicl:8123/tensorzero
env_file:
- ${ENV_FILE:-.env}
ports:
- "4000:4000"
depends_on:
clickhouse:
condition: service_healthy
Loading
Loading