Gemini: Fix requesting thought blocks

823b9db6f6d6403354433584ecd02f14c603de68

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

1 files changed, +7 -1Showing whitespace changes
src/endpoints/backends/chat-completions.js+7 -1
@@ -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');
291292
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 }
330331
332 if (isThinking && showThoughts) {
333 generationConfig.thinkingConfig = {
334 includeThoughts: true,
335 };
336 }
337
331 return body;338 return body;
332 }339 }
333340
@@ -341,7 +348,6 @@ async function sendMakerSuiteRequest(request, response) {
341 controller.abort();348 controller.abort();
342 });349 });
343350
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');
347353