- Home
- Skills
- Bluewaves Creations
- Bluewaves Skills
- Foundation Models
foundation-models_skill
- Shell
0
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill bluewaves-creations/bluewaves-skills --skill foundation-models- SKILL.md18.4 KB
Overview
This skill explains Apple Foundation Models for on-device AI in iOS 26+ and related platforms. It covers LanguageModelSession, the @Generable macro for type-safe structured outputs, guided generation, tool calling, streaming responses, multi-turn conversation, and error handling. The content focuses on practical examples and integration patterns for Swift and SwiftUI.
How this skill works
The skill inspects how to create and configure LanguageModelSession instances to run local inference on supported Apple devices. It demonstrates using the @Generable macro to produce type-safe Codable outputs, defining @Tool types for tool calling, and using streamResponse for incremental token streaming. It also shows session configuration, system instructions for guided generation, and common error handling patterns.
When to use it
- Build privacy-first on-device LLM features without cloud dependency
- Generate structured, type-safe outputs from prompts using @Generable
- Call local tools (APIs, system services) from model responses
- Render live incremental responses in chat or UI with streaming
- Maintain multi-turn conversation context across user interactions
Best practices
- Check LanguageModelSession.isAvailable before using Foundation Models and provide a fallback UI
- Use session configuration (maxTokens, temperature, topP, penalties) to control output length and creativity
- Prefer @Generable types for predictable parsing and validation of model outputs
- Limit context length and handle LanguageModelError.contextLengthExceeded gracefully
- Stream partial outputs in the UI to improve perceived responsiveness and show progress
Example use cases
- A local assistant that recommends movies and returns a structured MovieRecommendation object
- A recipe analyzer that returns nested RecipeAnalysis with ingredients and nutrition info
- A weather assistant that defines a WeatherTool and uses tool calling to fetch live data
- A chat app showing incremental assistant messages using streamResponse integrated with SwiftUI
- A reservation flow using multiple tools (search and booking) orchestrated by the model
FAQ
Devices with Apple Intelligence support (A17 Pro or later, M-series) running iOS 26, macOS Tahoe, iPadOS 26, or visionOS 26.
Can I use Foundation Models offline?
Yes. Inference runs locally on-device so models work without a network connection.