Guide: Metrics & Feedback
This directory contains the code for the Metrics & Feedback guide.
Running the Example
- Set the
OPENAI_API_KEYenvironment variable:
export OPENAI_API_KEY="sk-..." # Replace with your OpenAI API key
- Launch the TensorZero Gateway, the TensorZero UI, and a local Postgres database:
docker compose up
- Run the example:
Python
a. Install the Python dependencies. We recommend using uv:
uv sync
b. Run the example:
uv run main.py
HTTP
curl -X POST http://localhost:3000/feedback \
-H "Content-Type: application/json" \
-d '{
"metric_name": "haiku_rating",
"inference_id": "00000000-0000-0000-0000-000000000000",
"value": true
}';