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