[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9840":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":34,"readmeContent":35,"aiSummary":36,"trendingCount":16,"starSnapshotCount":16,"syncStatus":37,"lastSyncTime":38,"discoverSource":39},9840,"semantic-router","aurelio-labs\u002Fsemantic-router","aurelio-labs","Superfast AI decision making and intelligent processing of multi-modal data.","https:\u002F\u002Fwww.aurelio.ai\u002Fsemantic-router",null,"Python",3596,337,31,82,0,1,18,103,11,29.59,"MIT License",false,"main",true,[27,28,29,30,31,32,33],"ai","artificial-intelligence","chatbot","computer-vision","generative-ai","machine-learning","nlp","2026-06-12 02:02:13","[![Semantic Router](https:\u002F\u002Fi.ibb.co.com\u002Fg423grt\u002Fsemantic-router-banner.png)](https:\u002F\u002Faurelio.ai)\n\n\u003Cp>\n\u003Cimg alt=\"PyPI - Python Version\" src=\"https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fpyversions\u002Fsemantic-router?logo=python&logoColor=gold\" \u002F>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fgraphs\u002Fcontributors\">\u003Cimg alt=\"GitHub Contributors\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fcontributors\u002Faurelio-labs\u002Fsemantic-router\" \u002F>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fcommits\u002Fmain\">\u003Cimg alt=\"GitHub Last Commit\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flast-commit\u002Faurelio-labs\u002Fsemantic-router\" \u002F>\n\u003Cimg alt=\"\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Frepo-size\u002Faurelio-labs\u002Fsemantic-router\" \u002F>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fissues\">\u003Cimg alt=\"GitHub Issues\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues\u002Faurelio-labs\u002Fsemantic-router\" \u002F>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fpulls\">\u003Cimg alt=\"GitHub Pull Requests\" src=\"https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Fissues-pr\u002Faurelio-labs\u002Fsemantic-router\" \u002F>\n\u003Cimg src=\"https:\u002F\u002Fcodecov.io\u002Fgh\u002Faurelio-labs\u002Fsemantic-router\u002Fgraph\u002Fbadge.svg?token=H8OOMV2TUF\" \u002F>\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002FLICENSE\">\u003Cimg alt=\"Github License\" src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-MIT-yellow.svg\" \u002F>\n\u003C\u002Fp>\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:\u002F\u002Fdocs.aurelio.ai\u002Fsemantic-router\u002Fget-started\u002Fintroduction)\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:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F05-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 \u002F 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\"] = \"\u003CYOUR_API_KEY>\"\nencoder = CohereEncoder()\n\n# or for OpenAI\nos.environ[\"OPENAI_API_KEY\"] = \"\u003CYOUR_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 you love politics?\").name\n```\n\n```\n[Out]: 'politics'\n```\n\nCorrect decision, let's try another:\n\n```python\nrl(\"how's the weather today?\").name\n```\n\n```\n[Out]: 'chitchat'\n```\n\nWe get both decisions correct! Now lets try sending an unrelated query:\n\n```python\nrl(\"I'm interested in learning about llama 2\").name\n```\n\n```\n[Out]:\n```\n\nIn this case, no decision could be made as we had no matches — so our route layer returned `None`!\n\n## Integrations\n\nThe _encoders_ of semantic router include easy-to-use integrations with [Cohere](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fsemantic_router\u002Fencoders\u002Fcohere.py), [OpenAI](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002Fencoders\u002Fopenai-embed-3.ipynb), [Hugging Face](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002Fencoders\u002Fhuggingface.ipynb), [FastEmbed](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002Fencoders\u002Ffastembed.ipynb), and [more](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Ftree\u002Fmain\u002Fsemantic_router\u002Fencoders) — we even support [multi-modality](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F07-multi-modal.ipynb)!.\n\nOur utterance vector space also integrates with [Pinecone](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002Findexes\u002Fpinecone.ipynb) and [Qdrant](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002Findexes\u002Fqdrant.ipynb)!\n\n---\n\n## 📚 Resources\n\n### Docs\n\n| Notebook | Description |\n| -------- | ----------- |\n| [Introduction](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F00-introduction.ipynb) | Introduction to Semantic Router and static routes |\n| [Dynamic Routes](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F02-dynamic-routes.ipynb) | Dynamic routes for parameter generation and functionc calls |\n| [Save\u002FLoad Layers](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F01-save-load-from-file.ipynb) | How to save and load `RouteLayer` from file |\n| [LangChain Integration](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F03-basic-langchain-agent.ipynb) | How to integrate Semantic Router with LangChain Agents |\n| [Local Execution](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F05-local-execution.ipynb) | Fully local Semantic Router with dynamic routes — *local models such as Mistral 7B outperform GPT-3.5 in most tests* |\n| [Route Optimization](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F06-threshold-optimization.ipynb) | How to train route layer thresholds to optimize performance |\n| [Multi-Modal Routes](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fsemantic-router\u002Fblob\u002Fmain\u002Fdocs\u002F07-multi-modal.ipynb) | Using multi-modal routes to identify Shrek vs. not-Shrek pictures |\n\n### Online Course\n\n[![Semantic Router Course](https:\u002F\u002Fgithub.com\u002Faurelio-labs\u002Fassets\u002Fblob\u002Fmain\u002Fimages\u002Faurelio-1080p-header-dark-semantic-router.jpg)](https:\u002F\u002Fwww.aurelio.ai\u002Fcourse\u002Fsemantic-router)\n\n### Community\n\n- Dimitrios Manias, Ali Chouman, Abdallah Shami, [Semantic Routing for Enhanced Performance of LLM-Assisted Intent-Based 5G Core Network Management and Orchestration](https:\u002F\u002Farxiv.org\u002Fabs\u002F2404.15869), IEEE GlobeCom 2024\n- Julian Horsey, [Semantic Router superfast decision layer for LLMs and AI agents](https:\u002F\u002Fwww.geeky-gadgets.com\u002Fsemantic-router-superfast-decision-layer-for-llms-and-ai-agents\u002F), Geeky Gadgets\n- azhar, [Beyond Basic Chatbots: How Semantic Router is Changing the Game](https:\u002F\u002Fmedium.com\u002Fai-insights-cobet\u002Fbeyond-basic-chatbots-how-semantic-router-is-changing-the-game-783dd959a32d), AI Insights @ Medium\n- Daniel Avila, [Semantic Router: Enhancing Control in LLM Conversations](https:\u002F\u002Fblog.codegpt.co\u002Fsemantic-router-enhancing-control-in-llm-conversations-68ce905c8d33), CodeGPT @ Medium\n- Yogendra Sisodia, [Stop Chat-GPT From Going Rogue In Production With Semantic Router](https:\u002F\u002Fmedium.com\u002F@scholarly360\u002Fstop-chat-gpt-from-going-rogue-in-production-with-semantic-router-937a4768ae19), Medium\n- Aniket Hingane, [LLM Apps: Why you Must Know Semantic Router in 2024: Part 1](https:\u002F\u002Fmedium.com\u002F@learn-simplified\u002Fllm-apps-why-you-must-know-semantic-router-in-2024-part-1-bfbda81374c5), Medium\n- Adrien Sales, [🔀 Semantic Router w. ollama\u002Fgemma2 : real life 10ms hotline challenge 🤯](https:\u002F\u002Fdev.to\u002Fadriens\u002Fsemantic-router-w-ollamagemma2-real-life-10ms-hotline-challenge-1i3f)\n- Adrien Sales, [Kaggle Notebook 🔀 Semantic Router: `ollama`\u002F `gemma2:9b` hotline](https:\u002F\u002Fwww.kaggle.com\u002Fcode\u002Fadriensales\u002Fsemantic-router-ollama-gemma2-hotline\u002Fnotebook)","Semantic Router 是一个用于快速决策的AI层，特别适用于大型语言模型和智能代理。它利用语义向量空间技术来加速工具使用决策过程，通过理解请求的语义含义来进行高效路由，从而避免了依赖缓慢的语言模型生成。项目采用Python开发，并支持多种AI相关技术，包括自然语言处理、计算机视觉等。Semantic Router 适合需要在多模态数据中实现智能处理与决策的应用场景，如聊天机器人、自动化客服系统以及任何需要基于上下文进行快速响应的AI解决方案。",2,"2026-06-11 03:24:59","top_topic"]