Example: Dynamic In-Context Learning (DICL)
This example shows how to use the dynamic in-context learning (DICL) optimization workflow to improve the performance of a variant.
For this example, we'll tackle a SMS spam classification task based on the SMS spam dataset.
In the dicl.ipynb Jupyter notebook, we will:
- Load the spam dataset
- Convert it to the TensorZero format
- Store the converted datapoints in TensorZero
- Query the stored datapoints back
- Launch the DICL optimization workflow
- Compare the baseline and the DICL variants
The variant optimized with DICL materially outperforms the baseline variant.
Setup
- Set the
OPENAI_API_KEYenvironment variable. - Install the Python dependencies. We recommend using
uv:
uv sync
- Launch TensorZero:
docker compose up