fix: remove thinkingConfig entirely — field does not exist in Gemini API
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 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
54736a8742
commit
13199b1de4
@@ -112,10 +112,6 @@ class ShowConfiguracionChat extends Component
|
|||||||
'contents' => [['parts' => [['text' => 'Responde solo "ok"']]]],
|
'contents' => [['parts' => [['text' => 'Responde solo "ok"']]]],
|
||||||
'generationConfig' => ['maxOutputTokens' => 5, 'temperature' => 0],
|
'generationConfig' => ['maxOutputTokens' => 5, 'temperature' => 0],
|
||||||
];
|
];
|
||||||
if (preg_match('/gemini-(2\.5|3[\.\d]*)/', $model)) {
|
|
||||||
$body['thinkingConfig'] = ['thinkingBudget' => 0];
|
|
||||||
}
|
|
||||||
|
|
||||||
$response = Http::timeout(15)
|
$response = Http::timeout(15)
|
||||||
->withHeaders(['Content-Type' => 'application/json'])
|
->withHeaders(['Content-Type' => 'application/json'])
|
||||||
->post("{$url}?key={$key}", $body);
|
->post("{$url}?key={$key}", $body);
|
||||||
|
|||||||
@@ -25,15 +25,10 @@ class GeminiIntentService
|
|||||||
|
|
||||||
private function buildRequest(array $contents, array $genConfig = []): array
|
private function buildRequest(array $contents, array $genConfig = []): array
|
||||||
{
|
{
|
||||||
$body = [
|
return [
|
||||||
'contents' => $contents,
|
'contents' => $contents,
|
||||||
'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 100], $genConfig),
|
'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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,14 +24,10 @@ class GeminiVisionService
|
|||||||
|
|
||||||
private function buildRequest(array $contents, array $genConfig = []): array
|
private function buildRequest(array $contents, array $genConfig = []): array
|
||||||
{
|
{
|
||||||
$body = [
|
return [
|
||||||
'contents' => $contents,
|
'contents' => $contents,
|
||||||
'generationConfig' => array_merge(['temperature' => 0.1, 'maxOutputTokens' => 200], $genConfig),
|
'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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user