fix(kb-intent): reduce batch size 40→20 intents, raise max_tokens to 5000

Token budget was too low for 40 intents — responses were truncated mid-JSON,
causing "No JSON array found" on ~88% of batches. Fixes 880 errors/run.
Also adds partial-JSON truncation recovery and raw response debug logging.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014p87VFec84hNaf2WpvmLrW
This commit is contained in:
2026-07-01 22:44:22 -05:00
parent e99c3aa171
commit 554488aefa
+1 -1
View File
@@ -204,7 +204,7 @@ foreach ($BATCHES as $idx => $batch) {
$num = $idx + 1; $num = $idx + 1;
log_line("Batch {$num}/{$totalBatches}: {$batch['topic']}"); log_line("Batch {$num}/{$totalBatches}: {$batch['topic']}");
$user = "Generate 40 KB intents for the topic: {$batch['topic']}.\n" $user = "Generate 20 KB intents for the topic: {$batch['topic']}.\n"
. "Subtopics to cover: {$batch['desc']}.\n" . "Subtopics to cover: {$batch['desc']}.\n"
. "Prefix every intent_name with \"{$batch['id']}_\".\n" . "Prefix every intent_name with \"{$batch['id']}_\".\n"
. "Category string to use: \"{$batch['category']}\"."; . "Category string to use: \"{$batch['category']}\".";