From 941c787806bef9015a32733b7a6fccac580d3d1c Mon Sep 17 00:00:00 2001 From: ferret99gt Date: Fri, 14 Feb 2025 12:02:55 -0500 Subject: [PATCH 1/2] Add presence penalty (openAi/ollama/others) and repeat penalty (ollama only?) - Add Presence Penalty, which I believe most providers have. - Add repeat_penalty, an Ollama / Llama.cpp only parameter - Widen temperature range to 2 (supported by many providers and similar front ends) - Widen Top K range (supported by many providers and similar front ends) - Adjust description of freqency_penalty in line with OpenAI documentation - Add presence_penalty with an OpenAI documentation based description - Add repeat_penalty with an Ollama documentation based description --- .../Settings/Advanced/AdvancedParams.svelte | 125 +++++++++++++++++- .../components/chat/Settings/General.svelte | 4 + src/lib/i18n/locales/en-US/translation.json | 2 + 3 files changed, 125 insertions(+), 6 deletions(-) diff --git a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte index 0ab38adf4..9a54e5627 100644 --- a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte +++ b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte @@ -235,7 +235,7 @@ id="steps-range" type="range" min="0" - max="1" + max="2" step="0.05" bind:value={params.temperature} class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700" @@ -247,7 +247,7 @@ type="number" class=" bg-transparent text-center w-14" min="0" - max="1" + max="2" step="any" /> @@ -499,7 +499,7 @@ id="steps-range" type="range" min="0" - max="100" + max="1000" step="0.5" bind:value={params.top_k} class="w-full h-2 rounded-lg appearance-none cursor-pointer dark:bg-gray-700" @@ -633,7 +633,7 @@
+
+ + {/if} + + +
+ +
+
+ {$i18n.t('Presence Penalty')} +
+ + +
+
+ + {#if (params?.presence_penalty ?? null) !== null} +
+
+ +
+
+ +
+
+ {/if} +
+ + +
+ +
+
+ {$i18n.t('Repeat Penalty')} +
+ + +
+
+ + {#if (params?.repeat_penalty ?? null) !== null} +
+
+ +
+
+ diff --git a/src/lib/components/chat/Settings/General.svelte b/src/lib/components/chat/Settings/General.svelte index cb7843c69..f77060617 100644 --- a/src/lib/components/chat/Settings/General.svelte +++ b/src/lib/components/chat/Settings/General.svelte @@ -51,6 +51,8 @@ temperature: null, reasoning_effort: null, frequency_penalty: null, + presence_penalty: null, + repeat_penalty: null, repeat_last_n: null, mirostat: null, mirostat_eta: null, @@ -343,6 +345,8 @@ params.reasoning_effort !== null ? params.reasoning_effort : undefined, frequency_penalty: params.frequency_penalty !== null ? params.frequency_penalty : undefined, + presence_penalty: params.frequency_penalty !== null ? params.frequency_penalty : undefined, + repeat_penalty: params.frequency_penalty !== null ? params.frequency_penalty : undefined, repeat_last_n: params.repeat_last_n !== null ? params.repeat_last_n : undefined, mirostat: params.mirostat !== null ? params.mirostat : undefined, mirostat_eta: params.mirostat_eta !== null ? params.mirostat_eta : undefined, diff --git a/src/lib/i18n/locales/en-US/translation.json b/src/lib/i18n/locales/en-US/translation.json index 42eddc473..23c5648f3 100644 --- a/src/lib/i18n/locales/en-US/translation.json +++ b/src/lib/i18n/locales/en-US/translation.json @@ -759,6 +759,7 @@ "Positive attitude": "", "Prefix ID": "", "Prefix ID is used to avoid conflicts with other connections by adding a prefix to the model IDs - leave empty to disable": "", + "Presence Penalty": "", "Previous 30 days": "", "Previous 7 days": "", "Profile Image": "", @@ -795,6 +796,7 @@ "Rename": "", "Reorder Models": "", "Repeat Last N": "", + "Repeat Penalty": "", "Reply in Thread": "", "Request Mode": "", "Reranking Model": "", From bb729575354ad39f5a0d450f005c6e1d63eede10 Mon Sep 17 00:00:00 2001 From: ferret99gt Date: Fri, 14 Feb 2025 18:02:30 -0500 Subject: [PATCH 2/2] Update field label for Ollama convention --- .../components/chat/Settings/Advanced/AdvancedParams.svelte | 4 ++-- src/lib/i18n/locales/en-US/translation.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte index 9a54e5627..d9a7277bf 100644 --- a/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte +++ b/src/lib/components/chat/Settings/Advanced/AdvancedParams.svelte @@ -746,14 +746,14 @@
- {$i18n.t('Repeat Penalty')} + {$i18n.t('Repeat Penalty (Ollama)')}