fix(runner): correct Gemini SDK payload property thinkingBudgetTokens to thinkingBudget

This commit is contained in:
2026-05-19 16:16:08 -07:00
parent f2dcd5597d
commit 0dcde757f5
3 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
const fs = require('fs');
const file1 = 'src/llm/gemini-chat.ts';
let code1 = fs.readFileSync(file1, 'utf8');
code1 = code1.replace(/thinkingBudgetTokens:/g, 'thinkingBudget:');
fs.writeFileSync(file1, code1);
console.log("Fixed thinkingBudget property error for Runner");

View File

@@ -0,0 +1,10 @@
const fs = require('fs');
const file1 = 'src/llm/gemini-chat.ts';
if (fs.existsSync(file1)) {
let code1 = fs.readFileSync(file1, 'utf8');
code1 = code1.replace(/thinkingBudgetTokens/g, 'thinkingBudget');
fs.writeFileSync(file1, code1);
}
console.log("Patched thinkingBudget parameter for Runner");

View File

@@ -114,7 +114,7 @@ export async function callGeminiChat(opts: {
} }
if (opts.includeThoughts) { if (opts.includeThoughts) {
config.thinkingConfig = { thinkingBudgetTokens: 1024 }; config.thinkingConfig = { thinkingBudget: 1024 };
} }
const fns = toGeminiFunctions(opts.tools ?? []); const fns = toGeminiFunctions(opts.tools ?? []);
@@ -174,7 +174,7 @@ export async function* streamGeminiChat(opts: {
const config: any = { const config: any = {
temperature: opts.temperature ?? 0.7, temperature: opts.temperature ?? 0.7,
maxOutputTokens: 8192, maxOutputTokens: 8192,
thinkingConfig: { thinkingBudgetTokens: 1024 }, thinkingConfig: { thinkingBudget: 1024 },
}; };
if (opts.systemPrompt) { if (opts.systemPrompt) {