@@ -53,10 +53,12 @@ struct GenerateContentIntegrationTests {
5353 ( InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse, ModelNames . gemini2FlashLite) ,
5454 ( InstanceConfig . googleAI_v1beta, ModelNames . gemini2FlashLite) ,
5555 ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini2FlashLite) ,
56+ ( InstanceConfig . googleAI_v1beta, ModelNames . gemini3FlashPreview) ,
57+ ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini3FlashPreview) ,
5658 ( InstanceConfig . googleAI_v1beta, ModelNames . gemma3_4B) ,
57- ( InstanceConfig . googleAI_v1beta_freeTier, ModelNames . gemini2FlashLite) ,
5859 ( InstanceConfig . googleAI_v1beta_freeTier, ModelNames . gemma3_4B) ,
5960 // Note: The following configs are commented out for easy one-off manual testing.
61+ // (InstanceConfig.googleAI_v1beta_freeTier, ModelNames.gemini2FlashLite),
6062 // (InstanceConfig.googleAI_v1beta_staging, ModelNames.gemini2FlashLite),
6163 // (InstanceConfig.googleAI_v1beta_staging, ModelNames.gemma3_4B),
6264 // (InstanceConfig.vertexAI_v1beta_staging, ModelNames.gemini2FlashLite),
@@ -82,10 +84,17 @@ struct GenerateContentIntegrationTests {
8284 let promptTokensDetails = try #require( usageMetadata. promptTokensDetails. first)
8385 #expect( promptTokensDetails. modality == . text)
8486 #expect( promptTokensDetails. tokenCount == usageMetadata. promptTokenCount)
85- #expect( usageMetadata. thoughtsTokenCount == 0 )
87+ if modelName. hasPrefix ( " gemini-3 " ) {
88+ #expect( usageMetadata. thoughtsTokenCount == 64 )
89+ } else {
90+ #expect( usageMetadata. thoughtsTokenCount == 0 )
91+ }
8692 // The fields `candidatesTokenCount` and `candidatesTokensDetails` are not included when using
8793 // Gemma models.
88- if modelName. hasPrefix ( " gemma " ) {
94+ if modelName. hasPrefix ( " gemini-3 " ) {
95+ #expect( usageMetadata. candidatesTokenCount == 2 )
96+ #expect( usageMetadata. candidatesTokensDetails. isEmpty)
97+ } else if modelName. hasPrefix ( " gemma " ) {
8998 #expect( usageMetadata. candidatesTokenCount == 0 )
9099 #expect( usageMetadata. candidatesTokensDetails. isEmpty)
91100 } else {
@@ -95,9 +104,9 @@ struct GenerateContentIntegrationTests {
95104 #expect( candidatesTokensDetails. modality == . text)
96105 #expect( candidatesTokensDetails. tokenCount == usageMetadata. candidatesTokenCount)
97106 }
98- #expect( usageMetadata. totalTokenCount > 0 )
99- #expect ( usageMetadata. totalTokenCount ==
100- ( usageMetadata . promptTokenCount + usageMetadata. candidatesTokenCount ) )
107+ #expect( usageMetadata. totalTokenCount == ( usageMetadata . promptTokenCount +
108+ usageMetadata. candidatesTokenCount +
109+ usageMetadata. thoughtsTokenCount ) )
101110 }
102111
103112 @Test (
@@ -161,16 +170,21 @@ struct GenerateContentIntegrationTests {
161170 ( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig (
162171 thinkingBudget: 32768 , includeThoughts: true
163172 ) ) ,
164- ( . googleAI_v1beta_freeTier, ModelNames . gemini2_5_Flash, ThinkingConfig ( thinkingBudget: 0 ) ) ,
165- (
166- . googleAI_v1beta_freeTier,
167- ModelNames . gemini2_5_Flash,
168- ThinkingConfig ( thinkingBudget: 24576 )
169- ) ,
170- ( . googleAI_v1beta_freeTier, ModelNames . gemini2_5_Flash, ThinkingConfig (
171- thinkingBudget: 24576 , includeThoughts: true
173+ ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingBudget: 128 ) ) ,
174+ ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingBudget: 32768 ) ) ,
175+ ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig (
176+ thinkingBudget: 32768 , includeThoughts: true
172177 ) ) ,
173178 // Note: The following configs are commented out for easy one-off manual testing.
179+ // (.googleAI_v1beta_freeTier, ModelNames.gemini2_5_Flash, ThinkingConfig(thinkingBudget: 0)),
180+ // (
181+ // .googleAI_v1beta_freeTier,
182+ // ModelNames.gemini2_5_Flash,
183+ // ThinkingConfig(thinkingBudget: 24576)
184+ // ),
185+ // (.googleAI_v1beta_freeTier, ModelNames.gemini2_5_Flash, ThinkingConfig(
186+ // thinkingBudget: 24576, includeThoughts: true
187+ // )),
174188 // (.googleAI_v1beta_freeTier_bypassProxy, ModelNames.gemini2_5_Flash, ThinkingConfig(
175189 // thinkingBudget: 0
176190 // )),
@@ -255,6 +269,10 @@ struct GenerateContentIntegrationTests {
255269 ( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig (
256270 thinkingBudget: - 1 , includeThoughts: true
257271 ) ) ,
272+ ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingBudget: - 1 ) ) ,
273+ ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig (
274+ thinkingBudget: - 1 , includeThoughts: true
275+ ) ) ,
258276 ] as [ ( InstanceConfig , String , ThinkingConfig ) ]
259277 )
260278 func generateContentThinkingFunctionCalling( _ config: InstanceConfig , modelName: String ,
@@ -470,19 +488,19 @@ struct GenerateContentIntegrationTests {
470488
471489 @Test ( arguments: [
472490 ( InstanceConfig . vertexAI_v1beta, ModelNames . gemini2FlashLite) ,
473- ( InstanceConfig . vertexAI_v1beta_global, ModelNames . gemini2FlashLite ) ,
474- ( InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse, ModelNames . gemini2FlashLite ) ,
491+ ( InstanceConfig . vertexAI_v1beta_global, ModelNames . gemini3FlashPreview ) ,
492+ ( InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse, ModelNames . gemini3FlashPreview ) ,
475493 ( InstanceConfig . googleAI_v1beta, ModelNames . gemini2FlashLite) ,
476494 ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini2FlashLite) ,
477495 ( InstanceConfig . googleAI_v1beta, ModelNames . gemma3_4B) ,
478- ( InstanceConfig . googleAI_v1beta_freeTier, ModelNames . gemini2FlashLite) ,
479- ( InstanceConfig . googleAI_v1beta_freeTier, ModelNames . gemma3_4B) ,
480496 // Note: The following configs are commented out for easy one-off manual testing.
481497 // (InstanceConfig.vertexAI_v1beta_staging, ModelNames.gemini2FlashLite),
482498 // (InstanceConfig.googleAI_v1beta_staging, ModelNames.gemini2FlashLite),
483499 // (InstanceConfig.googleAI_v1beta_staging, ModelNames.gemma3_4B),
484500 // (InstanceConfig.googleAI_v1beta_freeTier_bypassProxy, ModelNames.gemini2FlashLite),
485501 // (InstanceConfig.googleAI_v1beta_freeTier_bypassProxy, ModelNames.gemma3_4B),
502+ // (InstanceConfig.googleAI_v1beta_freeTier, ModelNames.gemini2FlashLite),
503+ // (InstanceConfig.googleAI_v1beta_freeTier, ModelNames.gemma3_4B),
486504 ] )
487505 func generateContentStream( _ config: InstanceConfig , modelName: String ) async throws {
488506 let expectedResponse = [
0 commit comments