@mostajs/intent-router
v0.1.0
Published
Routeur déterministe « intent → outil » pour apps @mostajs/* : slash-commandes + motifs regex → exécution directe d'un outil (tool.run) SANS appel IA. Moins de coût, plus fiable, indépendant de l'IA. Compose @mostajs/llm (types outil/acteur/chunk). Compos
Downloads
26
Maintainers
Readme
@mostajs/intent-router
Routeur déterministe « intent → outil » pour les apps @mostajs/* : slash-commandes (/cmd …)
et motifs regex → exécution directe d'un outil, sans aucun appel IA (coût zéro, fiable, pas
d'hallucination). Compose @mostajs/llm (types outil/acteur).
Auteur : Dr Hamid MADANI [email protected] · Licence : AGPL-3.0-or-later
Usage
import { matchIntent, runIntent, type Intent } from "@mostajs/intent-router";
const intents: Intent[] = [
{ name: "statut", command: "statut", tool: "order_status",
patterns: [/où en est ([\w-]+)/i],
args: ({ groups, tokens }) => ({ order: groups[0] ?? tokens[0] }) },
];
const hit = matchIntent("/statut 2026-06-08-003", intents);
if (hit) for await (const c of runIntent({ ...hit, tools, actor })) { /* … */ }Idéal en première ligne d'un chatbot : le déterministe d'abord, l'IA seulement en repli
(cf. @mostajs/chatbot, backend router).
