Corpus-coupled, drift-free routing for multi-collection RAG.
Project description
Master Assistant Query Routing (MAA)
Drift-free query routing for multi-collection RAG via parallel corpus probing.
Given a natural-language query, MAA decides which document collection(s) it belongs to — by probing every configured vector-store collection in parallel, scoring each from the actual retrieved chunks, and asking a routing LLM to read those chunks and return a structured JSON decision. The routing signal is the live corpus itself, so re-indexing your data updates routing automatically — there is no description or utterance list to keep in sync.
Paper: https://doi.org/10.5281/zenodo.20348330
Install
# everything — all providers (Gemini, OpenAI, Anthropic, Ollama) + Qdrant
pip install "master-assistant-query-routing[all]"
# or install only what you need
pip install "master-assistant-query-routing[openai,qdrant]"
Usage
import asyncio
from maa import route_query, Config
from maa.providers.openai import OpenAIEmbedder, OpenAIRoutingLLM
from maa.stores.qdrant import QdrantVectorStore
async def main():
embedder = OpenAIEmbedder(api_key="sk-...", model="text-embedding-3-large")
llm = OpenAIRoutingLLM(api_key="sk-...", model="gpt-5.4-mini")
store = QdrantVectorStore(host="localhost", port=6333)
cfg = Config(collections=["billing", "technical", "accounts"])
result = await route_query(
"why was I charged twice this month",
cfg, embedder=embedder, llm=llm, store=store,
)
print(result["collections"]) # e.g. ['billing']
asyncio.run(main())
Returns a dict with collections (the routing decision), analysis
(per-collection confidence + evidence), and reasoning. Pass verbose=True to
also include the raw probe scores and retrieved chunks.
License
Apache-2.0.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file master_assistant_query_routing-0.2.0.tar.gz.
File metadata
- Download URL: master_assistant_query_routing-0.2.0.tar.gz
- Upload date:
- Size: 19.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3efb3db0a933c92e28b4777bc02aab4be29867150c9610d8ba3674e14ff00c92
|
|
| MD5 |
e7411d2d867b494768c4575189fe8b49
|
|
| BLAKE2b-256 |
b27855b2f800b59124842057292076a3844fced810d6041eebdb4ee24d169968
|
File details
Details for the file master_assistant_query_routing-0.2.0-py3-none-any.whl.
File metadata
- Download URL: master_assistant_query_routing-0.2.0-py3-none-any.whl
- Upload date:
- Size: 26.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
069295aa110c91c45fa81c0a59c1bee5bed12f391552c58831e053f0c24c7873
|
|
| MD5 |
2a5d95bea29a1f7fee55ef7cef9a241b
|
|
| BLAKE2b-256 |
dda9d0523cb0b8d0bec38a47d9976395d4439aa918d75d0f7bcacb9e8a3df0ce
|