Skip to content

Commit

Permalink
Fix integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard committed Oct 4, 2024
1 parent 373bff4 commit ba223a9
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions FirebaseVertexAI/Tests/Integration/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,12 @@ final class IntegrationTests: XCTestCase {
}

func testCountTokens_image_fileData() async throws {
let fileData = ModelContent(parts: [.fileData(
mimetype: "image/jpeg",
uri: "gs://ios-opensource-samples.appspot.com/ios/public/blank.jpg"
)])
let fileData = FileDataPart(
uri: "gs://ios-opensource-samples.appspot.com/ios/public/blank.jpg",
mimeType: "image/jpeg"
)

let response = try await model.countTokens([fileData])
let response = try await model.countTokens(fileData)

XCTAssertEqual(response.totalTokens, 266)
XCTAssertEqual(response.totalBillableCharacters, 35)
Expand All @@ -122,9 +122,9 @@ final class IntegrationTests: XCTestCase {
let sumResponse = FunctionResponse(name: "sum", response: ["result": .number(42)])

let response = try await model.countTokens([
ModelContent(role: "user", parts: [.text(prompt)]),
ModelContent(role: "model", parts: [.functionCall(sumCall)]),
ModelContent(role: "function", parts: [.functionResponse(sumResponse)]),
ModelContent(role: "user", parts: prompt),
ModelContent(role: "model", parts: FunctionCallPart(sumCall)),
ModelContent(role: "function", parts: FunctionResponsePart(functionResponse: sumResponse)),
])

XCTAssertEqual(response.totalTokens, 24)
Expand Down

0 comments on commit ba223a9

Please sign in to comment.