Gemini: Fix requesting thought blocks
| @@ -288,6 +288,7 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 288 | 288 | const model = String(request.body.model); |
| 289 | 289 | const stream = Boolean(request.body.stream); |
| 290 | 290 | const showThoughts = Boolean(request.body.show_thoughts); |
| 291 | + const isThinking = model.includes('thinking'); | |
| 291 | 292 | |
| 292 | 293 | const generationConfig = { |
| 293 | 294 | stopSequences: request.body.stop, |
| @@ -328,6 +329,12 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 328 | 329 | body.systemInstruction = prompt.system_instruction; |
| 329 | 330 | } |
| 330 | 331 | |
| 332 | + if (isThinking && showThoughts) { | |
| 333 | + generationConfig.thinkingConfig = { | |
| 334 | + includeThoughts: true, | |
| 335 | + }; | |
| 336 | + } | |
| 337 | + | |
| 331 | 338 | return body; |
| 332 | 339 | } |
| 333 | 340 | |
| @@ -341,7 +348,6 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 341 | 348 | controller.abort(); |
| 342 | 349 | }); |
| 343 | 350 | |
| 344 | - const isThinking = model.includes('thinking'); | |
| 345 | 351 | const apiVersion = isThinking ? 'v1alpha' : 'v1beta'; |
| 346 | 352 | const responseType = (stream ? 'streamGenerateContent' : 'generateContent'); |
| 347 | 353 | |