RAG for Everyone

← Back to quiz

Chapter 17 Exercises60 min hands-on

Exercises: Build a Simple Query Router

Use starter.py to route queries to dense, sparse, hybrid, or high-risk retrieval paths.

1 Detect exact-term signals

Route IDs, SKUs, clauses, and error codes safely.

2 Detect semantic signals

Route paraphrase-heavy questions to dense retrieval.

3 Choose hybrid when both matter

Combine dense and sparse only when evidence needs both signals.

4 Explain the route

Return route, reason, controls, and metric to monitor.

← Back to QuizPractice Bank →