Advanced
Route cheap first, escalate when unsure
small(question) and large(question) each return a tuple (answer, confidence). Write route(question, small, large, threshold) that calls small first. If its confidence is at least threshold return (answer, "small").
Otherwise call large and return (answer, "large"). If large is called, the small answer is thrown away. Do not call large when you do not need it.
What Check tests
- A confident small answer is returned
- The large model is not called when the small one is sure
- An unsure small answer escalates
- A confidence equal to the threshold counts as sure
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.