Simple to use, powerful in action
Get started with just a few lines of code
import { Router, Route, OpenAIEncoder } from 'semantic-node-router';
const encoder = new OpenAIEncoder({
apiKey: process.env.OPENAI_API_KEY
});
const routes = [
new Route({
name: 'technical_support',
utterances: ['my app crashed', 'error message', 'bug']
}),
new Route({
name: 'billing',
utterances: ['subscription', 'payment', 'invoice']
})
];
const router = new Router({ routes, encoder });
await router.initialize();
const result = await router.route('The app is not working');
// { route: 'technical_support', score: 0.87 }Everything you need for semantic routing
Built with performance, developer experience, and production readiness in mind
Blazing Fast
~5ms with local embeddings or ~320ms with OpenAI. Up to 90x faster than LLM-based routing.
Cost Effective
23x cheaper than LLM routing at $0.002 per 1,000 requests, or completely free with local models.
High Accuracy
89% accuracy on semantic routing decisions. Handles synonyms, variations, and typos effortlessly.
Type Safe
Full TypeScript support with comprehensive type definitions for a great developer experience.
Offline Ready
Use Transformers.js for completely offline, local semantic routing with zero API calls or costs.
Dynamic Routes
Add, remove, or update routes at runtime. Perfect for evolving applications and A/B testing.
Built for real-world applications
From customer support to conversational AI, semantic routing powers intelligent applications
Customer Support
Route support tickets to the right department based on semantic understanding of the issue.
Chatbot Intents
Classify user intents in conversational AI without training complex NLU models.
Content Categorization
Automatically categorize articles, posts, and messages by semantic similarity.
Command Routing
Route natural language commands to appropriate handlers in CLI tools and apps.