madewithlaya

Catalog / Tools & apps

0073GitHub

system-one: typed decisions from Jev, Cloudflare AI Gateway and Laya, Promise or Effect

TypeScript library where one set of question definitions serves a zero-dependency Promise client and an Effect service. Never invents a probability it was not given.

lukeramsden/system-oneREADME ↗
# system-one

Typed decisions from System-1 models — TypeSafe **Jev** (directly or via **Cloudflare AI Gateway**) and **Laya** — with a Promise client and an **Effect** service sharing one set of question definitions.

You send **state** and **typed questions**; you get **typed answers with probabilities**; your code decides. The library never invents a probability, threshold, selected level, or model version it was not given.

```
pnpm add system-one                  # Promise API, zero runtime deps
pnpm add effect @effect/platform     # only for system-one/effect
```

Node ≥ 22.18, ESM only.

## Define questions

```ts
import { Question, defineQuestions } from "system-one";

const triage = defineQuestions({
  urgent: Question.boolean({
    instructions: "Does this need urgent attention?",
    criteria: { true: "Time-sensitive harm or an ongoing outage", false: "Routine request" },
  }),
  department: Question.choice({
    instructions: "Which department should handle this?",
    options: {
      billing: "Payments, refunds, invoices",
      technical: "Bugs, outages",
      sales: "Pricing",
    },
  }),
  frustration: Question.ordinal({
    instructions: "How frustrated is the customer?",
    levels: ["Calm", "Frustrated", "Very angry"],
  }),
});
```

Literal keys are preserved: `answers.department.value` is `"billing" | "technical" | "sales"`.

## Promise API

```ts
import { createClient } from "system-one";
import { jev } from "system-one/adapters/typesafe";

const client = createClient({
  model: jev({ apiKey: process.env.TYPESAFE_API_KEY!, model: "jev-1.13.0" }),
});

const result = await client.evaluate(
  { state: { message: "My payouts have failed for three days!" }, questions: triage },
  { signal, timeoutMs: 10_000 }, // optional
);

result.answers.departme

Also filed under Tools & apps

  1. 0005

    laya-mlx plays Snake at 60 decisions per second

    介绍比Jev快50倍,在你设备上跑的laya-mlx! 只在你的设备上占用最高1G内存 Laya是一个开源的类似于Jev的,基于文本输出概率的分类系统 我将其移植到MLX,并且做了一些性能优化! 视频中就是这个模型在我的本地M3Max上玩贪吃蛇 这个模型能够以每秒决策60次的速度玩贪吃蛇! https://t.co/31KGUiNunb

    @mizorewww · Tools & apps · free, local · 60 decisions/s

  2. 0112

    Laya on Axera AX650 and AX8850 edge NPUs, under 70 ms

    AXERA-TECH's conversion of all three Laya checkpoints for its edge AI chips, reported at latency under 70 ms per decision on AX650/AX8850.

    AXERA-TECH · Tools & apps · free, on-device · < 70 ms on AX650 / AX8850

  3. 0099

    laya-mcp (PerryLink): a warm sidecar that fixes Laya's silent truncation and constant noul

    MCP server plus HTTP sidecar: token-budget preflight that reports what would be cut, a persisted calibration store, structured errors, and a noul fix (P(true) 0.5 → 1.0).

    @PerryLink · Tools & apps · free, local

  4. 0097

    Gomoku against Laya-MLX: you play black, the model picks white's move from six candidates

    Local 15x15 Gomoku on Apple Silicon. Rules in Python, board in the browser, every AI move one real Laya choice over up to six candidates, probabilities shown. No Gomoku training.

    smile-magic · Tools & apps · free, local