@@ -51,8 +51,8 @@ struct GenerateContentIntegrationTests {
5151 ( InstanceConfig . vertexAI_v1beta, ModelNames . gemini2FlashLite) ,
5252 ( InstanceConfig . vertexAI_v1beta_global, ModelNames . gemini2FlashLite) ,
5353 ( InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse, ModelNames . gemini2FlashLite) ,
54- ( InstanceConfig . googleAI_v1beta, ModelNames . gemini3FlashPreview ) ,
55- ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini3FlashPreview ) ,
54+ ( InstanceConfig . googleAI_v1beta, ModelNames . gemini3_1_FlashLitePreview ) ,
55+ ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini3_1_FlashLitePreview ) ,
5656 ( InstanceConfig . googleAI_v1beta, ModelNames . gemma3_4B) ,
5757 ( InstanceConfig . googleAI_v1beta_freeTier, ModelNames . gemma3_4B) ,
5858 // Note: The following configs are commented out for easy one-off manual testing.
@@ -82,12 +82,8 @@ struct GenerateContentIntegrationTests {
8282 let promptTokensDetails = try #require( usageMetadata. promptTokensDetails. first)
8383 #expect( promptTokensDetails. modality == . text)
8484 #expect( promptTokensDetails. tokenCount == usageMetadata. promptTokenCount)
85- if modelName. hasPrefix ( " gemini-3 " ) {
86- // For gemini-3 models, the thoughtsTokenCount can vary slightly between runs.
87- #expect( usageMetadata. thoughtsTokenCount >= 64 )
88- } else {
89- #expect( usageMetadata. thoughtsTokenCount == 0 )
90- }
85+ // No thoughts in Flash Lite.
86+ #expect( usageMetadata. thoughtsTokenCount == 0 )
9187 // The fields `candidatesTokenCount` and `candidatesTokensDetails` are not included when using
9288 // Gemma models.
9389 if modelName. hasPrefix ( " gemini-3 " ) {
@@ -176,13 +172,37 @@ struct GenerateContentIntegrationTests {
176172 ( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig (
177173 thinkingBudget: 32768 , includeThoughts: true
178174 ) ) ,
179- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingLevel: . minimal) ) ,
180- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingLevel: . low) ) ,
181- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingLevel: . medium) ) ,
182- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingLevel: . high) ) ,
183- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingBudget: 128 ) ) ,
184- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig ( thinkingBudget: 32768 ) ) ,
185- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview, ThinkingConfig (
175+ (
176+ . googleAI_v1beta,
177+ ModelNames . gemini3_1_FlashLitePreview,
178+ ThinkingConfig ( thinkingLevel: . minimal)
179+ ) ,
180+ (
181+ . googleAI_v1beta,
182+ ModelNames . gemini3_1_FlashLitePreview,
183+ ThinkingConfig ( thinkingLevel: . low)
184+ ) ,
185+ (
186+ . googleAI_v1beta,
187+ ModelNames . gemini3_1_FlashLitePreview,
188+ ThinkingConfig ( thinkingLevel: . medium)
189+ ) ,
190+ (
191+ . googleAI_v1beta,
192+ ModelNames . gemini3_1_FlashLitePreview,
193+ ThinkingConfig ( thinkingLevel: . high)
194+ ) ,
195+ (
196+ . googleAI_v1beta,
197+ ModelNames . gemini3_1_FlashLitePreview,
198+ ThinkingConfig ( thinkingBudget: 128 )
199+ ) ,
200+ (
201+ . googleAI_v1beta,
202+ ModelNames . gemini3_1_FlashLitePreview,
203+ ThinkingConfig ( thinkingBudget: 32768 )
204+ ) ,
205+ ( . googleAI_v1beta, ModelNames . gemini3_1_FlashLitePreview, ThinkingConfig (
186206 thinkingBudget: 32768 , includeThoughts: true
187207 ) ) ,
188208 // Note: The following configs are commented out for easy one-off manual testing.
@@ -295,8 +315,8 @@ struct GenerateContentIntegrationTests {
295315 ( . googleAI_v1beta, ModelNames . gemini2_5_Pro, ThinkingConfig (
296316 thinkingBudget: - 1 , includeThoughts: true
297317 ) ) ,
298- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview , ThinkingConfig ( thinkingBudget: - 1 ) ) ,
299- ( . googleAI_v1beta, ModelNames . gemini3FlashPreview , ThinkingConfig (
318+ ( . googleAI_v1beta, ModelNames . gemini3_1_FlashLitePreview , ThinkingConfig ( thinkingBudget: - 1 ) ) ,
319+ ( . googleAI_v1beta, ModelNames . gemini3_1_FlashLitePreview , ThinkingConfig (
300320 thinkingBudget: - 1 , includeThoughts: true
301321 ) ) ,
302322 ] as [ ( InstanceConfig , String , ThinkingConfig ) ]
@@ -502,8 +522,11 @@ struct GenerateContentIntegrationTests {
502522
503523 @Test ( arguments: [
504524 ( InstanceConfig . vertexAI_v1beta, ModelNames . gemini2FlashLite) ,
505- ( InstanceConfig . vertexAI_v1beta_global, ModelNames . gemini3FlashPreview) ,
506- ( InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse, ModelNames . gemini3FlashPreview) ,
525+ ( InstanceConfig . vertexAI_v1beta_global, ModelNames . gemini3_1_FlashLitePreview) ,
526+ (
527+ InstanceConfig . vertexAI_v1beta_global_appCheckLimitedUse,
528+ ModelNames . gemini3_1_FlashLitePreview
529+ ) ,
507530 ( InstanceConfig . googleAI_v1beta, ModelNames . gemini2_5_FlashLite) ,
508531 ( InstanceConfig . googleAI_v1beta_appCheckLimitedUse, ModelNames . gemini2_5_FlashLite) ,
509532 ( InstanceConfig . googleAI_v1beta, ModelNames . gemma3_4B) ,
@@ -556,7 +579,11 @@ struct GenerateContentIntegrationTests {
556579 #expect( promptTextPart. text == prompt)
557580 let modelHistory = try #require( chat. history. last)
558581 #expect( modelHistory. role == " model " )
559- #expect( modelHistory. parts. count == 1 )
582+ if modelName. hasPrefix ( " gemini-3.1- " ) {
583+ #expect( modelHistory. parts. count == 2 )
584+ } else {
585+ #expect( modelHistory. parts. count == 1 )
586+ }
560587 let modelTextPart = try #require( modelHistory. parts. first as? TextPart )
561588 let modelJSONData = try #require( modelTextPart. text. data ( using: . utf8) )
562589 let response = try JSONDecoder ( ) . decode ( [ String ] . self, from: modelJSONData)
0 commit comments