Skip to content

AnyDecisionModel

Swift package for typed decisions (probability, choice, score) over local MLX or Core AI models, Clef decision heads, or the Jev API.

LibrarybetaApache-2.0

Overview

AnyDecisionModel is a Swift package for typed decisions: yes/no probabilities, choices among options and scores on ordinal scales. Its API follows the model-and-session pattern of Apple's Foundation Models framework and Hugging Face's AnyLanguageModel. A Choosable enum can define options, and results carry per-option probabilities and confidence.

It has four backends behind one protocol: MLX runs a small language model on Apple silicon and reads each decision from next-token probabilities in one forward pass; MLX decision heads run models with a trained head such as Cloudflare's Clef; Core AI does the same on macOS 27 and iOS 27; and the Jev backend calls TypeSafe's /v1/systemone or any server implementing it. It requires Swift 6.2+, with the core and Jev backend also working on Linux.

What the decision model decides

TypeQuestionAnswers
Yes / noDoes this convey urgency?yes · no
ChoiceWhich team?billing · technical · sales
ScoreHow frustrated?Calm · Frustrated · Very angry

How it works

  1. Create a model (MLX, Core AI, Clef head or Jev)
  2. Open a DecisionSession with the state
  3. Call probability, choice or score
  4. Use the typed result in Swift code

Strengths

  • Same API for on-device and hosted decisions
  • Fully offline option on Apple silicon
  • Typed Swift enums for options

Caveats

  • Local small-model accuracy will differ from Jev
  • Requires recent Swift and OS versions

Getting started

Add the AnyDecisionModel Swift package; for Jev set TYPESAFE_AI_API_KEY or TYPESAFE_API_KEY.

At a glance

Type
Library
Status
beta
Language
Swift
Runtime
library (macOS, iOS, Linux)
Has code
yes
License
Apache-2.0

Use cases and integrations

How curated lists describe it

  • A Swift package for typed decisions from language models (probabilities, choices, and scores), with support for local MLX models and the TypeSafe Jev API.

    hellogumbo/awesome-jev
  • Swift package with one typed-decision protocol over two backends: Jev's `/v1/systemone`, or a small model running locally on Apple silicon through MLX.

    MrJev/awesome-jev

Frequently asked questions

Can it run without the network?

Yes, the MLX and Core AI backends run locally.

How are local decisions computed?

From next-token probabilities in one forward pass, or from a trained decision head like Clef.

Which key does the Jev backend use?

TYPESAFE_AI_API_KEY or TYPESAFE_API_KEY, or one passed to the initializer.

Related projects

  • Python wrapper that answers System One and OpenAI Decisions API questions using any OpenAI-compatible chat model.

    LibrarybetaPython
  • Native Go runtime serving Gemma 4 12B as a Jev-like decision model with hand-tuned PTX kernels and no CGo or CUDA toolkit.

    ProjectbetaGo
  • Go harness for System One models: hosted Jev, open Kev in-process via llama.cpp, and Cloudflare Clef, with typed helpers and a CLI.

    ServicebetaGo
  • Go gateway exposing the Jev /v1/systemone contract over ordinary LLM backends by reading single-token label logprobs.

    ServicebetaGo
  • TypeScript library for one-line local decisions with open models (kev-0.6b, kev-4b, open-jev), no API keys or cloud.

    ProjectbetaTypeScript
  • Python library that finds numeric answers by bisection, asking Jev higher, lower or exactly at each guess.

    ProjectbetaPython