You want a queue, an urgency, and a yes or no from a ticket that stays on your machine. Install Ollaya. Then pass ollayaDecider to decide().
The adapter covers evaluate only. It sends POST /v1/systemone to a local Ollaya server with fetch. There is no Ollaya SDK.
On macOS or Linux, run:
curl -fsSL https://ollaya.dev/install.sh | shOn Windows, run this in PowerShell:
irm https://ollaya.dev/install.ps1 | iexThe server listens on http://127.0.0.1:11435. This adapter uses that URL by default.
The download page and the desktop app are on ollaya.dev/download.
npm i @tanstack/ai @tanstack/ai-ollayapnpm add @tanstack/ai @tanstack/ai-ollayayarn add @tanstack/ai @tanstack/ai-ollayabun add @tanstack/ai @tanstack/ai-ollayaimport { decide, choice, score, boolean } from "@tanstack/ai";
import { ollayaDecider } from "@tanstack/ai-ollaya";
const ticket = {
subject: "Charged twice for the same invoice",
body: "Please refund the extra payment.",
};
const result = await decide({
adapter: ollayaDecider("laya:latest"),
state: ticket,
questions: {
queue: choice({
instructions: "Which team should handle this ticket?",
options: {
billing: "Payments, invoices, refunds",
tech: "Bugs, outages, integrations",
sales: "Pricing, upgrades, new accounts",
},
}),
urgency: score({
instructions: "How urgent is this ticket?",
levels: ["low", "medium", "high"],
}),
refund: boolean({
instructions: "Is the customer asking for a refund?",
}),
},
});
console.log(result.queue.value);
console.log(result.urgency.value);
console.log(result.refund.value);
console.log(result.meta.model);
console.log(result.meta.usage);You now have result.queue.value, result.urgency.value, and result.refund.value.
See Evaluate for the rest of decide().
When you request laya:latest, result.meta.model can be laya:en or laya:multilingual. The server picks the model from the text.
| Model | Description |
|---|---|
| laya:latest | Routes each request to laya:en or laya:multilingual. |
| laya:en | English decision model (ModernBERT-large). |
| laya:multilingual | Decision model for 100+ languages (mmBERT-base). |
You can pass any other model tag as a string.
By default the adapter calls http://127.0.0.1:11435. The adapter does not read environment variables. If the server is on another host, pass baseURL. If the server requires OLLAYA_API_KEY, pass apiKey.
import { ollayaDecider } from "@tanstack/ai-ollaya";
const adapter = ollayaDecider("laya:latest", {
baseURL: "http://my-host:11435",
apiKey: "local-token",
});baseUrl and headers are aliases of baseURL and defaultHeaders. If you set both forms, baseURL and defaultHeaders win. A blank baseURL keeps the default host.
Creates an evaluate adapter.
The adapter sends POST /v1/systemone to that base URL.