GOOGLE THONK IS BACK 🚀 Closes #4024
| @@ -2049,7 +2049,7 @@ | ||
| 2049 | 2049 | </span> |
| 2050 | 2050 | </div> |
| 2051 | 2051 | </div> |
| 2052 | 2052 | <div class="range-block" data-source="deepseek,openrouter,custom,claude,xai,makersuite"> |
| 2053 | 2053 | <label for="openai_show_thoughts" class="checkbox_label widthFreeExpand"> |
| 2054 | 2054 | <input id="openai_show_thoughts" type="checkbox" /> |
| 2055 | 2055 | <span> |
| @@ -350,6 +350,7 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 350 | 350 | const enableWebSearch = Boolean(request.body.enable_web_search); |
| 351 | 351 | const requestImages = Boolean(request.body.request_images); |
| 352 | 352 | const reasoningEffort = String(request.body.reasoning_effort); |
| 353 | + const includeReasoning = Boolean(request.body.include_reasoning); | |
| 353 | 354 | const isGemma = model.includes('gemma'); |
| 354 | 355 | const isLearnLM = model.includes('learnlm'); |
| 355 | 356 | |
| @@ -379,10 +380,8 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 379 | 380 | 'gemini-1.5-flash-8b-exp-0924', |
| 380 | 381 | ]; |
| 381 | 382 | |
| 382 | - const thinkingBudgetModels = [ | |
| 383 | + const isThinkingConfigModel = m => /^gemini-2.5-(flash|pro)/.test(m); | |
| 383 | - 'gemini-2.5-flash-preview-04-17', | |
| 384 | + const isThinkingBudgetModel = m => /^gemini-2.5-flash/.test(m); | |
| 384 | - 'gemini-2.5-flash-preview-05-20', | |
| 385 | - ]; | |
| 386 | 385 | |
| 387 | 386 | const noSearchModels = [ |
| 388 | 387 | 'gemini-2.0-flash-lite', |
| @@ -435,14 +434,19 @@ async function sendMakerSuiteRequest(request, response) { | ||
| 435 | 434 | tools.push({ function_declarations: functionDeclarations }); |
| 436 | 435 | } |
| 437 | 436 | |
| 438 | 437 | if (thinkingBudgetModels.includesisThinkingConfigModel(model)) { |
| 439 | - const thinkingBudget = calculateGoogleBudgetTokens(generationConfig.maxOutputTokens, reasoningEffort); | |
| 438 | + const thinkingConfig = { includeThoughts: includeReasoning }; | |
| 440 | 439 | |
| 440 | + if (isThinkingBudgetModel(model)) { | |
| 441 | + const thinkingBudget = calculateGoogleBudgetTokens(generationConfig.maxOutputTokens, reasoningEffort); | |
| 441 | 442 | if (Number.isInteger(thinkingBudget)) { |
| 442 | - generationConfig.thinkingConfig = { thinkingBudget: thinkingBudget }; | |
| 443 | + thinkingConfig.thinkingBudget = thinkingBudget; | |
| 443 | 444 | } |
| 444 | 445 | } |
| 445 | 446 | |
| 447 | + generationConfig.thinkingConfig = thinkingConfig; | |
| 448 | + } | |
| 449 | + | |
| 446 | 450 | let body = { |
| 447 | 451 | contents: prompt.contents, |
| 448 | 452 | safetySettings: safetySettings, |