diff --git a/.github/workflows/build_library.yml b/.github/workflows/build_library.yml index 7c74caa..28c32a6 100644 --- a/.github/workflows/build_library.yml +++ b/.github/workflows/build_library.yml @@ -1,4 +1,4 @@ -name: Build Library using Swift Package Manager +name: Build Library on: push: @@ -7,8 +7,8 @@ on: jobs: - build-and-test-linux: - name: Build and Test on Linux + build-linux: + name: Build on Linux runs-on: ubuntu-latest steps: - name: Checkout Source Code @@ -25,8 +25,8 @@ jobs: - name: Build with Swift Package Manager run: swift build - build-and-test-macos: - name: Build and Test on macOS + build-macos: + name: Build on macOS runs-on: macos-latest steps: - name: Checkout Source Code @@ -40,8 +40,8 @@ jobs: -derivedDataPath DerivedData \ SWIFT_ACTIVE_COMPILATION_CONDITIONS=DEBUG - build-and-test-ios: - name: Build and Test on iOS + build-ios: + name: Build on iOS runs-on: macos-latest steps: - name: Checkout Source Code diff --git a/README.mdown b/README.mdown index ad4159a..9c0c7f4 100644 --- a/README.mdown +++ b/README.mdown @@ -13,6 +13,7 @@ Swift bindings for [llama.cpp](https://github.com/ggerganov/llama.cpp) thanks to ## TODO - [ ] Unit tests +- [ ] Model downloads from URL and HuggingFace ## How to install @@ -29,7 +30,7 @@ Here's a quick example on how to use it. For more, please refer to an example ap ```swift // Initialize model let model = try Model(modelPath: "") -let llama = try LLama(modelLoader: model) +let llama = try LLama(model: model) // Results are delivered through an `AsyncStream` let prompt = "what is the meaning of life?" diff --git a/Sources/llama-cpp-swift/LLama.swift b/Sources/llama-cpp-swift/LLama.swift index e3e2cbb..7b5799f 100644 --- a/Sources/llama-cpp-swift/LLama.swift +++ b/Sources/llama-cpp-swift/LLama.swift @@ -1,6 +1,6 @@ import Foundation import Logging -@preconcurrency import llama +import llama /// An actor that handles inference using the LLama language model. public actor LLama { @@ -323,7 +323,7 @@ extension String { /// - Parameter validatingUTF8: The array of CChars to initialize the string from. fileprivate init?(validatingUTF8 cchars: [CChar]) { if #available(macOS 15.0, iOS 18.0, *) { - self.init(validating: Data(cchars.map { UInt8(bitPattern: $0) }), as: UTF8.self) + self.init(decoding: Data(cchars.map { UInt8(bitPattern: $0) }), as: UTF8.self) } else { self.init(cString: cchars) }