link2026 193e478425 docs: 记录 MLX-Swift-Examples 2.29.1 真实 API 与 plan 草稿的偏差
W2 plan Task 6 写的 LLMSession 草稿在 4 处与真实 API 不符:
- container.perform 的 context 是具体 ModelContext struct
- MLXLMCommon.generate 是顶层函数,只 try 不 await,返回 AsyncStream 非 Throwing
- Generation 有第三个 case .toolCall,switch 必须穷举
- GenerateParameters 需要 maxTokens,且 temperature/topP 是 Float
- 取消传播需 continuation.onTermination = { _ in task.cancel() }

本笔记含完整修正版 LLMSession.swift,Task 6 implementer 必用此为准。

参考:mlx-swift-examples tag 2.29.1,commit 9bff95ca。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-25 15:53:54 +08:00
2026-05-25 12:12:47 +08:00
2026-05-25 12:12:47 +08:00
Description
No description provided
2.7 MiB
Languages
Swift 99.1%
Shell 0.9%