PyCon Ireland 2025
- What DSPy is and its building blocks
- How to structure your prompts as Python code
- How to build multi-step pipelines
- How to evaluate and optimize your LLM applications
Groq provides free-tier access. We will be using the Llama 3.1 8B model and the GPT OSS 20B model for the workshop.
- Python 3.12+
- Git
-
Install
uv, a fast Python package and project manager. -
Download the project repository:
git clone https://github.com/Pencroff/dspy_workshop.git
-
Enter the workshop directory:
cd dspy_workshop -
Create a virtual environment and install dependencies:
uv venv --python 3.12 venv
and activate it:
source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install dependencies:
uv pip install -r requirements.txt
-
Open Groq and register for a free account.
-
Open the API Keys page.
-
Click the
Create API Keybutton and save your API key. -
In the pop-up, enter the key name:
dspy_workshopand click theSubmitbutton. -
Copy your API key and save it in a
.envfile.The
.envfile should look like this:GROQ_API_KEY=gsk_YXEdbRF7... # your_api_key
From the workshop directory dspy_workshop, run:
./venv/bin/jupyter labThis will open JupyterLab in your browser.
Open the notebooks/00_setup_check.ipynb notebook and run all cells.
Open a separate terminal and run the MLflow server.
Activate the virtual environment:
source venv/bin/activateRun the MLflow server:
./venv/bin/mlflow server --backend-store-uri sqlite:///data/mlflow.db --port 5005Check the MLflow UI at http://localhost:5005/ or http://127.0.0.1:5005/.
We will use it for the evaluation and optimization notebooks.
- Welcome & Framing - 15 mins (
notebooks/00_setup_check.ipynb) - Setup & First LLM Call - 15 mins (
notebooks/01_first_call.ipynb) - Core Concepts - 15 mins (
notebooks/02_core_concepts.ipynb) - Multi-step Pipeline - 15 mins (
notebooks/03_pipeline.ipynb) - Break - 5 mins
- Evaluation & Metrics - 20 mins (
notebooks/04_evaluation.ipynb) - Optimization Demo - 20 mins (
notebooks/05_optimization_demo.ipynb) - Wrap-up - 5 mins
Twenty synthetic examples of Python snippets with syntax errors and possible logical issues.
Structure of each dataset element:
id: number
name: short description
comment: context of the example and issue
traceback: traceback of the error, usually syntax error
content: snippet of the code
test_case: assert test case, verifies the correctness of the codeBelow are a few providers that have a free tier (might not be the best for optimization):
- Groq
- OpenRouter
- Filter for
:freemodels in their model list
- Filter for
- Google AI Studio
- And many others...
The optimization process might face ratelimits.
- Paper: Syntax and Stack Overflow: A methodology for extracting a corpus of syntax errors and fixes
- Original dataset: Python3_6_Natural_Syntax_Errors_and_Corrections
- Dataframe: pandas
- LiteLLM: litellm
- MLflow: mlflow
- Evaluating and Optimizing LLM Applications with DSPy
- MAGIC of DSPY 3
- DSPy Tutorial | Build AI Agents with Python
- The Evaluator–Optimizer Pattern in DSPy with GEPA






