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