generated from StanfordBDHG/SwiftPackageTemplate
-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# *Update MLX Version* ## ⚙️ Release Notes **Breaking Changes**: This pull request introduces additional breaking changes. Version Updates: - mlx-swift has been updated to version 0.18.1. - mlx-swift-examples has been updated to version 1.18.1. - `LLMLocalSchema` can now be update with other parameters. - The `ChatTemplate` used by `swift-transformers` can be overwritten. - The `LLMContext` can be overwritten with a custom context (`[[String: String]]`). ## 📝 Code of Conduct & Contributing Guidelines By submitting creating this pull request, you agree to follow our [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md): - [x] I agree to follow the [Code of Conduct](https://github.com/StanfordSpezi/.github/blob/main/CODE_OF_CONDUCT.md) and [Contributing Guidelines](https://github.com/StanfordSpezi/.github/blob/main/CONTRIBUTING.md). --------- Co-authored-by: Leon Nissen <> Co-authored-by: Paul Schmiedmayer <[email protected]>
- Loading branch information
1 parent
8bf0a2f
commit fd9f1ca
Showing
18 changed files
with
288 additions
and
399 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
Sources/SpeziLLMLocal/Configuration/LLMLocalContextParameters.swift
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
Sources/SpeziLLMLocal/Helpers/LLMContext+FormattedChat.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// | ||
// This source file is part of the Stanford Spezi open source project | ||
// | ||
// SPDX-FileCopyrightText: 2024 Stanford University and the project authors (see CONTRIBUTORS.md) | ||
// | ||
// SPDX-License-Identifier: MIT | ||
// | ||
|
||
import SpeziLLM | ||
|
||
extension LLMContext { | ||
/// Formats the current ``LLMContext`` for compatibility with Transformers-based chat models. | ||
/// | ||
/// - Returns: An array of dictionaries where each dictionary represents a message in the format: | ||
/// - `role`: The role of the message (e.g., "user", "assistant"), derived from the `rawValue` of the entry's `role`. | ||
/// - `content`: The textual content of the message. | ||
package var formattedChat: [[String: String]] { | ||
self.map { entry in | ||
[ | ||
"role": entry.role.rawValue, | ||
"content": entry.content | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.