madewithlaya

Catalog / LLM routing & guardrails

0072GitHub

pydecide: one Python client and fallback chain for Jev, OpenRouter, Laya, cross-encoders

Choice, Score and Noul over any System One backend with a confidence policy: if a backend errors or is unsure, the next is tried. Ships a TypeSafe-compatible server.

gopaljigaur/decideREADME ↗
# pydecide

[](https://github.com/gopaljigaur/decide/actions/workflows/ci.yml)
[](https://pypi.org/project/pydecide/)

`decide` is one Python client for typed decisions - Choice, Score and Noul -
over any "System One" decision model: TypeSafe's hosted Jev, OpenRouter's
Decisions endpoint, the open-weight laya family (PyTorch and MLX), any
sentence-transformers CrossEncoder, and a JSON-prompted LLM fallback. A
`Client` takes an ordered list of backends and a confidence policy: if a
backend errors or answers with low confidence, the next backend is tried.
The library also ships a small HTTP server that speaks TypeSafe's wire
protocol, so existing TypeSafe clients can point at a local model instead.

## Install

```bash
pip install pydecide
```

Local model backends and the server are optional extras:

```bash
pip install "pydecide[server]"   # decide serve (FastAPI + uvicorn)
pip install "pydecide[laya]"     # laya backend (PyTorch)
pip install "pydecide[mlx]"      # laya_mlx backend (Apple Silicon; needs Python 3.11+)
pip install "pydecide[st]"       # crossencoder backend (sentence-transformers)
pip install "pydecide[all]"      # everything above
```

The `mlx` extra depends on `laya-mlx`, which requires Python 3.11 or newer;
on 3.10 the extra installs nothing and the `laya_mlx` backend is
unavailable.

## Quickstart: the fallback chain

`Client.from_env()` builds a backend chain from whatever is installed and
configured in the process environment. Pass an explicit `env=` mapping
instead (e.g. in tests) to configure from something other than
`os.environ`:

```python
from decide import Client, Choice, Score, Noul

client = Client.from_env()

r = client.decide(
    state={"ticket": "I was charged twice, please refund."},
    questions={
        "team": Choice(
           

Also filed under LLM routing & guardrails

  1. 0100

    laya-jev-lab: a local-first cascade that matches Jev's accuracy at 1.8x the speed

    Independent Jev vs Laya measurements plus a cascade: Laya decides first, high confidence executes, low confidence escalates to Jev. At a 0.60 threshold it matched Jev's 78%.

    @yibie · LLM routing & guardrails · lower than pure Jev

  2. 0096

    Laya Ultrafast: browser-use's jev-ultrafast agent ported to local Laya on MLX

    A port of the jev-ultrafast browser agent that decides with laya-mlx instead of the hosted Jev API. DOM snapshot, executor, safety checks and inspector are the originals.

    @ipenywis · LLM routing & guardrails · free, local

  3. 0088

    laya_router: a model router with Laya matches GPT-5 nano's accuracy, 35x faster, free

    Two routers behind one endpoint, measured on 180 labelled requests. Laya answers small/medium/powerful routing in one forward pass, against a GPT-5 nano router.

    @glukicov · LLM routing & guardrails · free, local

  4. 0076

    laya-browser-agent: browser decisions on Laya, drop-in for jev-ultrafast tooling

    Local decider for the browser-agent loop: hand it a numbered table of page controls and it picks the operation and element. Playwright/CDP driver, speaks /v1/systemone.

    @ChenneyZhuang · LLM routing & guardrails · free, local, no screenshots