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

achempion
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library. The progre...
New
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
Localize is the next generation localisation library for Elixir. Think of it as ex_cldr version 3.0. The first version will be released ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
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
danschultzer
I’ve moved the strategies out of PowAssent and created a multi-provider framework for Elixir. This way the strategies can be used in any ...
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
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
AstonJ
With advancements in AI gathering pace and set to increasingly accelerate, perhaps it’s worth having an annual thread on the topic - feel...
New
bartblast
If you haven’t tried Hologram yet, what’s stopped you? Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
mat-hek
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn: This is possible because it now builds on a very stab...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews