Skip to main content

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.

Metadata

Release files for master-assistant-query-routing 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for master-assistant-query-routing 0.2.0
File Size Uploaded Provenance Actions
master_assistant_query_routing-0.2.0.tar.gz 19.1 kB Without provenance Details for master_assistant_query_routing-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for master-assistant-query-routing 0.2.0
File Interpreter ABI Platform Actions
master_assistant_query_routing-0.2.0-py3-none-any.whl Python 3 none any Details for master_assistant_query_routing-0.2.0-py3-none-any.whl

Total release size: 45.2 kB

Release files / master_assistant_query_routing-0.2.0.tar.gz

Download URL master_assistant_query_routing-0.2.0.tar.gz
Size 19.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3efb3db0a933c92e28b4777bc02aab4be29867150c9610d8ba3674e14ff00c92
BLAKE2b-256 checksum
How to use checksums
b27855b2f800b59124842057292076a3844fced810d6041eebdb4ee24d169968
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / master_assistant_query_routing-0.2.0-py3-none-any.whl

Download URL master_assistant_query_routing-0.2.0-py3-none-any.whl
Size 26.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
069295aa110c91c45fa81c0a59c1bee5bed12f391552c58831e053f0c24c7873
BLAKE2b-256 checksum
How to use checksums
dda9d0523cb0b8d0bec38a47d9976395d4439aa918d75d0f7bcacb9e8a3df0ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Security for master-assistant-query-routing 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page