System One for Apple Foundation Models

Swift package that plugs System One decision models into Apple's Foundation Models framework, so you get typed answers with confidence scores for @Generable types, either on device through Core ML or from hosted backends.

View on GitHub ↗
Stars
★ 121
Last commit
9 Oct 2026
Maintenance
Active
Licence
Apache-2.0
Category
On-device AI SDKs · Cloud-capable
GitHub
peterfriese/system-one-foundation-models

Overview

System One for Apple Foundation Models is a Swift 6 package by Peter Friese that connects System One decision models to Apple's Foundation Models framework. Instead of generating text, these models answer typed questions about your app's state: you describe a decision as a @Generable struct or enum and get back typed results with probabilities and confidence. It can run Laya models on device through Core ML, or use self-hosted and cloud backends from TypeSafe AI, Cloudflare and OpenAI.

Features

  • Works with the standard LanguageModelSession API and @Generable types
  • On-device Laya models (322M and 421M parameters) through Core ML on the Neural Engine and GPU, with no network calls
  • Optional backends: self-hosted laya-serve, TypeSafe AI's Jev cloud, Cloudflare Clef (which can judge images) and OpenAI's Decisions API
  • Returns calibrated probabilities and confidence scores alongside each typed result
  • Shortcuts for yes/no probabilities, enum choices and rubric scores without declaring a @Generable type
  • Swift package traits so you only pull in the backends you need
  • ProxyTransport for routing app requests through your own server instead of shipping API keys

Requirements

  • Xcode 27 and Swift 6
  • iOS 27 or macOS 27
  • API keys for any cloud backends you use; the on-device backend needs none

Install

  1. Add the package to Package.swift, choosing the OnDevice trait if you only want Core ML

    .package(url: "https://github.com/peterfriese/system-one-foundation-models.git", from: "0.3.0", traits: ["OnDevice"])

Example

Define a @Generable CustomerTriage struct with an urgency flag and a department enum, then call session.respond(to: ticket, generating: CustomerTriage.self) to route a support ticket.

Works with

Xcode

Listed in

GitHub search

Read the code before you install anything. SwiftAgents doesn't review or endorse the tools listed here. Active: a commit in the last 90 days. Slowing: last commit within the past year. Stale: older than a year, or archived.

More in this category