Foundation Models

Apple's FoundationModels framework for on-device LLM integration in apps. Covers SystemLanguageModel availability checking, LanguageModelSession creation with instructions, prompt engineering, @Generable macro for structured output with @Guide constraints, snapshot streaming with PartiallyGenerated types, Tool protocol for custom tool calling, GenerationOptions (temperature), context window limits (4096 tokens), and error handling. Use when integrating Apple Intelligence text generation, building AI-powered features using on-device models, or implementing structured data generation. Critical note - always use response.content (NOT response.output) when accessing generated values.

makgunay 323327b 7.0 KB Updated

File contents

makgunay/claude-swift-skills/tree/main/foundation-models commit 323327b606

Frequently asked questions

npx skillmds@latest add makgunay/foundation-models