Skip to content

Commit d4fa15d

Browse files
authored
remove topp default value 0.0 (QwenLM#785)
1 parent 0922437 commit d4fa15d

File tree

3 files changed

+4
-11
lines changed

3 files changed

+4
-11
lines changed

packages/core/src/core/client.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,6 @@ describe('Gemini Client (client.ts)', () => {
434434
config: {
435435
abortSignal,
436436
systemInstruction: getCoreSystemPrompt(''),
437-
temperature: 0,
438-
topP: 1,
439437
tools: [
440438
{
441439
functionDeclarations: [
@@ -486,7 +484,6 @@ describe('Gemini Client (client.ts)', () => {
486484
abortSignal,
487485
systemInstruction: getCoreSystemPrompt(''),
488486
temperature: 0.9,
489-
topP: 1, // from default
490487
topK: 20,
491488
tools: [
492489
{
@@ -2461,7 +2458,6 @@ ${JSON.stringify(
24612458
abortSignal,
24622459
systemInstruction: getCoreSystemPrompt(''),
24632460
temperature: 0.5,
2464-
topP: 1,
24652461
},
24662462
contents,
24672463
},

packages/core/src/core/client.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,7 @@ export class GeminiClient {
115115
private chat?: GeminiChat;
116116
private contentGenerator?: ContentGenerator;
117117
private readonly embeddingModel: string;
118-
private readonly generateContentConfig: GenerateContentConfig = {
119-
temperature: 0,
120-
topP: 1,
121-
};
118+
private readonly generateContentConfig: GenerateContentConfig = {};
122119
private sessionTurnCount = 0;
123120

124121
private readonly loopDetector: LoopDetectionService;

packages/core/src/core/openaiContentGenerator/pipeline.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,9 +302,9 @@ export class ContentGenerationPipeline {
302302
};
303303

304304
const params = {
305-
// Parameters with request fallback and defaults
306-
temperature: getParameterValue('temperature', 'temperature', 0.0),
307-
top_p: getParameterValue('top_p', 'topP', 1.0),
305+
// Parameters with request fallback but no defaults
306+
...addParameterIfDefined('temperature', 'temperature', 'temperature'),
307+
...addParameterIfDefined('top_p', 'top_p', 'topP'),
308308

309309
// Max tokens (special case: different property names)
310310
...addParameterIfDefined('max_tokens', 'max_tokens', 'maxOutputTokens'),

0 commit comments

Comments
 (0)