diff --git a/includes/DeepResearchAgent.php b/includes/DeepResearchAgent.php index eab2f5f..45a2236 100644 --- a/includes/DeepResearchAgent.php +++ b/includes/DeepResearchAgent.php @@ -1133,7 +1133,10 @@ PROMPT; ['role' => 'user', 'content' => $prompt], ]; $synthTemp = ($advocateRole !== '') ? min($temperature, 0.20) : $temperature; - $opts = ['json' => true, 'temperature' => $synthTemp, 'max_tokens' => 4000, 'timeout' => 180]; + // Advocate briefs require ~4-6K tokens (brief + strengths + weaknesses + uncertainty). + // Non-advocate deep-research responses are shorter (~2-3K). Use separate limits. + $synthMaxTokens = ($advocateRole !== '') ? 6000 : 4000; + $opts = ['json' => true, 'temperature' => $synthTemp, 'max_tokens' => $synthMaxTokens, 'timeout' => 180]; $thinkingTrace = null; try { @@ -1153,9 +1156,9 @@ PROMPT; $raw = $this->azure->withDeployment('gpt-4o')->chatText($messages, $opts); $deployLabel = 'gpt-4o'; } elseif ($engine === 'azure_mini' && $this->azure instanceof DbnBedrockGateway) { - // When Bedrock enabled, azure_mini → Haiku (fast, ~20-40s synthesis) + // When Bedrock enabled, azure_mini → Haiku (fast, ~20-50s synthesis) $haiku = $this->azure->withDeployment(DbnBedrockModelRouter::LITELLM_HAIKU); - $raw = $haiku->chatText($messages, array_merge($opts, ['max_tokens' => 2500, 'timeout' => 90])); + $raw = $haiku->chatText($messages, array_merge($opts, ['timeout' => 90])); $deployLabel = 'Claude Haiku 4.5 (AWS Bedrock)'; $thinkingTrace = null; } elseif ($engine === 'claude_sonnet' || ($this->azure instanceof DbnBedrockGateway)) {