{"data":{"slug":"aurelio-labs-semantic-router","name":"semantic-router","tagline":"Superfast AI decision making and intelligent processing of multi-modal data","github_url":"https://github.com/aurelio-labs/semantic-router","owner":"aurelio-labs","repo":"semantic-router","owner_avatar_url":"https://avatars.githubusercontent.com/u/69076224?v=4","primary_language":"Python","stars":3764,"forks":358,"topics":["ai","artificial-intelligence","chatbot","computer-vision","generative-ai","machine-learning","nlp"],"archived":false,"github_pushed_at":"2026-07-26T23:06:25+00:00","maintenance_label":"Very active","url":"https://www.graphcanon.com/tools/aurelio-labs-semantic-router","markdown_url":"https://www.graphcanon.com/tools/aurelio-labs-semantic-router.md","api_url":"https://www.graphcanon.com/api/graphcanon/tools/aurelio-labs-semantic-router","graph_url":"https://www.graphcanon.com/api/graphcanon/graph?tool=aurelio-labs-semantic-router","description":"Superfast AI decision making and intelligent processing of multi-modal data.","homepage_url":"https://www.aurelio.ai/semantic-router","license":"MIT","open_issues":86,"watchers":31,"ai_summary":"Semantic Router facilitates rapid AI-driven decisions by leveraging semantic vector space routing for LLMs and agents.","readme_excerpt":"<p>\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/semantic-router?logo=python&logoColor=gold\" />\n<a href=\"https://github.com/aurelio-labs/semantic-router/graphs/contributors\"><img alt=\"GitHub Contributors\" src=\"https://img.shields.io/github/contributors/aurelio-labs/semantic-router\" />\n<a href=\"https://github.com/aurelio-labs/semantic-router/commits/main\"><img alt=\"GitHub Last Commit\" src=\"https://img.shields.io/github/last-commit/aurelio-labs/semantic-router\" />\n<img alt=\"\" src=\"https://img.shields.io/github/repo-size/aurelio-labs/semantic-router\" />\n<a href=\"https://github.com/aurelio-labs/semantic-router/issues\"><img alt=\"GitHub Issues\" src=\"https://img.shields.io/github/issues/aurelio-labs/semantic-router\" />\n<a href=\"https://github.com/aurelio-labs/semantic-router/pulls\"><img alt=\"GitHub Pull Requests\" src=\"https://img.shields.io/github/issues-pr/aurelio-labs/semantic-router\" />\n<img src=\"https://codecov.io/gh/aurelio-labs/semantic-router/graph/badge.svg?token=H8OOMV2TUF\" />\n<a href=\"https://github.com/aurelio-labs/semantic-router/blob/main/LICENSE\"><img alt=\"Github License\" src=\"https://img.shields.io/badge/License-MIT-yellow.svg\" />\n</p>\n\nSemantic Router is a superfast decision-making layer for your LLMs and agents. Rather than waiting for slow LLM generations to make tool-use decisions, we use the magic of semantic vector space to make those decisions — _routing_ our requests using _semantic_ meaning.\n\n#### [Read the Docs](https://docs.aurelio.ai/semantic-router/get-started/introduction)\n\n---\n\n## Quickstart\n\nTo get started with _semantic-router_ we install it like so:\n\n```\npip install -qU semantic-router\n```\n\n❗️ _If wanting to use a fully local version of semantic router you can use `HuggingFaceEncoder` and `LlamaCppLLM` (`pip install -qU \"semantic-router[local]\"`, see [here](https://github.com/aurelio-labs/semantic-router/blob/main/docs/05-local-execution.ipynb)). To use the `HybridRouteLayer` you must `pip install -qU \"semantic-router[hybrid]\"`._\n\nWe begin by defining a set of `Route` objects. These are the decision paths that the semantic router can decide to use, let's try two simple routes for now — one for talk on _politics_ and another for _chitchat_:\n\n```python\nfrom semantic_router import Route\n\n# we could use this as a guide for our chatbot to avoid political conversations\npolitics = Route(\n    name=\"politics\",\n    utterances=[\n        \"isn't politics the best thing ever\",\n        \"why don't you tell me about your political opinions\",\n        \"don't you just love the president\",\n        \"they're going to destroy this country!\",\n        \"they will save the country!\",\n    ],\n)\n\n# this could be used as an indicator to our chatbot to switch to a more\n# conversational prompt\nchitchat = Route(\n    name=\"chitchat\",\n    utterances=[\n        \"how's the weather today?\",\n        \"how are things going?\",\n        \"lovely weather today\",\n        \"the weather is horrendous\",\n        \"let's go to the chippy\",\n    ],\n)\n\n# we place both of our decisions together into single list\nroutes = [politics, chitchat]\n```\n\nWe have our routes ready, now we initialize an embedding / encoder model. We currently support a `CohereEncoder` and `OpenAIEncoder` — more encoders will be added soon. To initialize them we do:\n\n```python\nimport os\nfrom semantic_router.encoders import CohereEncoder, OpenAIEncoder\n\n# for Cohere\nos.environ[\"COHERE_API_KEY\"] = \"<YOUR_API_KEY>\"\nencoder = CohereEncoder()\n\n# or for OpenAI\nos.environ[\"OPENAI_API_KEY\"] = \"<YOUR_API_KEY>\"\nencoder = OpenAIEncoder()\n```\n\nWith our `routes` and `encoder` defined we now create a `RouteLayer`. The route layer handles our semantic decision making.\n\n```python\nfrom semantic_router.routers import SemanticRouter\n\nrl = SemanticRouter(encoder=encoder, routes=routes, auto_sync=\"local\")\n```\n\nWe can now use our route layer to make super fast decisions based on user queries. Let's try with two queries that should trigger our route decisions:\n\n```python\nrl(\"don't","github_created_at":"2023-10-30T12:12:45+00:00","created_at":"2026-07-11T12:22:55.761211+00:00","updated_at":"2026-07-31T06:00:27.731662+00:00","categories":[{"slug":"inference-serving","name":"Inference & Serving","url":"https://www.graphcanon.com/categories/inference-serving","markdown_url":"https://www.graphcanon.com/categories/inference-serving.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/inference-serving"},{"slug":"llm-frameworks","name":"LLM Frameworks","url":"https://www.graphcanon.com/categories/llm-frameworks","markdown_url":"https://www.graphcanon.com/categories/llm-frameworks.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/llm-frameworks"}],"tags":[{"slug":"ai","name":"ai"},{"slug":"artificial-intelligence","name":"artificial-intelligence"},{"slug":"chatbot","name":"chatbot"},{"slug":"computer-vision","name":"computer-vision"},{"slug":"generative-ai","name":"generative-ai"},{"slug":"machine-learning","name":"machine-learning"},{"slug":"nlp","name":"nlp"}],"trust":{"provenance":{"is_fork":false,"github_id":711904962,"owner_type":"Organization","methodology":"github_public_v1","parent_repo":null,"near_duplicate_slugs":[]},"computed_at":"2026-07-31T06:00:26.960Z","maintenance":{"label":"Very active","score":96,"methodology":"github_public_v1","releases_90d":4,"days_since_push":4,"last_release_at":"2026-07-26T23:06:26Z"},"security_summary":{"status":"no_lockfile","scanner":null,"low_count":0,"high_count":0,"last_scan_at":"2026-07-11T12:22:57.317Z","medium_count":0,"scan_profile":"none","critical_count":0}},"capability_facts":{"scan":{"source":"repo_scan","observed_at":"2026-07-31T06:00:27.421Z"},"languages":{"value":["python"],"source":"github.language+pyproject.toml","observed_at":"2026-07-31T06:00:27.421Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-07-31T06:00:27.421Z"}},"decision_facts":{"hosting":null,"pricing":{"model":"freemium","summary":"Free to use with optional premium support or additional features possibly required."},"requirements":{"min_ram_gb":null,"requires_docker":false},"constraints":{"min_ram_gb":null,"pricing_model":"freemium","requires_docker":false},"when_to_use":["Use Semantic Router when you require superfast routing decisions based on semantic meaning of multi-modal inputs without waiting for LLM generations.","Prefer it if your application is sensitive to decision-making speed and needs a local execution option, allowing the use of 'HuggingFaceEncoder' and 'LlamaCppLLM'.","Choose this tool when you aim to categorize and route user inputs into predefined semantic categories, such as filtering political discussions or handling chitchat."],"when_not_to_use":["Do not opt for Semantic Router if your application requires detailed LLM-generated responses rather than quick decision routing based on semantic similarity.","Avoid it in scenarios where extensive customization of the route logic is needed beyond simple semantic categorization, as its main utility lies in fast response routing."],"source":"enrich:decision_facts","observed_at":"2026-07-17T02:02:15.529Z"},"constraint_facets":{"min_ram_gb":null,"pricing_model":"freemium","requires_docker":false},"decision_summary":[{"label":"Pricing","value":"freemium - Free to use with optional premium support or additional features possibly required."},{"label":"Adopt for","value":"Semantic Router is designed for rapid AI decision making by routing through semantic vector space. It supports multi-modal data processing and can be used locally with specific package installs."},{"label":"License detail","value":"Licensed under MIT, allowing for wide use and modification."}]}}