0460GitHub
Laya for Node
Runs Laya, an open Jev-compatible System One model, from Node.js and TypeScript through ONNX Runtime.
receptron/layaREADME ↗
# @receptron/laya
Run **[Laya](https://huggingface.co/convaiinnovations/laya)** — the open-source, Jev-compatible
_System 1 decision model_ by Convai Innovations — from Node.js / TypeScript.
Laya does not generate text. You hand it a state (a ticket, an email, a JSON object) and typed
questions, and it returns every answer with calibrated probabilities in **one forward pass**:
- `choice` — pick one option, with a probability per option
- `score` — an expected level on an ordered rubric, with the distribution
- `noul` — a calibrated P(true) for a yes/no statement
This package runs the model with [ONNX Runtime](https://onnxruntime.ai/); PyTorch and Python are
not needed at runtime. The request/response shape is the same as the Python reference
implementation (`RLAgent.system_one`) and as TypeSafe Jev's `system_one` API, and the output
matches the Python implementation to four decimal places.
## Install
```sh
npm install @receptron/laya
```
Node.js 20 or newer. The ONNX weights (about 1.7 GB, fp32) are downloaded from Hugging Face on first
use and cached under `~/.cache/receptron-laya` (override with `LAYA_CACHE`). Budget roughly 2 GB of
RAM for the loaded model plus a few hundred MB per batch of questions.
## Usage
```ts
import { Laya } from "@receptron/laya";
const laya = await Laya.load();
const result = await laya.systemOne(
{ subject: "Refund not received", body: "I cancelled two weeks ago and still have no refund..." },
{
department: {
type: "choice",
instructions: "Which team should handle this ticket?",
criteria: { billing: "payments, refunds, invoices", support: "product help and bugs", sales: "new purchases" },
},
urgency: {
type: "score",
instructions: "How urgent is this ticket?",
criteria: ["not ur