fix: use convertTranscriptToMLXChat in streamResponse#71
Conversation
|
Hi @XMLHexagram. Thank you for opening this PR. I'm sorry for the inconvenience caused by the current code not working. I just merged #67, which I believe makes an equivalent change. Is there anything in here that we'd be missing? (I see there are some changes around how parameters are encoded; are those required?) |
|
@mattt, Yes, I believe these code are indeed important. Cause #67 only fix part of the error. After 0.5.2 published, run ❯ swift build --traits MLX
[1/1] Planning build
Building for debugging...
/Users/hexagram/Projects/AnyLanguageModel/Sources/AnyLanguageModel/Models/MLXLanguageModel.swift:377:25: error: type 'Any' does not conform to the 'Sendable' protocol
375 | return [
376 | "type": "function",
377 | "function": [
| `- error: type 'Any' does not conform to the 'Sendable' protocol
378 | "name": tool.name,
379 | "description": tool.description,
[5/5] Compiling AnyLanguageModel MLXLanguageModel.swiftAs a result, 0.5.2 is still broken if developer enable MLX trait. And this PR fully fix all the errors and I have already completely tested it in my own project. BTW, next time before merging PR or release new version, please make sure it is worked properly. |
|
And I also fix the error in CoreML trait in this PR. /Users/hexagram/Projects/AnyLanguageModel/Sources/AnyLanguageModel/Models/CoreMLLanguageModel.swift:219:45: error: value of type 'Instructions' has no member 'segments'
217 | // Check for image segments in instructions
218 | if let instructions = session.instructions {
219 | for segment in instructions.segments {
| `- error: value of type 'Instructions' has no member 'segments'
220 | if case .image = segment {
221 | throw CoreMLLanguageModelError.unsupportedFeature
/Users/hexagram/Projects/AnyLanguageModel/Sources/AnyLanguageModel/Models/CoreMLLanguageModel.swift:219:45: error: value of type 'Instructions' has no member 'segments'
217 | // Check for image segments in instructions
218 | if let instructions = session.instructions {
219 | for segment in instructions.segments {
| `- error: value of type 'Instructions' has no member 'segments'
220 | if case .image = segment {
221 | throw CoreMLLanguageModelError.unsupportedFeature
[75/75] Compiling AnyLanguageModel GenerationID.swift |
Pretty sure it compiled before I raised PR. Also tested in my project. |
May I ask your swift version? via Mine is ❯ swift --version
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0 |
|
|
The changes in this PR were cherry-picked as part of #72. Thank you again for your help, @XMLHexagram. |


fix #70