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.
  • Dynamic Grammar Routing: Automatically constructs a GBNF (GGML Backus-Naur Form) grammar on-the-fly to constrain the model's output to exactly one of the agent names you provide.
  • Transparent Model Download: Scans your local directory or automatically downloads and caches the required 1B parameter instruct model on first execution.
  • Highly Configurable: Perfect for multi-agent systems, intent classification, and fallback routing.

Installation

Install directly via pip:

pip install slm-orchestrator

Note: Requires llama-cpp-python and huggingface_hub.


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 a .gguf file (optional)
    cache_dir=None,    # Where to download the model (defaults to ~/.cache/slm_orchestrator)
    n_ctx=1024,        # Context size (default: 1024)
    n_threads=4        # CPU threads to run model generation (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.1.tar.gz (4.9 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.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: slm_orchestrator-0.1.1.tar.gz
  • Upload date:
  • Size: 4.9 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.1.tar.gz
Algorithm Hash digest
SHA256 c5bca2e2cfdcca5ed09f662bc9a8964a57060383961ecc677b978a058126efa4
MD5 64761012edd73bd9a1e894574c750097
BLAKE2b-256 9fc14b3059df3db859fd03a955fce2e8948a77d7e85c08577afedb23341ad516

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for slm_orchestrator-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8777b34e2b199f6340d0d4d22299bbbccc561c28a93f0f6e5eadfd2e707cbda2
MD5 278ed75572d49aafd713dfe846307043
BLAKE2b-256 38bc53296a6b09add151e2bf0901b8b5a0f07e4e52d2ded2cf15030dbb6a503c

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