Skip to content

Commit 9e9bc49

Browse files
authored
Merge pull request #5644 from menloresearch/fix/some-of-model-settings-are-not-applied
fix: some of the model settings are not applied
2 parents 1e8c995 + db74f2c commit 9e9bc49

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

core/src/browser/models/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,22 @@ export const normalizeValue = (key: string, value: any) => {
5050
// Convert to integer
5151
return Math.floor(Number(value))
5252
}
53+
if (
54+
key === 'temperature' ||
55+
key === 'top_k' ||
56+
key === 'top_p' ||
57+
key === 'min_p' ||
58+
key === 'repeat_penalty' ||
59+
key === 'frequency_penalty' ||
60+
key === 'presence_penalty' ||
61+
key === 'repeat_last_n'
62+
) {
63+
// Convert to float
64+
const newValue = parseFloat(value)
65+
if (newValue !== null && !isNaN(newValue)) {
66+
return newValue
67+
}
68+
}
5369
return value
5470
}
5571

0 commit comments

Comments
 (0)