schainks

schainks

Hello everyone :waving_hand:

I’d like to introduce SystemOneClient, an Elixir client for System One decision models: TypeSafe’s Jev, Cloudflare’s Clef, the OpenRouter decisions endpoint, and anything self-hosted that serves the same /v1/systemone wire format.

A System One model doesn’t generate text. You give it some state (any JSON) and a map of typed questions, and it returns a probability for every allowed answer:

  • noul: the probability that a condition holds
  • choice: a probability for each option
  • score: a probability-weighted position on an ordered scale

That makes them a good fit for the decisions code usually hands to an LLM and then parses: routing, gating, classification, picking a tool (btw, you can save actual :money_with_wings: using a System One model to do tool selection!).

Usage

questions = %{
  "tool" => %{    "type" => "choice",
    "instructions" => "Which action should run next to make progress on `request`?",
    "criteria" => %{"add" => "Adds two numbers", "gcd" => "Greatest common divisor", "none" => "No action fits"}  },
  "needs_tool" => %{
    "type" => "noul",
    "instructions" => "Does the next step need one of the actions in `available_actions`?"
  }
}

{:ok, answers, meta} =
  SystemOneClient.evaluate(%{request: "gcd of 1071 and 462", available_actions: ["add", "gcd"]}, questions)

answers["tool"].probabilities   #=> %{"gcd" => 0.97, "add" => 0.02, "none" => 0.01}
answers["needs_tool"].noul      #=> 0.96

Answers come back as Choice, Noul and Score structs with the full probability distribution, so you can take the top-k, apply a threshold, or cut
on a confidence level yourself. Nothing is collapsed to a single pick.

Providers

One provider: option, with url: and model: always able to override:

  • :typesafe (default): Jev at api.typesafe.ai
  • :cloudflare: Clef and Clef-flash on Workers AI. It builds the account-scoped URL and unwraps Cloudflare’s result envelope for you.
  • :openrouter: OpenRouter’s decisions endpoint
  • :compatible: any /v1/systemone URL, with or without a key, for self-hosted models

What else is in it

  • A SystemOneClient behaviour plus SystemOneClient.Stub, so your tests need no network. HTTP tests work with Req.Test through a plug: option.
  • Retries on 429, 529, 502, 503 and 504, and on transport errors, honouring Retry-After.
  • Tagged error tuples at the boundary; it never raises for network conditions.
  • :telemetry span [:system_one_client, :request, *] that never includes state, question text, or keys.
  • Depends only on req, jason and telemetry. Apache 2.0, Elixir 1.18+.

Using it in Jido

The reason this library exists is a contribution that was just merged into jido_ai and will ship in its next release: a ReAct request transformer that asks a System One model, before each LLM turn, which tools the next step needs. The model then sees only those tools, or none when it can answer directly. It can optionally pick a model tier by how much reasoning the request needs. jido_ai defines a small client behaviour and adds no dependency, and SystemOneClient satisfies it as-is:

defmodule MyApp.ToolRouter do
  use Jido.AI.Reasoning.ReAct.Transformers.SystemOne,
    client: SystemOneClient,
    client_opts: [provider: :typesafe],
    top_k: 3
end

use Jido.AI.Agent, name: "support", tools: [...], request_transformer: MyApp.ToolRouter

Every tool schema rides along on every LLM turn, so this adds up. In a benchmark with a live Jido.AI.Agent, 24 tools and 30 graded tasks, gating with Jev cut input tokens per task from about 5,600 to about 900 (6.2x) at the same pass rate as Claude Haiku 4.5 with all tools, for about a third of the cost. Each decision call adds roughly 100 ms per turn. Routing between model tiers didn’t pay off on that task set, so it’s off by default. The scripts, raw results and caveats are in the experiment linked below. It’s a small, hand-built benchmark, so please measure on your own traffic before trusting thresholds.

Status

0.1.0 is on Hex. Several community TypeSafe clients appeared around Jev’s launch, and they’re worth a look too. This one’s focus is the full distributions, the offline stub, and covering Clef and self-hosted endpoints behind the same interface. Feedback, issues and provider additions are very welcome.

Showing Posts 1 to 4

alvinkatojr

alvinkatojr

Nice! There have been a couple of Elixir clients and bindings released for System One this past month, but I believe that you are NOT late to the party.

Good work with this!

schainks

schainks OP

:person_bowing: Thank you! Just pushed v0.2.0 with OpenAI support, too. Trying to make this library the most useful offering possible for Elixir Devs everywhere.

mikehostetler

mikehostetler

Amazing work @schainks !!! Thank you so much for the PR’s and helping land this!

schainks

schainks OP

Thank you @mikehostetler ! Here’s to more collaboration and adventures with Jido :rocket:

— All posts loaded —

Where Next? Top

Trending in Announcing Top

mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
kip
In 2021 I started a new library called Tempo with the objective of modelling time as a set of intervals - not as instants. In 2022 I gave...
New
quatermain
Hello, I’m sharing my plugin here in forum after some time so it has time to mature and proof yourself. I use Claude Code daily on a pr...
New
gtcode
Aloha gang, There’s a new class of AI model out from TypeSafe. Jev is their flagship model. You can learn about it here: ...
New
LostKobrakai
I’ve recently created a small library phoenix_vite integrating the vite build tooling with phoenix. It provides an igniter.installer t...
New
danschultzer
I needed something like premailer for rails, and after searching, I decided to make an easy-to-use library to handle inline styles and co...
New
kraleppa
If you’ve ever had to debug a BEAM node you know it can be a painful process. Parsing raw data, or dealing with clutter often gets in the...
New

Other Trending Topics Top

dominicletz
Hey there, I haven’t seen a list of useful Elixir specific skills for the popular AI tools yet so I’m starting one here with my first. ...
New
raa-ziq
Hi everyone :waving_hand: I wanted to share something I’ve been building — NowBlind, a random chat app designed to help people discover ...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
OndrejValenta
(I just needed to vent somewhere and LinkedIn is full of hope, or hype, I’m not sure which exactly) AI dream has many faces, but general...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews