Query Routing Across Sources
A knowledge assistant may search product docs, policies, tickets, API schemas, and databases. Routing chooses the right retrieval path. Use deterministic rules for clear cases and model-based routing only when ambiguity justifies it. Each route needs permissions, timeouts, and an output contract. A router must not select a corpus the user cannot access.
Log the selected route and evaluate routing separately: a retriever may work correctly against the wrong corpus.
Implementation example
function route(q) {
if (/refund|return policy/i.test(q)) return "approved-policies";
if (/stack trace|error code/i.test(q)) return "engineering-docs";
return "general-kb";
}💡 These rules are illustrative; production routing needs ambiguity handling and ACL checks.
Key Takeaways
- Inspect the relevant pipeline stage instead of guessing.
- Preserve source provenance, versions, and access scope.
- Measure quality on representative queries.
Knowledge Check
Why evaluate routing separately?