Fix maxOutputTokens too low for gemini-3.5-flash thinking model

gemini-3.5-flash uses thinking tokens that share the same budget as output
tokens. With maxOutputTokens=200 (vision) or 100 (intent), the model would
exhaust the budget on thinking (~288-1043 tokens) and truncate the actual
response to 8-11 tokens, producing garbage output like "040825".

Fix: 2048 for vision (needs full JSON), 1024 for intent, 512 for connection test.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Lizandro
2026-07-15 18:09:45 +00:00
co-authored by Claude Sonnet 4.6
parent 5c15f9f3fe
commit 157691e166
3 changed files with 3 additions and 3 deletions
@@ -110,7 +110,7 @@ class ShowConfiguracionChat extends Component
$inicio = microtime(true);
$body = [
'contents' => [['parts' => [['text' => 'Responde solo "ok"']]]],
'generationConfig' => ['maxOutputTokens' => 5, 'temperature' => 0],
'generationConfig' => ['maxOutputTokens' => 512, 'temperature' => 0],
];
$response = Http::timeout(15)
->withHeaders(['Content-Type' => 'application/json'])
+1 -1
View File
@@ -27,7 +27,7 @@ class GeminiIntentService
{
return [
'contents' => $contents,
'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 100], $genConfig),
'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 1024], $genConfig),
];
}
+1 -1
View File
@@ -34,7 +34,7 @@ class GeminiVisionService
$body = [
'contents' => $contents,
'generationConfig' => ['temperature' => 0.1, 'maxOutputTokens' => 200],
'generationConfig' => ['temperature' => 0.1, 'maxOutputTokens' => 2048],
];
$inicio = microtime(true);