@@ -104,6 +104,72 @@ describe("ProviderTransform.options - setCacheKey", () => {
104104 } )
105105} )
106106
107+ describe ( "ProviderTransform.options - google thinkingConfig gating" , ( ) => {
108+ const sessionID = "test-session-123"
109+
110+ const createGoogleModel = ( reasoning : boolean , npm : "@ai-sdk/google" | "@ai-sdk/google-vertex" ) =>
111+ ( {
112+ id : `${ npm === "@ai-sdk/google" ? "google" : "google-vertex" } /gemini-2.0-flash` ,
113+ providerID : npm === "@ai-sdk/google" ? "google" : "google-vertex" ,
114+ api : {
115+ id : "gemini-2.0-flash" ,
116+ url : npm === "@ai-sdk/google" ? "https://generativelanguage.googleapis.com" : "https://vertexai.googleapis.com" ,
117+ npm,
118+ } ,
119+ name : "Gemini 2.0 Flash" ,
120+ capabilities : {
121+ temperature : true ,
122+ reasoning,
123+ attachment : true ,
124+ toolcall : true ,
125+ input : { text : true , audio : false , image : true , video : false , pdf : true } ,
126+ output : { text : true , audio : false , image : false , video : false , pdf : false } ,
127+ interleaved : false ,
128+ } ,
129+ cost : {
130+ input : 0.001 ,
131+ output : 0.002 ,
132+ cache : { read : 0.0001 , write : 0.0002 } ,
133+ } ,
134+ limit : {
135+ context : 1_000_000 ,
136+ output : 8192 ,
137+ } ,
138+ status : "active" ,
139+ options : { } ,
140+ headers : { } ,
141+ } ) as any
142+
143+ test ( "does not set thinkingConfig for google models without reasoning capability" , ( ) => {
144+ const result = ProviderTransform . options ( {
145+ model : createGoogleModel ( false , "@ai-sdk/google" ) ,
146+ sessionID,
147+ providerOptions : { } ,
148+ } )
149+ expect ( result . thinkingConfig ) . toBeUndefined ( )
150+ } )
151+
152+ test ( "sets thinkingConfig for google models with reasoning capability" , ( ) => {
153+ const result = ProviderTransform . options ( {
154+ model : createGoogleModel ( true , "@ai-sdk/google" ) ,
155+ sessionID,
156+ providerOptions : { } ,
157+ } )
158+ expect ( result . thinkingConfig ) . toEqual ( {
159+ includeThoughts : true ,
160+ } )
161+ } )
162+
163+ test ( "does not set thinkingConfig for vertex models without reasoning capability" , ( ) => {
164+ const result = ProviderTransform . options ( {
165+ model : createGoogleModel ( false , "@ai-sdk/google-vertex" ) ,
166+ sessionID,
167+ providerOptions : { } ,
168+ } )
169+ expect ( result . thinkingConfig ) . toBeUndefined ( )
170+ } )
171+ } )
172+
107173describe ( "ProviderTransform.options - gpt-5 textVerbosity" , ( ) => {
108174 const sessionID = "test-session-123"
109175
0 commit comments