Gemini: Fix requesting thought blocks

823b9db6f6d6403354433584ecd02f14c603de68

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +7 -1Ignore whitespace
src/endpoints/backends/chat-completions.js+7 -1
@@ -288,6 +288,7 @@ async function sendMakerSuiteRequest(request, response) {
288288 const model = String(request.body.model);
289289 const stream = Boolean(request.body.stream);
290290 const showThoughts = Boolean(request.body.show_thoughts);
291+ const isThinking = model.includes('thinking');
291292
292293 const generationConfig = {
293294 stopSequences: request.body.stop,
@@ -328,6 +329,12 @@ async function sendMakerSuiteRequest(request, response) {
328329 body.systemInstruction = prompt.system_instruction;
329330 }
330331
332+ if (isThinking && showThoughts) {
333+ generationConfig.thinkingConfig = {
334+ includeThoughts: true,
335+ };
336+ }
337+
331338 return body;
332339 }
333340
@@ -341,7 +348,6 @@ async function sendMakerSuiteRequest(request, response) {
341348 controller.abort();
342349 });
343350
344- const isThinking = model.includes('thinking');
345351 const apiVersion = isThinking ? 'v1alpha' : 'v1beta';
346352 const responseType = (stream ? 'streamGenerateContent' : 'generateContent');
347353