Skip to content
Source
Sign inSign up
TanStack/ai

packages/ai-ollaya

README.md

TanStack AI

@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.

  1. Install Ollaya. On macOS or Linux:

    curl -fsSL https://ollaya.dev/install.sh | sh

    On Windows, in PowerShell:

    irm https://ollaya.dev/install.ps1 | iex

    Downloads and the desktop app are on ollaya.dev/download.

  2. Start the server. It listens on http://127.0.0.1:11435 by default — the same URL this adapter defaults to.

    ollaya serve
  3. Pull a laya model (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)
  4. 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 to laya:en or laya:multilingual by the text's script and language
  • laya: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