afomera/apple-foundation-models-ruby-sdk — explained in plain English
Analysis updated 2026-05-18
Add a private, offline AI chat session to a Ruby application.
Get structured data back from the model by defining a typed Ruby class.
Let the model call your own Ruby tools during a conversation.
| afomera/apple-foundation-models-ruby-sdk | dawarich-app/atlas | jacksonpires/rails-realtime-erd | |
|---|---|---|---|
| Stars | 22 | 21 | 21 |
| Language | Ruby | Ruby | Ruby |
| Setup difficulty | moderate | hard | easy |
| Complexity | 3/5 | 4/5 | 2/5 |
| Audience | developer | ops devops | developer |
Figures from each repo's GitHub metadata at analysis time.
Requires macOS 26+ with Apple Intelligence enabled and a full Xcode install, not just Command Line Tools.
This library lets Ruby programs use Apple's on-device AI model, which Apple ships as part of Apple Intelligence on recent Macs. Because the model runs on the device, no data is sent to any server and no API key is needed. The library is a port of Apple's own Python SDK and connects to the same underlying Swift code through Ruby's FFI interface. To use it, you need a Mac running macOS 26.0 or later with Apple Intelligence enabled, a full Xcode installation (the lighter Command Line Tools are not enough), and Ruby 3.1 or newer. You add the gem to your Gemfile, run bundle install, and a small Swift package compiles during setup. The main interaction is a session: you create one, optionally give it system instructions, and then call respond with a text prompt. The model returns either the full response at once or a streaming sequence of partial results you can print as they arrive. You can attach images to prompts for the model to describe or analyze, and you can set options like temperature and response length. For structured output, you define a Ruby class with typed properties and optional constraints, such as allowed values, numeric ranges, or required array lengths. Passing the class to respond tells the model to fill in those fields and return an instance. Tools work in a similar way: you write a class with a name, a description, and a typed arguments structure, and the model calls it during generation when it decides the tool is relevant. Other features include exporting conversation history as JSON and resuming a session from a saved transcript, cancelling requests with a timeout, and an optional Fiber-based async layer that lets multiple sessions run concurrently. Errors are organized into named subclasses for common failure modes like guardrail violations and rate limits. The project is Apache-2.0 licensed.
A Ruby library that lets your programs use Apple's on-device AI model from Apple Intelligence, running fully locally with no API key or server needed.
Mainly Ruby. The stack also includes Ruby, Swift, FFI.
Apache-2.0 license: use freely for any purpose, including commercial use, as long as you keep the copyright and license notices.
Setup difficulty is rated moderate, with roughly 30min to a first successful run.
Mainly developer.
This repo across BitVibe Labs
Verify against the repo before relying on details.