{"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":3693,"forks":352,"topics":["ai","artificial-intelligence","chatbot","computer-vision","generative-ai","machine-learning","nlp"],"archived":false,"github_pushed_at":"2026-05-23T12:57:30+00:00","maintenance_label":"Steady","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":87,"watchers":31,"ai_summary":null,"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-11T12:23:05.71283+00:00","categories":[{"slug":"vector-databases","name":"Vector Databases","url":"https://www.graphcanon.com/categories/vector-databases","markdown_url":"https://www.graphcanon.com/categories/vector-databases.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/vector-databases"},{"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"},{"slug":"ai-agents","name":"AI Agents","url":"https://www.graphcanon.com/categories/ai-agents","markdown_url":"https://www.graphcanon.com/categories/ai-agents.md","api_url":"https://www.graphcanon.com/api/graphcanon/categories/ai-agents"}],"tags":[{"slug":"ai","name":"ai"},{"slug":"artificial-intelligence","name":"artificial-intelligence"},{"slug":"nlp","name":"nlp"},{"slug":"machine-learning","name":"machine-learning"},{"slug":"python","name":"python"},{"slug":"generative-ai","name":"generative-ai"},{"slug":"chatbot","name":"chatbot"},{"slug":"computer-vision","name":"computer-vision"}],"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-11T12:22:56.413Z","maintenance":{"label":"Steady","score":60,"methodology":"github_public_v1","releases_90d":3,"days_since_push":48,"last_release_at":"2026-05-23T12:57:31Z"},"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-11T12:22:56.916Z"},"languages":{"value":["python"],"source":"github.language+pyproject.toml","observed_at":"2026-07-11T12:22:56.916Z"},"license_spdx":{"value":"MIT","source":"github.license","observed_at":"2026-07-11T12:22:56.916Z"}}}}