foundation-models-on-device

Integrate on-device LanguageModelSession text generation and structured extraction in SwiftUI apps.

1|Updated Mar 3, 2026
One-click install
npx skills add https://github.com/samymity/bridge-ventures-backend --skill foundation-models-on-device-samymity
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: foundation-models-on-device
Source: https://github.com/samymity/bridge-ventures-backend/tree/main/.claude/skills/foundation-models-on-device
Command: npx skills add https://github.com/samymity/bridge-ventures-backend --skill foundation-models-on-device-samymity

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the challenge of building reliable on-device AI features for text generation, structured extraction, and tool use without sending user data to the cloud.

Core Features & Use Cases

  • Model availability handling: Detect device eligibility, Apple Intelligence enablement, and download/readiness states before starting generation.
  • On-device generation sessions: Perform single-turn and multi-turn responses using LanguageModelSession.
  • Structured output with @Generable and @Guide: Generate strongly typed results (and partial snapshots) instead of parsing fragile raw text.
  • Custom tool calling: Let the model invoke app-defined tools with typed arguments to support domain-specific actions.
  • Snapshot streaming for real-time UI: Stream partially generated structured responses for progressively updating interfaces.

Quick Start

Build an availability-aware SwiftUI view that creates a LanguageModelSession, streams a structured @Generable result, and renders the partial state as it arrives.

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 generate structured AI outputs privately on-device in iOS 26?

You can generate structured AI outputs privately on-device by using the @Generable and @Guide macros to define typed models, then prompting the on-device LLM via LanguageModelSession to receive strongly typed results instead of parsing raw text.

How do I stream partially generated SwiftUI responses from an on-device LLM?

Stream partial SwiftUI responses from an on-device LLM by calling the streamResponse method on a LanguageModelSession and handling PartiallyGenerated states to progressively update your user interface in real time.

How do I check if Apple Intelligence is available before starting on-device text generation?

Check Apple Intelligence availability before on-device text generation by performing model availability handling to detect device eligibility, verify Apple Intelligence enablement, and confirm model download and readiness states.

Can I use custom tool calling with FoundationModels on-device?

Yes, you can use custom tool calling with FoundationModels by defining app-specific tools with typed arguments, allowing the on-device language model to invoke domain-specific actions during a LanguageModelSession.

What is the best way to extract typed data from an on-device LLM without cloud networking?

The best way to extract typed data without cloud networking is using @Generable constrained structured generation, which ensures the on-device LLM returns typed outputs and partial snapshots directly, eliminating fragile text parsing.

How do I maintain multi-turn conversations with an on-device language model?

Maintain multi-turn conversations with an on-device language model by utilizing a LanguageModelSession, which preserves context across single-turn and multi-turn responses for continuous text generation and tool interactions.