In the previous lesson you designed a chain that always executes the same 3 steps. That works when all inputs are the same type. But what happens when inputs are heterogeneous? A user can send you:
Each one requires a different sub-system. If you process all of them with the same chain, the result will be noise.
A router is a meta-prompt that classifies the input into one of several route categories, and hands control to the corresponding sub-system. It's the N°1 piece of any system that takes heterogeneous input.
Write the router's prompt. Four routes:
The router's output MUST be exactly one of the 4 strings. No preamble, no explanation, no markdown. you learned that in Track 1 (step 07: just answer with X).
In a router, always include an
escalate_to_humanroute and teach the model to use it when in doubt. Better to escalate an easy case than mis-route a hard one. routing errors are silent (the system keeps running with the wrong route) and very hard to detect later.
5 criteria, 5 test cases:
escalate_to_human.