Foundation Models Guide

A practical guide to building Apple Intelligence features with sessions, structured generation, streaming, tools, safety, and adapters.

Why this works

Fast answers for the moments when you are actually building.

Foundation Models is moving fast. This guide keeps the practical parts close: availability, prompts, guided generation, snapshots, tools, language support, and the edge cases that matter when you ship real apps.

Chapters

Start with the task in front of you, then go deeper.

01

Introduction to Foundation Models

Understand what Apple's Foundation Models framework can do, where it fits, and when to choose it for app features.

02

Getting Started with Sessions

Create your first LanguageModelSession, check model availability, and build the basic interaction loop.

03

Streaming and Snapshots

Build responsive interfaces around Foundation Models snapshots instead of token-by-token deltas.

04

Generation Options and Sampling Control

Tune sampling behavior with generation options while keeping on-device output practical and predictable.

05

Structured Generation with Schemas

Use @Generable, @Guide, and schemas to turn model output into type-safe Swift data.

06

Basic Tool Use

Give the model carefully scoped tools so it can fetch data, call services, and act inside your app.

07

Advanced Chat Patterns

Design multi-turn Foundation Models conversations with state, transcripts, and app-specific context.

08

Safety and Best Practices

Handle guardrails, refusals, privacy, and production boundaries for on-device AI features.

09

Integrating External JSON APIs

Combine external JSON APIs with Foundation Models for grounded app workflows and structured results.

10

Content Tagging and Classification

Classify, tag, and organize user content with small, focused prompts and structured output.

11

Supported Languages and Internationalization

Inspect supported locales and build multilingual Foundation Models experiences responsibly.

12

Training Custom Adapters

Explore Apple's adapter training flow and where custom adapters fit into app-specific AI.

Keep going

Use the guide. Build the thing. Come back when you need the next piece.

Support the work