View in English

  • Apple 开发者
    • 入门汇总

    探索“入门汇总”

    • 概览
    • 学习
    • Apple Developer Program

    及时了解最新动态

    • 最新动态
    • 开发者你好
    • 平台

    探索“平台”

    • Apple 平台
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    • App Store

    精选

    • 设计
    • 分发
    • 游戏
    • 配件
    • 网页
    • Home
    • CarPlay 车载
    • 技术

    探索“技术”

    • 概览
    • Xcode
    • Swift
    • SwiftUI

    精选

    • 辅助功能
    • App Intents
    • Apple 智能
    • 游戏
    • 机器学习与 AI
    • 安全性
    • Xcode Cloud
    • 社区

    探索“社区”

    • 概览
    • “与 Apple 会面交流”活动
    • 社区主导的活动
    • 开发者论坛
    • 开源

    精选

    • WWDC
    • Swift Student Challenge
    • 开发者故事
    • App Store 大奖
    • Apple 设计大奖
    • Apple Developer Centers
    • 文档

    探索“文档”

    • 文档库
    • 技术概述
    • 示例代码
    • 《人机界面指南》
    • 视频

    发布说明

    • 精选更新
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • Apple tvOS
    • Xcode
    • 下载

    探索“下载”

    • 所有下载
    • 操作系统
    • 应用程序
    • 设计资源

    精选

    • Xcode
    • TestFlight
    • 字体
    • SF Symbols
    • Icon Composer
    • 支持

    探索“支持”

    • 概览
    • 帮助指南
    • 开发者论坛
    • “反馈助理”
    • 联系我们

    精选

    • 《开发者账户帮助》
    • 《App 审核指南》
    • 《App Store Connect 帮助》
    • 即将实行的要求
    • 协议和准则
    • 系统状态
  • 快速链接

    • 活动
    • 新闻
    • 论坛
    • 示例代码
    • 视频
 

视频

打开菜单 关闭菜单
  • 专题
  • 所有视频
  • 关于

更多视频

  • 简介
  • 概要
  • 代码
  • Foundation Models 框架的新功能

    探索 Foundation Models 框架的新功能。了解如何访问专用云计算、整合第三方模型及开源模型,并构建优化视觉功能。探索上下文管理 API、内置的语义搜索,以及用于为你的 App 创建智能体体验的强大原语。

    章节

    • 0:00 - Introduction
    • 2:34 - New on-device model
    • 3:21 - Vision: image understanding
    • 4:20 - Private Cloud Compute
    • 6:46 - Model abstraction layer
    • 7:32 - Partner model integrations
    • 9:40 - System tools: Vision and Spotlight
    • 10:57 - Dynamic Profiles for agentic apps
    • 13:46 - Composing models and configurations
    • 15:30 - Evaluations framework
    • 16:02 - The fm command line tool
    • 17:13 - Foundation Models Python SDK
    • 17:55 - Open source and framework utilities
    • 19:24 - Next steps

    资源

    • Expanding generation with tool calling
    • Analyzing images with multimodal prompting
    • Composing dynamic sessions with instructions and profiles
    • Adding server-side intelligence with Private Cloud Compute
      • 高清视频
      • 标清视频
  • 搜索此视频…
    • 2:46 - Context size and token counting

      // Context size and token counting
        
        let model = SystemLanguageModel()
        print(model.contextSize)
        // 8192
        
        let count = try await model.tokenCount(for: "What are the Japanese characters for origami?")
        print(count)
    • 3:52 - Attachable image types

      // Insert c// Attachable image types
      
        let response = try await session.respond {
            "What animal is this?"
            Attachment(UIImage(...))
        }ode snippet.
    • 8:45 - Inspecting usage

      // Inspecting usage
        
        let response = try await session.respond(
            to: "Recommend a craft that doesn't require scissors.",
            contextOptions: ContextOptions(reasoningLevel: .light)
        )
      
        print(response.usage.input.totalTokenCount)
        print(response.usage.input.cachedTokenCount)
      
        print(response.usage.output.totalTokenCount)
        print(response.usage.output.reasoningTokenCount)
    • 11:55 - Routing between craft analysis and brainstorm

      // Routing between craft analysis and brainstorm
        
        @Observable
        final class AppStates {
            var mode: Mode
        }
      
        let appStates: AppStates
        var session: LanguageModelSession?
      
        func updateSession() {
            let originalTranscript = session?.transcript.dropFirstInstructions() ?? Transcript()
      
            // Create a new session with new instructions and tools
            switch appStates.mode {
            case .craftAnalysis:
                session = LanguageModelSession(
                    tools: [
                        RecordImageAnalysisTool(),
                        SwitchModeTool(states: appStates)
                    ],
                    instructions: "Analyze the user's craft project...",
                    transcript: originalTranscript
                )
            case .brainstorm:
                session = LanguageModelSession(
                    tools: [
                        RecordBrainstormTool(),
                    ],
                    instructions: "Brainstorm some ideas...",
                    transcript: originalTranscript
                )
            }
        }
        
        struct SwitchModeTool: Tool {
            let description = "Switch to a different mode."
            let states: AppStates
      
            @Generable
            struct Arguments {
                let mode: Mode
            }
      
            func call(arguments: Arguments) async throws -> some PromptRepresentable {
                appStates.mode = arguments.mode
                return "Successfully switched to \(arguments.mode)."
            }
        }
        
        // If mode changes, update the session
        withObservationTracking {
            appStates.mode
        } onChange: {
            updateSession()
        }
    • 12:42 - Describing the profile for craft app

      // Describing the profile for craft app
      
        struct CraftProfile: LanguageModelSession.DynamicProfile {
            var body: some DynamicProfile {
                Profile {
                    Instructions {
                        """
                        You are an expert crafting assistant. \
                        Record craft project image analyses   \
                        using the recordImageAnalysis tool.
                        """
                    }
                    RecordImageAnalysisTool()
                }
            }
        }
      
        let session = LanguageModelSession(
            profile: CraftProfile()
        )
    • 14:36 - Describing the profile for craft app

      // Describing the profile for craft app
        
        struct CraftProfile: LanguageModelSession.DynamicProfile {
            let states: CraftProjectStates
      
            var body: some DynamicProfile {
                switch states.mode {
                case .craftAnalysis:
                    Profile {
                        Instructions { /* ... */ }
                        RecordImageAnalysisTool()
                        SwitchModeTool(states: states)
                    }
                case .brainstorm:
                    Profile {
                        Instructions { /* ... */ }
                        BrainstormRecordTool()
                    }
                    .model(states.privateCloudCompute)
                    .reasoningLevel(.deep)
                }
            }
        }
    • 18:29 - Foundation Models SDK for Python

      # Foundation Models SDK for Python
        
        import apple_fm_sdk as fm
      
        model = fm.SystemLanguageModel()
      
        # Check the model's availability
        is_available, reason = model.is_available()
      
        if is_available:
      
            # Create a session
            session = fm.LanguageModelSession(model=model)
      
            # Generate a response
            response = await session.respond(prompt="Hello!")
            print(response)
    • 0:00 - Introduction
    • Erik Hornberger and Zhen Li introduce this year's Foundation Models release, going open source with a new utilities package, and preview the agenda: model updates, system tools, dynamic profiles, evaluations, and tooling.

    • 2:34 - New on-device model
    • A rebuilt on-device model with better reasoning and tool calling, plus new APIs (from iOS 26.4) for inspecting context size and counting tokens, and refined guardrails that reduce false positives.

    • 3:21 - Vision: image understanding
    • The on-device model gains vision. Add image attachments to a prompt to ask about images, accepting UIImage, NSImage, CGImage, Core Image, CoreVideo pixel buffers, and file URLs at any size, though larger images cost more tokens.

    • 4:20 - Private Cloud Compute
    • Access Apple's server models via PrivateCloudComputeLanguageModel, a 32K context window with reasoning levels, with no account setup, auth, or API keys, fully private, and now available on watchOS 27.

    • 6:46 - Model abstraction layer
    • A new LanguageModel protocol lets local and server models back a LanguageModelSession. Existing models conform already, plus open-source CoreAILanguageModel and MLXLanguageModel for running local models on the Neural Engine and GPU.

    • 7:32 - Partner model integrations
    • Anthropic and Google publish Swift packages for their frontier models. Swap models via Swift Package Manager with everything downstream unchanged, handle auth and billing securely with OAuth and Keychain, and track per-token usage including cache and reasoning tokens.

    • 9:40 - System tools: Vision and Spotlight
    • New built-in tools: BarcodeReaderTool and OCRTool (Vision-backed) for reasoning over visual information, and a Spotlight-powered search tool enabling fully local Retrieval-Augmented Generation (RAG).

    • 10:57 - Dynamic Profiles for agentic apps
    • Dynamic Profiles, a declarative primitive for agentic experiences. Using the Crafts app, a single session swaps instructions and tools between modes (craft analysis vs. brainstorm) by conforming a struct to DynamicProfile.

    • 13:46 - Composing models and configurations
    • Use modifiers to vary the model and reasoning level per profile branch, for example SystemLanguageModel for quick analysis and Private Cloud Compute with deep reasoning for brainstorming, while preserving conversation history. A profile resolves to one active profile at a time.

    • 15:30 - Evaluations framework
    • A new Swift framework to measure the quality of intelligence features, quantifying accuracy as you tweak prompts so you can understand the statistical impact of changes and ship with confidence.

    • 16:02 - The fm command line tool
    • In macOS 27, the models come to the terminal. The fm CLI gives on-device and PCC access for everyday productivity: fm chat for interactive use and piping into shell scripts to summarize, extract, or generate content.

    • 17:13 - Foundation Models Python SDK
    • A Python SDK exposes the same on-device model as the Swift framework, checking availability and generating structured responses in a few lines, for data scientists and researchers in the Python ecosystem.

    • 17:55 - Open source and framework utilities
    • The Foundation Models framework utilities package offers building blocks (transcript management, a skill API, chat-completions interfacing), and the core framework is open-sourced to run wherever Swift runs, including Linux servers.

    • 19:24 - Next steps
    • Download the sample app, get familiar with dynamic profiles and the Evaluations framework, and watch the deep-dive sessions on PCC, evaluations, the Xcode instrument, and dynamic profiles.

Developer Footer

  • 视频
  • WWDC26
  • Foundation Models 框架的新功能
  • 打开菜单 关闭菜单
    • iOS
    • iPadOS
    • macOS
    • Apple tvOS
    • visionOS
    • watchOS
    打开菜单 关闭菜单
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • SF Symbols
    打开菜单 关闭菜单
    • 辅助功能
    • 配件
    • Apple 智能
    • App 扩展
    • App Store
    • 音频与视频 (英文)
    • 增强现实
    • 设计
    • 分发
    • 教育
    • 字体 (英文)
    • 游戏
    • 健康与健身
    • App 内购买项目
    • 本地化
    • 地图与位置
    • 机器学习与 AI
    • 开源资源 (英文)
    • 安全性
    • Safari 浏览器与网页 (英文)
    打开菜单 关闭菜单
    • 完整文档 (英文)
    • 部分主题文档 (简体中文)
    • 教程
    • 下载
    • 论坛 (英文)
    • 视频
    打开菜单 关闭菜单
    • 支持文档
    • 联系我们
    • 错误报告
    • 系统状态 (英文)
    打开菜单 关闭菜单
    • Apple 开发者
    • App Store Connect
    • 证书、标识符和描述文件 (英文)
    • 反馈助理
    打开菜单 关闭菜单
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program (英文)
    • Mini Apps Partner Program
    • News Partner Program (英文)
    • Video Partner Program (英文)
    • 安全赏金计划 (英文)
    • Security Research Device Program (英文)
    打开菜单 关闭菜单
    • 与 Apple 会面交流
    • Apple Developer Center
    • App Store 大奖 (英文)
    • Apple 设计大奖
    • Apple Developer Academies (英文)
    • WWDC
    阅读最近新闻。
    获取 Apple Developer App。
    版权所有 © 2026 Apple Inc. 保留所有权利。
    使用条款 隐私政策 协议和准则