Skip to content

Commit e7861aa

Browse files
committed
fix: increase maxOutputTokens to 32768 and regenerate 11 truncated scripts
- Increase maxOutputTokens from 8192 to 32768 in generate-scripts.js - Add MAX_TOKENS finish-reason detection with automatic retry - Regenerate ep00, ep03, ep04, ep09, ep10, ep11, ep12, ep15, ep27, ep41, ep43 - All 44 scripts now end with complete sentences
1 parent 6b3cad5 commit e7861aa

12 files changed

+1220
-1050
lines changed

podcasts/generate-scripts.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async function callGemini(bundleContent, retries = 3) {
106106
system_instruction: { parts: [{ text: SYSTEM_PROMPT }] },
107107
contents: [{ parts: [{ text: bundleContent }] }],
108108
generationConfig: {
109-
maxOutputTokens: 8192,
109+
maxOutputTokens: 32768,
110110
temperature: 0.85
111111
}
112112
})
@@ -130,10 +130,19 @@ async function callGemini(bundleContent, retries = 3) {
130130
}
131131

132132
const data = await res.json();
133+
const finishReason = data.candidates?.[0]?.finishReason;
133134
const text = data.candidates?.[0]?.content?.parts?.[0]?.text;
134135
if (!text) {
135136
throw new Error('Gemini returned empty response');
136137
}
138+
if (finishReason === 'MAX_TOKENS') {
139+
if (attempt < retries) {
140+
console.log(` Truncated (MAX_TOKENS). Retry ${attempt}/${retries}...`);
141+
await sleep(2000 * attempt);
142+
continue;
143+
}
144+
console.log(' WARNING: Response truncated by MAX_TOKENS on final attempt');
145+
}
137146
return text;
138147
}
139148
throw new Error('All retries exhausted');

podcasts/scripts/ep00-welcome.txt

Lines changed: 56 additions & 83 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep03-navigating-repositories.txt

Lines changed: 71 additions & 122 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep04-the-learning-room.txt

Lines changed: 141 additions & 78 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep09-labels-milestones-projects.txt

Lines changed: 78 additions & 116 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep10-notifications.txt

Lines changed: 97 additions & 117 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep11-vscode-basics.txt

Lines changed: 99 additions & 96 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep12-git-source-control.txt

Lines changed: 209 additions & 86 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep15-accessible-code-review.txt

Lines changed: 156 additions & 70 deletions
Large diffs are not rendered by default.

podcasts/scripts/ep27-advanced-search.txt

Lines changed: 114 additions & 80 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)