remove topp default value 0.0 (#785)

This commit is contained in:
Fan
2025-10-09 15:41:57 +08:00
committed by GitHub
parent 0922437bd5
commit d4fa15dd53
3 changed files with 4 additions and 11 deletions

View File

@@ -434,8 +434,6 @@ describe('Gemini Client (client.ts)', () => {
config: {
abortSignal,
systemInstruction: getCoreSystemPrompt(''),
temperature: 0,
topP: 1,
tools: [
{
functionDeclarations: [
@@ -486,7 +484,6 @@ describe('Gemini Client (client.ts)', () => {
abortSignal,
systemInstruction: getCoreSystemPrompt(''),
temperature: 0.9,
topP: 1, // from default
topK: 20,
tools: [
{
@@ -2461,7 +2458,6 @@ ${JSON.stringify(
abortSignal,
systemInstruction: getCoreSystemPrompt(''),
temperature: 0.5,
topP: 1,
},
contents,
},

View File

@@ -115,10 +115,7 @@ export class GeminiClient {
private chat?: GeminiChat;
private contentGenerator?: ContentGenerator;
private readonly embeddingModel: string;
private readonly generateContentConfig: GenerateContentConfig = {
temperature: 0,
topP: 1,
};
private readonly generateContentConfig: GenerateContentConfig = {};
private sessionTurnCount = 0;
private readonly loopDetector: LoopDetectionService;

View File

@@ -302,9 +302,9 @@ export class ContentGenerationPipeline {
};
const params = {
// Parameters with request fallback and defaults
temperature: getParameterValue('temperature', 'temperature', 0.0),
top_p: getParameterValue('top_p', 'topP', 1.0),
// Parameters with request fallback but no defaults
...addParameterIfDefined('temperature', 'temperature', 'temperature'),
...addParameterIfDefined('top_p', 'top_p', 'topP'),
// Max tokens (special case: different property names)
...addParameterIfDefined('max_tokens', 'max_tokens', 'maxOutputTokens'),