diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6453748..700f8b9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,10 +42,10 @@ jobs: ${{ runner.os }}-swift-${{ matrix.swift }}-spm- - name: Build - run: swift build --traits MLX,Llama,CoreML + run: swift build --build-tests --traits MLX,Llama,CoreML - name: Test - run: swift test + run: swift test --skip-build test-linux: name: Swift ${{ matrix.swift-version }} on Linux diff --git a/Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift b/Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift index f725c82..62e2768 100644 --- a/Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift +++ b/Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift @@ -138,16 +138,15 @@ import Testing func multimodal_rejectsImageURL() async throws { let model = try await getModel() let session = LanguageModelSession(model: model) - let prompt = Transcript.Prompt(segments: [ - .text(.init(content: "Describe this image")), - .image(.init(url: testImageURL)), - ]) do { - _ = try await session.respond(to: prompt) + _ = try await session.respond( + to: "Describe this image", + image: .init(url: testImageURL) + ) Issue.record("Expected error when image segments are present") } catch { // CoreMLUnsupportedFeatureError is a private struct, so we just check that an error is thrown - #expect(true) + #expect(Bool(true)) } } @@ -155,16 +154,15 @@ import Testing func multimodal_rejectsImageData() async throws { let model = try await getModel() let session = LanguageModelSession(model: model) - let prompt = Transcript.Prompt(segments: [ - .text(.init(content: "Describe this image")), - .image(.init(data: testImageData, mimeType: "image/jpeg")), - ]) do { - _ = try await session.respond(to: prompt) + _ = try await session.respond( + to: "Describe this image", + image: .init(data: testImageData, mimeType: "image/jpeg") + ) Issue.record("Expected error when image segments are present") } catch { // CoreMLUnsupportedFeatureError is a private struct, so we just check that an error is thrown - #expect(true) + #expect(Bool(true)) } } } diff --git a/Tests/AnyLanguageModelTests/MockLanguageModelTests.swift b/Tests/AnyLanguageModelTests/MockLanguageModelTests.swift index a5c162e..baff85d 100644 --- a/Tests/AnyLanguageModelTests/MockLanguageModelTests.swift +++ b/Tests/AnyLanguageModelTests/MockLanguageModelTests.swift @@ -94,7 +94,7 @@ struct MockLanguageModelTests { try await Task.sleep(for: .milliseconds(50)) #expect(asyncSession.isResponding == true) - let response = try await asyncTask.value + _ = try await asyncTask.value try await Task.sleep(for: .milliseconds(10)) #expect(asyncSession.isResponding == false) #expect(asyncSession.transcript.count == 2)