基础模型框架 (macOS)
Foundation Models framework

原始链接: https://developer.apple.com/foundation-models-framework/

Foundation Models 框架是一个用于将大语言模型集成到应用中的原生 Swift API,包括 Apple 的端侧与 Private Cloud Compute 模型。它提供引导式生成、工具调用、图像理解(集成了 OCR、条形码读取等 Vision 工具),以及 Dynamic Profiles,允许在共享 transcript 的同时在会话中途切换模型、工具与指令。它还通过 Language Model 协议支持第三方模型(如 Claude 和 Gemini)。符合条件的开发者可免费使用 Private Cloud Compute,并享有强隐私保护。其他工具包括用于测试提示词的 Evaluations 框架、用于脚本编写与原型设计的 `fm` CLI、带有技能与上下文助手的开源实用工具,以及 Python SDK。适用的使用要求仍须遵守。

Hacker News 的一个帖子讨论了 Apple 的 Foundation Models 框架及相关的开发者生态。评论者强调 Apple 的 CoreAI GitHub 仓库将开放权重模型适配为原生 Swift 使用,并指出符合条件的小型企业开发者可以访问 Private Cloud Compute,其使用与用户的 iCloud 账户关联,而非开发者自己的服务器。用户分享了 Apple 模型在终端命令、防火墙事件审查和应用开发中的实际使用经验,同时也有人反映其安全限制过于严格,编码性能较弱。其他人提到 Claude 支持 App Attest、可能即将发布的本地模型,以及用于运行或测试 PCC 的工具。总体情绪兴趣浓厚但态度不一:Apple 的本地/私有 AI 在普通 Mac 上显得有前景且可用,但安全过滤、上下文窗口和编码限制仍然是问题。
相关文章

原文

Overview

The Foundation Models framework is a native Swift API for integrating any large language model into your app — including direct access to the Apple Foundation Models on-device and in Private Cloud Compute. Powerful capabilities like guided generation, tool calling, image understanding, and Dynamic Profiles are built in, so you have what you need to build unique experiences.

Image understanding

Multimodal prompts let you pass images alongside text so your app can reason about visual content. This opens up new categories of experiences you can build with image understanding — it's as simple as attaching an image to your prompt. The Vision framework is also integrated directly, giving your model purpose-built tools like OCR for precise text extraction and barcode readers for quick code scanning — all on-device.

Model support

The Foundation Models framework gives you direct access to the on-device foundation model at the core of Apple Intelligence so you can build experiences that are smart, private, and work without internet connectivity.

On-device models are highly useful for many tasks, yet sometimes you need a larger model for a more complex workflow. The Foundation Models framework now extends to server models — like Claude, Gemini, and more — all through the same Swift API, with full support for features like tool calling and guided generation. Any model provider can create a Swift package conforming to the Language Model protocol, a fundamental component of the framework that allows you to pick the right language model for your app.

Supported third-party models

Private Cloud Compute

For those just getting started, developers who are enrolled in the App Store Small Business Program and have fewer than two million first-time App Store downloads can access the Apple Foundation Models running on Private Cloud Compute with no cloud API cost.* This delivers frontier-level intelligence with unparalleled privacy protections, ensuring that your users' data is not stored or accessible to Apple or anyone else.

Learn more about Private Cloud Compute

Dynamic Profiles

Dynamic Profiles are new declarative APIs for continuously updating your session's model, tools, and instructions on the fly. Rather than creating a session with a fixed configuration, you define profiles — each with its own model, temperature, reasoning level, and toolset — and swap between them within a single continuous session. The session transcript is shared across every profile switch, so your app gets more contextual intelligence with less prompting. Dynamic Profiles are designed to be adaptable building blocks: use them to build AI agents, skills, or any other high-level abstraction your app needs.

Evaluations framework

The Evaluations framework gives you the ability to test your prompts and validate that your intelligence-powered features work correctly across dynamic conditions, going beyond what unit tests alone can catch. Whether you're iterating on instructions, switching models, or tuning a Dynamic Profile, Evaluations gives you confidence that your app's behavior holds up before you ship.

CLI

The new fm command line tool in macOS 27 lets you streamline scripting, automate model workflows, and accelerate your development without writing a line of app code. You can prototype quickly, giving you a fast path from idea to implementation.

Open source

To help you get started with adopting emerging AI patterns, the Foundation Models framework utilities package adds experimental abstractions on top of the framework — including custom skills, context management helpers, and a Chat Completions client that connects to a hosted model of your choice.

The Foundation Models SDK for Python extends the framework into the Python ecosystem, letting you integrate with popular tooling and evaluation packages in Python.

Requirements

The Acceptable Use Requirements for the Foundation Models framework outline prohibited uses of Apple Foundation Models. Additionally, pursuant to Article 53(1)(b) of the AI Act, we make available information and documentation to providers of AI systems who intend to integrate AFM 3 Cloud into their AI systems.

联系我们 contact @ memedata.com