@@ -128,11 +128,13 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
128128
129129 tests := []struct {
130130 name string
131+ thinking * bool
131132 requestOptions * aistudio.RequestOptions
132133 expectedMatcher func (body []byte ) bool
133134 }{
134135 {
135136 name : "Without requestOption" ,
137+ thinking : nil ,
136138 requestOptions : nil ,
137139 expectedMatcher : func (body []byte ) bool {
138140 // When no thinking config is provided, these fields should not be present
@@ -142,7 +144,8 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
142144 },
143145 },
144146 {
145- name : "With requestOption - only IncludeThoughts" ,
147+ name : "With requestOption - only IncludeThoughts" ,
148+ thinking : nil ,
146149 requestOptions : & aistudio.RequestOptions {
147150 Thinking : & aistudio.ThinkingConfig {
148151 IncludeThoughts : true ,
@@ -155,7 +158,8 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
155158 },
156159 },
157160 {
158- name : "With requestOption - only Budget" ,
161+ name : "With requestOption - only Budget" ,
162+ thinking : nil ,
159163 requestOptions : & aistudio.RequestOptions {
160164 Thinking : & aistudio.ThinkingConfig {
161165 Budget : lo .ToPtr (int (50 )),
@@ -168,7 +172,8 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
168172 },
169173 },
170174 {
171- name : "With requestOption - both fields set" ,
175+ name : "With requestOption - both fields set" ,
176+ thinking : nil ,
172177 requestOptions : & aistudio.RequestOptions {
173178 Thinking : & aistudio.ThinkingConfig {
174179 IncludeThoughts : true ,
@@ -195,6 +200,57 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
195200 return true
196201 },
197202 },
203+ {
204+ name : "With Request - Disable thinking" ,
205+ thinking : lo .ToPtr (false ),
206+ requestOptions : nil ,
207+ expectedMatcher : func (body []byte ) bool {
208+ assert .False (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.includeThoughts" ).Exists ())
209+ assert .True (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Exists ())
210+ assert .EqualValues (t , 0 , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Int ())
211+ return true
212+ },
213+ },
214+ {
215+ name : "With Request - Disable thinking with request option" ,
216+ thinking : lo .ToPtr (false ),
217+ requestOptions : & aistudio.RequestOptions {
218+ Thinking : & aistudio.ThinkingConfig {
219+ Budget : lo .ToPtr (int (100 )),
220+ },
221+ },
222+ expectedMatcher : func (body []byte ) bool {
223+ assert .False (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.includeThoughts" ).Exists ())
224+ assert .True (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Exists ())
225+ assert .EqualValues (t , 0 , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Int ())
226+ return true
227+ },
228+ },
229+ {
230+ name : "With Request - Enable thinking" ,
231+ thinking : lo .ToPtr (true ),
232+ requestOptions : nil ,
233+ expectedMatcher : func (body []byte ) bool {
234+ assert .False (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.includeThoughts" ).Exists ())
235+ assert .False (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Exists ())
236+ return true
237+ },
238+ },
239+ {
240+ name : "With Request - Enable thinking with request option" ,
241+ thinking : lo .ToPtr (true ),
242+ requestOptions : & aistudio.RequestOptions {
243+ Thinking : & aistudio.ThinkingConfig {
244+ IncludeThoughts : true ,
245+ Budget : lo .ToPtr (int (100 )),
246+ },
247+ },
248+ expectedMatcher : func (body []byte ) bool {
249+ assert .True (t , gjson .GetBytes (body , "generationConfig.thinkingConfig.includeThoughts" ).Bool ())
250+ assert .EqualValues (t , 100 , gjson .GetBytes (body , "generationConfig.thinkingConfig.thinkingBudget" ).Int ())
251+ return true
252+ },
253+ },
198254 }
199255
200256 for _ , tt := range tests {
@@ -203,6 +259,10 @@ func TestGoogleAiRequestWithThinking(t *testing.T) {
203259 WithModel ("themodel" ).
204260 WithText (llmberjack .RoleUser , "user text" )
205261
262+ if tt .thinking != nil {
263+ req = req .WithThinking (* tt .thinking )
264+ }
265+
206266 // Only add provider options if they exist
207267 if tt .requestOptions != nil {
208268 req = req .WithProviderOptions (* tt .requestOptions )
0 commit comments