RAG and Vector Search · Exercise 5 of 5 Previous
Advanced
Daily alerts for the first week
Write alerts(day, baseline_cost) where day is a dict with keys questions, refused, thumbs_down, p95 and dollars, and baseline_cost is the cost per question of day one.
Return a list of strings in this order, including only those that apply: "refusals" when refused / questions > 0.15, "thumbs down" when thumbs_down / questions > 0.10, "latency" when p95 > 6.0, "cost" when dollars / questions > 2 * baseline_cost.
What Check tests
- A normal day has no alerts
- A refusal spike
- A thumbs-down spike
- A slow day
- A cost jump
- Several alerts keep the stated order
Stuck? One hint at a time
The solution unlocks after your first Check. Try first: that is where the learning happens.
main.py
Sign in to run your code.
Output
Press Run to see what your program prints.