From 13199b1de43e947a8f87e076f31885e86394a4e3 Mon Sep 17 00:00:00 2001 From: Lizandro Date: Wed, 15 Jul 2026 04:15:06 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20remove=20thinkingConfig=20entirely=20?= =?UTF-8?q?=E2=80=94=20field=20does=20not=20exist=20in=20Gemini=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The API returned: Unknown name "thinkingConfig": Cannot find field. gemini-2.5-flash works with a plain generateContent request, no special config needed. Co-Authored-By: Claude Sonnet 4.6 --- app/Http/Livewire/Chat/ShowConfiguracionChat.php | 4 ---- app/Services/GeminiIntentService.php | 7 +------ app/Services/GeminiVisionService.php | 6 +----- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/app/Http/Livewire/Chat/ShowConfiguracionChat.php b/app/Http/Livewire/Chat/ShowConfiguracionChat.php index a311144..50fb618 100755 --- a/app/Http/Livewire/Chat/ShowConfiguracionChat.php +++ b/app/Http/Livewire/Chat/ShowConfiguracionChat.php @@ -112,10 +112,6 @@ class ShowConfiguracionChat extends Component 'contents' => [['parts' => [['text' => 'Responde solo "ok"']]]], 'generationConfig' => ['maxOutputTokens' => 5, 'temperature' => 0], ]; - if (preg_match('/gemini-(2\.5|3[\.\d]*)/', $model)) { - $body['thinkingConfig'] = ['thinkingBudget' => 0]; - } - $response = Http::timeout(15) ->withHeaders(['Content-Type' => 'application/json']) ->post("{$url}?key={$key}", $body); diff --git a/app/Services/GeminiIntentService.php b/app/Services/GeminiIntentService.php index 018c4c3..11b7d3f 100644 --- a/app/Services/GeminiIntentService.php +++ b/app/Services/GeminiIntentService.php @@ -25,15 +25,10 @@ class GeminiIntentService private function buildRequest(array $contents, array $genConfig = []): array { - $body = [ + return [ 'contents' => $contents, 'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 100], $genConfig), ]; - // thinkingConfig goes at root level (NOT inside generationConfig) for 2.5+ models - if (preg_match('/gemini-(2\.5|3[\.\d]*)/', $this->model)) { - $body['thinkingConfig'] = ['thinkingBudget' => 0]; - } - return $body; } /** diff --git a/app/Services/GeminiVisionService.php b/app/Services/GeminiVisionService.php index a8af1fe..c7cdaf0 100644 --- a/app/Services/GeminiVisionService.php +++ b/app/Services/GeminiVisionService.php @@ -24,14 +24,10 @@ class GeminiVisionService private function buildRequest(array $contents, array $genConfig = []): array { - $body = [ + return [ 'contents' => $contents, 'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 200], $genConfig), ]; - if (preg_match('/gemini-(2\.5|3[\.\d]*)/', $this->model)) { - $body['thinkingConfig'] = ['thinkingBudget' => 0]; - } - return $body; } /**