Exercise 3 of 10 · 0 passed
System Prompt Design
A system prompt sets the model's role and constraints for the whole conversation. It's the difference between "maybe it classifies correctly" and "it always does."
A good system prompt:
- Defines the role clearly
- Lists exactly what's allowed
- Specifies output format with no room for improvisation
Why care? In Python you wouldn't eval() arbitrary strings. A tight system prompt is your API contract with the model — nail it once, trust it everywhere.
Task
SYSTEM_PROMPT is currently vague. Rewrite it so classify_with_role consistently returns exactly one category name from CATEGORIES and nothing else.
The function body is already correct — only fix the system prompt constant.
Click "Run tests". First time loads Python in your browser (~5s). After that, runs are instant on this page and ~1s on the others.
Loading tests…
Pass the tests to reveal the reference solution.
The point of the exercise is the struggle, not the answer. Once your tests are green, the reference solution unlocks here so you can compare patterns.
Loading solution…
That's the warm-up.
You ran ten exercises against a mocked SDK. The cohort builds the real thing: an AI agent shipped to production with 150+ passing tests, Telegram bot, FastAPI, Streamlit, Docker. Six weeks. Every PR reviewed.