thinkingBudget renamed to thinking_budget. see #494

This commit is contained in:
Mic 2025-09-08 22:00:00 +02:00
parent 9d34ef2cf7
commit 2b794690d8

View file

@ -24,25 +24,25 @@ export class GoogleGemini {
model = ''; model = '';
system_instruction = ''; system_instruction = '';
stream = false; stream = false;
thinkingBudget = ''; // Model default thinking_budget = ''; // Model default
constructor({ constructor({
apiKey = '', apiKey = '',
model = '', model = '',
system_instruction = '', system_instruction = '',
stream = false, stream = false,
thinkingBudget = '', thinking_budget = '',
} = {}) { } = {}) {
this.apiKey = apiKey; this.apiKey = apiKey;
this.model = model; this.model = model;
this.system_instruction = system_instruction; this.system_instruction = system_instruction;
this.stream = stream; this.stream = stream;
this.thinkingBudget = thinkingBudget.trim(); this.thinking_budget = thinking_budget.trim();
/* Info from: https://ai.google.dev/gemini-api/docs/thinking?#set-budget /* Info from: https://ai.google.dev/gemini-api/docs/thinking?#set-budget
# Turn on thinking with a specific token limit: "thinkingBudget": 1024 # Turn on thinking with a specific token limit: "thinking_budget": 1024
# Thinking off: "thinkingBudget": 0 # Thinking off: "thinking_budget": 0
# Turn on dynamic thinking: "thinkingBudget": -1 # Turn on dynamic thinking: "thinking_budget": -1
# Keep model default thinking: "thinkingBudget": "" # Keep model default thinking: "thinking_budget": ""
*/ */
} }
@ -100,10 +100,10 @@ export class GoogleGemini {
}; };
} }
if(this.thinkingBudget !== '') { if(this.thinking_budget !== '') {
google_gemini_body.generationConfig = { google_gemini_body.generationConfig = {
thinkingConfig: { thinkingConfig: {
thinkingBudget: this.thinkingBudget, thinking_budget: this.thinking_budget,
} }
}; };
} }