foundation-models-on-device

Run Apple FoundationModels on-device with structured outputs and tool calling.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/derekhu0002/ai4pb-orchestrator --skill foundation-models-on-device-derekhu0002
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/derekhu0002/ai4pb-orchestrator/tree/main/skills/foundation-models-on-device
Command: npx skills add https://github.com/derekhu0002/ai4pb-orchestrator --skill foundation-models-on-device-derekhu0002

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Apple FoundationModels enables running language models entirely on the device, preserving user privacy and enabling offline capabilities. This Skill outlines patterns for integrating FoundationModels into iOS apps with on-device text generation, structured output via @Generable, and custom tool calling, plus snapshot streaming for real-time UI updates.

Core Features & Use Cases

  • On-device execution with privacy guarantees: no data leaves the device.
  • Structured generation: use @Generable to produce typed outputs.
  • Tool calling for domain actions: invoke custom on-device tools.
  • Snapshot streaming: progressively render results in the UI.
  • Use cases: chat assistants, form assistants, data extraction, offline apps.

Quick Start

Initialize a simple on-device generative session in your iOS app to generate a cat profile from a short prompt.

Frequently Asked Questions about foundation-models-on-device

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run on-device text generation in iOS without sending data to the cloud?

On-device text generation in iOS is achieved by initializing an Apple FoundationModels session within your Swift app, which processes prompts entirely locally to ensure user privacy and offline capabilities.

How do I get structured typed outputs from an on-device language model in Swift?

Structured typed outputs from an on-device language model are generated using the @Generable property wrapper, which maps the model's output directly to predefined Swift types for reliable data extraction.

Can I implement custom tool calling with Apple FoundationModels on-device?

Custom tool calling is supported by Apple FoundationModels on-device, allowing your iOS app to invoke specific domain actions and functions locally during a single generative session.

What is the best way to stream LLM generation results progressively in an iOS UI?

Streaming LLM generation results progressively in an iOS UI is handled through snapshot streaming, which provides real-time updates to the interface as the on-device model generates text.

Does Apple FoundationModels support offline apps needing private data extraction?

Apple FoundationModels supports offline apps needing private data extraction by running the language model entirely on the device, ensuring no cloud data is required and user privacy is preserved.

How do I check if an iOS device supports on-device FoundationModels before starting a session?

Checking if an iOS device supports on-device FoundationModels is done through built-in availability checks, which verify the device hardware before initializing a generative session.