fix: add thinkingConfig for Gemini 2.5+ models
gemini-2.5-flash and newer require thinkingBudget:0 to disable thinking mode, otherwise the API rejects the request or returns unexpected format. Regex matches gemini-2.5-* and gemini-3.x-* automatically. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
75eddd16a6
commit
a311a7f0d3
@@ -107,7 +107,10 @@ class ShowConfiguracionChat extends Component
|
||||
->withHeaders(['Content-Type' => 'application/json'])
|
||||
->post("{$url}?key={$key}", [
|
||||
'contents' => [['parts' => [['text' => 'Responde solo "ok"']]]],
|
||||
'generationConfig' => ['maxOutputTokens' => 5, 'temperature' => 0],
|
||||
'generationConfig' => array_merge(
|
||||
['maxOutputTokens' => 5, 'temperature' => 0],
|
||||
preg_match('/gemini-(2\.5|3[\.\d]*)/', $model) ? ['thinkingConfig' => ['thinkingBudget' => 0]] : []
|
||||
),
|
||||
]);
|
||||
|
||||
$ms = (int) ((microtime(true) - $inicio) * 1000);
|
||||
|
||||
Reference in New Issue
Block a user