--- id: semantic-router version: "0.1.16" license: MIT license_treatment: permissive maintenance: active --- # semantic-router — Super fast semantic router for AI decision making License: permissive · Maintenance: active · Downloads: 453.6K/mo ## What it is and what it does Semantic Router is a decision-making layer for LLM applications that classifies user intents using semantic vector embeddings rather than generating LLM responses for routing. It defines a set of named routes, each associated with example utterances; incoming queries are embedded and matched against route embeddings to determine which decision path to take. If no route matches above a threshold, it returns None. The package integrates with embedding providers (OpenAI, Cohere, Hugging Face, FastEmbed) and vector stores (Pinecone, Qdrant), and supports dynamic routes that can call functions or generate parameters. It's designed for chatbots, agents, and LLM applications where you need to branch logic based on user intent without the latency of full LLM inference for every routing decision. Use it for: - Route chatbot conversations to different prompt templates or handlers based on detected topic (politics, chitchat, support requests). - Classify incoming support tickets or healthcare administrative requests into workflow categories for downstream processing. - Implement intent-based branching in LLM agents to decide which tool or API to call without waiting for LLM generation. - Filter out-of-scope queries in production chatbots by detecting when user input doesn't match any known route. - Optimize LLM pipeline latency by replacing slow LLM-based routing with fast semantic vector matching. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Semantic Router routes LLM requests to predefined decision paths using vector embeddings instead of waiting for slow LLM generations, enabling fast semantic-based intent classification. Yes, with conditions. Install if you need fast semantic intent classification in an LLM application and can manage an API key for embeddings (or use local models via optional dependencies). The low install friction, active maintenance, MIT license, and zero known vulnerabilities support adoption. The substantial dependency footprint is typical for LLM packages and not a blocker. Verify that your embedding provider and vector store choices align with your deployment model (cloud vs. local). ## Install pip install semantic-router uv add semantic-router poetry add semantic-router ## Installing semantic-router Before you install: Low friction install with a pure-Python wheel. Active maintenance as of 19 days ago. Requires 13 runtime dependencies including aiohttp, litellm, openai, pydantic, and numpy—a substantial dependency footprint typical of LLM-adjacent packages. License in practice: MIT license permits commercial and private use with minimal restrictions, making it suitable for most production deployments. Quickstart: pip install semantic-router from semantic_router import Route from semantic_router.routers import SemanticRouter from semantic_router.encoders import OpenAIEncoder routes = [Route(name="politics", utterances=["isn't politics the best thing ever"])] encoder = OpenAIEncoder() rl = SemanticRouter(encoder=encoder, routes=routes) result = rl("don't you love politics?") print(result.name) Requires an API key for an encoder (OpenAI, Cohere, or similar); local execution available via optional dependencies. Verify before relying: - Whether the package's performance claims (e.g., 'superfast', latency improvements over LLM-based routing) are independently validated. - Support status and roadmap for the 13 runtime dependencies, particularly litellm and openai version compatibility. - Whether multi-modal and hybrid routing features are production-ready or experimental. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 453.6K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags semantic routing for llms, fast intent classification, vector-based request routing, llm decision layer, embedding-based routing, semantic intent detection, route requests by meaning, llm-routing, semantic-search, intent-classification [View on SkillFed](https://skillfed.io/packages/semantic-router) · [View on PyPI](https://pypi.org/project/semantic-router/)