axiom-foundation-models-ref
БесплатноБез исполняемых скриптовНе проверенReference — Complete Foundation Models framework guide covering LanguageModelSession, @Generable, @Guide, Tool protocol, streaming, dynamic schemas, built-in…
от ComeOnOliver★ 67 звёзд на GitHubОб этом скилле
Foundation Models Framework — Complete API Reference
Overview
The Foundation Models framework provides access to Apple's on-device Large Language Model (3 billion parameters, 2-bit quantized) with a Swift API. This reference covers every API, all WWDC 2025 code examples, and comprehensive implementation patterns.
Model Specifications
3B parameter model, 2-bit quantized, 4096 token context (input + output combined). Optimized for on-device summarization, extraction, classification, and generation. NOT suited for world knowledge, complex reasoning, math, or translation. Runs entirely on-device — no network, no cost, no data leaves device.
When to Use This Reference
Use this reference when:
- Implementing Foundation Models features
- Understanding API capabilities
- Looking up specific code examples
- Planning architecture with Foundation Models
- Migrating from prototype to production
- Debugging implementation issues
Related Skills:
axiom-foundation-models— Discipline skill with anti-patterns, pressure scenarios, decision treesaxiom-foundation-models-diag— Diagnostic skill for troubleshooting issues
LanguageModelSession
Overview
LanguageModelSession is the core class for interacting with the model. It maintains conversation history (transcript), handles multi-turn interactions, and manages model state.
Creating a Session
Basic Creation:
import FoundationModels
let session = LanguageModelSession()
With Custom Instructions:
let session = LanguageModelSession(instructions: """
You are a friendly barista in a pixel art coffee shop.
Respond to the player's question concisely.
"""
)
From WWDC 301:1:05
With Tools:
let session = LanguageModelSession(
tools: [GetWeatherTool()],
instructions: "Help user with weather forecasts."
)
From WWDC 286:15:03
With Specific Model/Use Case:
let session = LanguageModelSession(
model: SystemLanguageModel(useCase: .contentTagging)
)
From WWDC 286:18:39
Instructions vs Prompts
Instructions:
- Come from developer
- Define model's role, style, constraints
- Mostly static
- First entry in transcript
- Model trained to obey instructions over prompts (security feature)
Prompts:
- Come from user (or dynamic app state)
- Specific requests for generation
- Dynamic input
- Each call to
respond(to:)adds prompt to transcript
Security Consideration:
- NEVER interpolate untrusted user input into instructions
- User input should go in prompts only
- Prevents prompt injection attacks
respond(to:) Method
Basic Text Generation:
func respond(userInput: String) async throws -> String {
let session = LanguageModelSession(instructions: """
You are a friendly barista in a world full of pixels.
Respond to the player's question.
"""
)
let response = try await session.respond(to: userInput)
return response.content
}
From WWDC 301:1:05
Return Type: Response<String> with .content property
respond(to:generating:) Method
Structured Output with @Generable:
@Generable
struct SearchSuggestions {
@Guide(description: "A list of suggested search terms", .count(4))
var searchTerms: [String]
}
let prompt = """
Generate a list of suggested search terms for an app about visiting famous landmarks.
"""
let response = try await session.respond(
to: prompt,
generating: SearchSuggestions.self
)
print(response.content) // SearchSuggestions instance
From WWDC 286:5:51
Return Type: Response<SearchSuggestions> with .content property
Generation Options
See Sampling & Generation Options for GenerationOptions including sampling:, temperature:, and includeSchemaInPrompt:.
Multi-Turn Interactions
Retaining Context
let session = LanguageModelSession()
// First turn
let firstHaiku = try await session.respond(to: "Write a haiku about fishing")
print(firstHaiku.content)
// Silent waters gleam,
// Casting lines in morning mist—
// Hope in every cast.
// Second turn - model remembers context
let secondHaiku = try await session.respond(to: "Do another one about golf")
print(secondHaiku.content)
// Silent morning dew,
// Caddies guide with gentle words—
// Paths of patience tread.
print(session.transcript) // Shows full history
From WWDC 286:17:46
How it works:
- Each
respond()call adds entry to transcript - Model uses entire transcript for context
- Enables conversational interactions
Transcript Property
let transcript = session.transcript
for entry in transcript.entries {
print("Entry: \(entry.content)")
}
Use cases:
- Debugging generation issues
- Displaying conversation history in UI
- Exporting chat logs
- Condensing for context management
isResponding Property
G
Установить axiom-foundation-models-ref в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл axiom-foundation-models-ref?
Reference — Complete Foundation Models framework guide covering LanguageModelSession, @Generable, @Guide, Tool protocol, streaming, dynamic schemas, built-in use cases, and all WWDC 2025 code examples
Как установить скилл axiom-foundation-models-ref?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл axiom-foundation-models-ref запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic