Skip to main content

SLM Orchestrator 🧠🚀

slm_orchestrator is a lightweight, local semantic routing orchestrator powered entirely by a Small Language Model (SLM) running on CPU. It enables you to route user prompts dynamically to a custom list of agents with strict structured output constraints.


Key Features

  • Local & Private: Runs completely on CPU / RAM. Zero API keys, zero network latency, and complete data privacy.
  • Robust Semantic Routing: Utilizes dynamic few-shot prompt mapping and multi-stage fallback parser to map inputs to agents.
  • Resource Efficient: Uses a 1.5B parameter model (Qwen 2.5 1.5B Instruct ONNX), consuming only 1.5 GB to 2.0 GB of RAM and taking 1.1 GB of disk storage.
  • Highly Configurable: Perfect for multi-agent systems, intent classification, and fallback routing.

Installation

Install directly via pip:

pip install slm-orchestrator

Note: Requires onnxruntime-genai, huggingface_hub, and pyyaml.


Quick Start

from slm_orchestrator import SLMOrchestrator

# Initialize the orchestrator (auto-downloads/loads the model)
orchestrator = SLMOrchestrator()

# Define your list of agents
agents = [
    {
        "name": "Billing Support", 
        "description": "Handles payments, invoices, refunds, and subscriptions."
    },
    {
        "name": "Technical Support", 
        "description": "Handles software installation, bug reports, and system crashes."
    },
    {
        "name": "General Chat", 
        "description": "Handles greetings, casual conversations, and general questions."
    }
]

# Route query
selected_agent = orchestrator.route(
    agents=agents,
    question="I need help with my monthly invoice payment"
)

print(f"Selected: {selected_agent}") 
# Output: Billing Support

Configuration API

SLMOrchestrator(
    model_path=None,   # Explicit path to an ONNX model directory (optional)
    cache_dir=None,    # Where to download the model
    n_ctx=2048,        # Context size (default: 2048)
    n_threads=4        # CPU threads (default: 4)
)

License

MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

slm_orchestrator-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slm_orchestrator-0.1.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file slm_orchestrator-0.1.2.tar.gz.

File metadata

  • Download URL: slm_orchestrator-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for slm_orchestrator-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f4ea0dbbaba32dc68027161a3b1380f500a077a184e2958d59b9b949a5bcb16f
MD5 a55fde7837e3a955c0226515738afc2b
BLAKE2b-256 74225e1040a1a173c4fd4f6d7c46d719ec165d8f7aa338500fd3c800d3dba330

See more details on using hashes here.

File details

Details for the file slm_orchestrator-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for slm_orchestrator-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a118c940f88625227d2de3be119195c497133eafa3a4f9f0ae3bc441df5bc6d
MD5 c46e3dbc3ce64c9488533cf59c58e747
BLAKE2b-256 480ea386668ea29823f522f28d3866e1960c5e35eb779c61a24990e2377fc36a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page