Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions Tests/AnyLanguageModelTests/CoreMLLanguageModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,33 +138,31 @@ 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))
}
}

@Test @available(macOS 15.0, iOS 18.0, tvOS 18.0, visionOS 2.0, watchOS 11.0, *)
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))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/AnyLanguageModelTests/MockLanguageModelTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down