Browse Source

[Firebase AI] Fix integration tests and re-enable Dev API configs (#14792)

Andrew Heard 11 tháng trước cách đây
mục cha
commit
24e9c93bd1

+ 5 - 4
FirebaseAI/Tests/TestApp/Tests/Integration/GenerateContentIntegrationTests.swift

@@ -115,10 +115,11 @@ struct GenerateContentIntegrationTests {
   }
 
   @Test(arguments: [
-    InstanceConfig.vertexV1Beta,
-    // TODO(andrewheard): Configs temporarily disabled due to backend issue.
-    // InstanceConfig.developerV1Beta,
-    // InstanceConfig.developerV1BetaStaging
+    // TODO(andrewheard): Vertex AI configs temporarily disabled to due empty SafetyRatings bug.
+    // InstanceConfig.vertexV1,
+    // InstanceConfig.vertexV1Beta,
+    InstanceConfig.developerV1Beta,
+    InstanceConfig.developerV1BetaStaging,
     InstanceConfig.developerV1BetaSpark,
   ])
   func generateImage(_ config: InstanceConfig) async throws {

+ 2 - 2
FirebaseAI/Tests/TestApp/Tests/Integration/IntegrationTests.swift

@@ -190,12 +190,12 @@ final class IntegrationTests: XCTestCase {
       ModelContent(role: "function", parts: sumResponse),
     ])
 
-    XCTAssertEqual(response.totalTokens, 24)
+    XCTAssertGreaterThan(response.totalTokens, 0)
     XCTAssertEqual(response.totalBillableCharacters, 71)
     XCTAssertEqual(response.promptTokensDetails.count, 1)
     let promptTokensDetails = try XCTUnwrap(response.promptTokensDetails.first)
     XCTAssertEqual(promptTokensDetails.modality, .text)
-    XCTAssertEqual(promptTokensDetails.tokenCount, 24)
+    XCTAssertEqual(promptTokensDetails.tokenCount, response.totalTokens)
   }
 
   func testCountTokens_appCheckNotConfigured_shouldFail() async throws {

+ 4 - 6
FirebaseAI/Tests/TestApp/Tests/Utilities/InstanceConfig.swift

@@ -51,9 +51,8 @@ struct InstanceConfig {
     vertexV1Staging,
     vertexV1Beta,
     vertexV1BetaStaging,
-    // TODO(andrewheard): Configs temporarily disabled due to backend issue:
-    // developerV1Beta,
-    // developerV1BetaStaging,
+    developerV1Beta,
+    developerV1BetaStaging,
     developerV1Spark,
     developerV1BetaSpark,
   ]
@@ -63,9 +62,8 @@ struct InstanceConfig {
     vertexV1Staging,
     vertexV1Beta,
     vertexV1BetaStaging,
-    // TODO(andrewheard): Configs temporarily disabled due to backend issue:
-    // developerV1Beta,
-    // developerV1BetaStaging,
+    developerV1Beta,
+    developerV1BetaStaging,
     developerV1BetaSpark,
   ]