Command Palette

Search for a command to run...

Hectal
Phase 13: Interviews and Capstone
RAG and Vector Search · Exercise 2 of 5 PreviousNext
Intermediate

Write the hand-off rules

Write decide(best, refusals_in_row, asked_for_person, spent, limit) returning one of: "person", "budget", "hand off", "rephrase" or "answer".

Rules, in this order: if asked_for_person return "person". If spent >= limit return "budget". If best < 0.30: return "hand off" when refusals_in_row >= 1, otherwise "rephrase". Otherwise return "answer".

What Check tests

  1. A good match is answered
  2. A weak match first asks to rephrase
  3. A second weak match hands off
  4. Asking for a person wins over everything
  5. A used-up budget beats a weak match

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.