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

View File

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

View File

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