Semantic Routing
Definition
Semantic Routing — a technique where an incoming request is analyzed using embeddings and directed to the most suitable handler: a specific LLM, RAG pipeline, tool, or specialized function. Unlike keyword-based routing, semantic routing takes into account the meaning of the request.
Architecture
graph TD
A[Request] --> B[Embedding]
B --> C[Semantic Router]
C --> D{Classification}
D -->|Simple Question| E[Small Model]
D -->|Complex Question| F[Large Model]
D -->|Search| G[RAG]
D -->|Function Call| H[Tool]
Routing Criteria
| Criterion | Example |
|---|---|
| Request Complexity | Simple fact vs analytical question |
| Domain | Medicine, law, IT |
| Need for Search | Current data vs general knowledge |
| Required Modality | Text, image, audio |