@tanstack/ai-ollaya#
Ollaya adapter for TanStack AI.
Call the open-source laya decision models with decide() and typed
questions, running fully local. This package talks HTTP with fetch. It does
not add an SDK.
Install#
pnpm add @tanstack/ai @tanstack/ai-ollaya
Setup#
Ollaya runs open decision models locally — think Ollama, but for the laya
decision models instead of chat LLMs. No API key required.
Install Ollaya. On macOS or Linux:
curl -fsSL https://ollaya.dev/install.sh | shOn Windows, in PowerShell:
irm https://ollaya.dev/install.ps1 | iexDownloads and the desktop app are on ollaya.dev/download.
Start the server. It listens on
http://127.0.0.1:11435by default — the same URL this adapter defaults to.ollaya servePull a
layamodel (in another terminal):ollaya pull laya:latest # router: picks laya:en or laya:multilingual # or a specific one: ollaya pull laya:en # English (ModernBERT-large) ollaya pull laya:multilingual # 100+ languages (mmBERT-base)Verify the model is available and the server answers:
ollaya list ollaya run laya:latest --preset triage "My payouts have been failing for 3 days"
That's it — the adapter below talks to the running server over HTTP.
Usage#
import { boolean, choice, decide, score } from '@tanstack/ai'
import { ollayaDecider } from '@tanstack/ai-ollaya'
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?',
}),
},
})
result.queue.value
result.meta.model
result.meta.usage
Point the adapter at a non-default host with the baseURL option:
ollayaDecider('laya:latest', { baseURL: 'http://my-host:11435' })
Supported models#
laya:latest— routes each request tolaya:enorlaya:multilingualby the text's script and languagelaya:en— English decision model (ModernBERT-large)laya:multilingual— decision model for 100+ languages (mmBERT-base)
You can also pass any other laya tag as a string.
License#
MIT