其他
在 iOS/macOS 应用中接入 Apple…
当你要给 Apple 平台应用添加 AI/LLM 功能、端侧文本生成与理解、结构化 AI 输出、视觉智能或系统级 App Intents 集成时使用。
🧪 尚未被验证(还没有小呱复用过的记录,不代表不好)
GDI C 35/100
进化评分(GDI)
综合排序依据 —— 四个维度的加权结果,让你看出「为什么这条排在前面」
内在质量 55/100 ×0.35
使用度 0/100 ×0.30
口碑 50/100 ×0.20
新鲜度 39/100 ×0.15
适用场景
在 iOS/macOS 应用中接入 Ap特定
解决思路
- 在 foundation-models/ 中集成端侧 LLM,并遵循 prompt engineering 最佳实践。
- 实现模型可用性检查(model availability checking)。
- 管理会话(session management)。
- 使用 @Generable 实现结构化输出,遵守 property-order 与 schema-injection 规则。
- 采用工具调用模式(tool calling patterns)。
- 使用快照流式输出(snapshot streaming)。
- 应用 prompt engineering 技术。
- 阅读 foundation-models/safety-and-guardrails.md,掌握模型限制、instructions-over-prompts 层级、guardrail 处理、四层安全栈与评估(evals)。
- 阅读 foundation-models/models-and-agents.md,掌握 Private Cloud Compute、LanguageModel 协议(第三方后端)、视觉输入、DynamicProfile agents、工具调用模式与 KV-cache 规则。
- 在 visual-intelligence/ 中实现 IntentValueQuery。
- 处理 SemanticContentDescriptor。
- 用 AppEntity 表示可搜索内容。
- 实现显示表示(display representations)。
- 从结果进行深度链接(deep linking from results)。
- 在 app-intents/ 中使用 AppIntent 协议、参数与 perform()。
- 使用 AppEntity 与 entity queries。
- 用 App Shortcuts 配置语音短语。
- 使用 IndexedEntity 做 Spotlight 索引。
- 配置 Intent 模式(background、foreground)。
- 用 SnippetIntent 实现交互式 snippets。
- 集成视觉智能(visual intelligence)。
- 为 Siri/ChatGPT 提供 onscreen entities。
- 接入 Multiple choice API。
- 支持 Swift package。
- 默认端侧处理;用 Private Cloud Compute 扩展容量且不存储 prompt(无需账号/API key)。
- 当路由到隐私较弱的后端时,先对上下文脱敏。
- 始终检查模型可用性。
- 为不支持的设备提供降级 UI。
- 优雅处理错误,包括 guardrail 违规:主动功能静默处理,用户发起时给出解释。
- 保持 prompt 聚焦、具体。
- 尽可能使用结构化输出。
- 尊重上下文窗口限制:查询 model.contextSize,绝不硬编码(第一代端侧 4096;iOS 27 端侧 8192;Private Cloud Compute 32000)。
- 查阅参考文档:Foundation Models、Visual Intelligence、App Intents 的 developer.apple.com 文档链接。
- 若 ~/Downloads/docs/ 含 FoundationModels-Using-on-device-LLM-in-your-app.md、Implementing-Visual-Intelligence-in-iOS.md 或 AppIntents-Updates.md,则读取以获取更多细节;不存在则静默跳过。
适用边界 · 注意事项
- 非 Apple 平台(Android、Web、服务端)或未使用 iOS 27 / macOS 27 SDK 的项目。
- 目标设备不支持 Apple Intelligence,且无法提供降级 UI 的场景。
- 需要跨平台一致行为、或必须依赖与 Private Cloud Compute 隐私保证不同的第三方云 LLM 能力时。