Skip to content

inteleion-ai/stratarouter

 
 

Repository files navigation

StrataRouter

High-performance semantic routing - 10x faster than semantic-router

License: MIT Python 3.8+

StrataRouter is a Rust-powered semantic routing framework that delivers 10-20x better performance than semantic-router.

🚀 Quick Start

Installation

pip install stratarouter

With encoder support:

# HuggingFace (local, fast, free!)
pip install stratarouter[huggingface]

# OpenAI
pip install stratarouter[openai]

# All encoders
pip install stratarouter[all]

Basic Usage

from stratarouter import Route, RouteLayer
from stratarouter.encoders import HuggingFaceEncoder

# Define routes
routes = [
    Route(
        name="billing",
        utterances=["invoice", "payment", "refund"]
    ),
    Route(
        name="support",
        utterances=["help", "question", "issue"]
    )
]

# Create router
encoder = HuggingFaceEncoder()
router = RouteLayer(encoder=encoder, routes=routes)

# Route queries
result = router("I need my invoice")
print(f"Route: {result.name}, Score: {result.score:.2f}")

📊 Performance

Metric semantic-router StrataRouter Improvement
Latency 42ms 3ms 14x faster
Memory 2.1GB 64MB 33x less
Throughput 450/s 18K/s 40x higher

🔧 FastAPI Server

Start the server:

# From repository root
cd server
uvicorn main:app --reload

# Or using Docker
docker-compose up

API will be available at:

Test it:

curl -X POST http://localhost:8000/route \
  -H "Content-Type: application/json" \
  -d '{"text": "I need my invoice", "top_k": 3}'

📚 Documentation

🏗️ Development

# Clone repository
git clone https://github.com/stratarouter/stratarouter
cd stratarouter

# Install development dependencies
./scripts/install_dev.sh

# Build Rust core
cd core && cargo build --release && cd ..

# Install Python package
cd python && maturin develop --release && cd ..

# Run tests
./scripts/test_all.sh

📄 License

MIT License - see LICENSE


---

About

No description, website, or topics provided.

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 54.7%
  • Rust 18.6%
  • Shell 15.2%
  • PowerShell 9.0%
  • Makefile 1.3%
  • Dockerfile 1.2%