mirror of
https://github.com/open-webui/open-webui
synced 2025-03-04 11:29:59 +00:00
enh: reasoning_effort param support for openai
This commit is contained in:
parent
ea7d4ec6ea
commit
aaf97b85dc
@ -671,6 +671,10 @@ def apply_params_to_form_data(form_data, model):
|
|||||||
|
|
||||||
if "frequency_penalty" in params:
|
if "frequency_penalty" in params:
|
||||||
form_data["frequency_penalty"] = params["frequency_penalty"]
|
form_data["frequency_penalty"] = params["frequency_penalty"]
|
||||||
|
|
||||||
|
if "reasoning_effort" in params:
|
||||||
|
form_data["reasoning_effort"] = params["reasoning_effort"]
|
||||||
|
|
||||||
return form_data
|
return form_data
|
||||||
|
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ def apply_model_params_to_body_openai(params: dict, form_data: dict) -> dict:
|
|||||||
"top_p": float,
|
"top_p": float,
|
||||||
"max_tokens": int,
|
"max_tokens": int,
|
||||||
"frequency_penalty": float,
|
"frequency_penalty": float,
|
||||||
|
"reasoning_effort": str,
|
||||||
"seed": lambda x: x,
|
"seed": lambda x: x,
|
||||||
"stop": lambda x: [bytes(s, "utf-8").decode("unicode_escape") for s in x],
|
"stop": lambda x: [bytes(s, "utf-8").decode("unicode_escape") for s in x],
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
seed: null,
|
seed: null,
|
||||||
stop: null,
|
stop: null,
|
||||||
temperature: null,
|
temperature: null,
|
||||||
|
reasoning_effort: null,
|
||||||
frequency_penalty: null,
|
frequency_penalty: null,
|
||||||
repeat_last_n: null,
|
repeat_last_n: null,
|
||||||
mirostat: null,
|
mirostat: null,
|
||||||
@ -158,7 +159,7 @@
|
|||||||
<div class="flex mt-0.5 space-x-2">
|
<div class="flex mt-0.5 space-x-2">
|
||||||
<div class=" flex-1">
|
<div class=" flex-1">
|
||||||
<input
|
<input
|
||||||
class="w-full rounded-lg py-2 px-4 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
class="w-full rounded-lg py-2 px-1 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
||||||
type="text"
|
type="text"
|
||||||
placeholder={$i18n.t('Enter stop sequence')}
|
placeholder={$i18n.t('Enter stop sequence')}
|
||||||
bind:value={params.stop}
|
bind:value={params.stop}
|
||||||
@ -224,6 +225,47 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class=" py-0.5 w-full justify-between">
|
||||||
|
<Tooltip
|
||||||
|
content={$i18n.t('Constrains effort on reasoning for reasoning models. (Default: medium)')}
|
||||||
|
placement="top-start"
|
||||||
|
className="inline-tooltip"
|
||||||
|
>
|
||||||
|
<div class="flex w-full justify-between">
|
||||||
|
<div class=" self-center text-xs font-medium">
|
||||||
|
{$i18n.t('Reasoning Effort')}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="p-1 px-3 text-xs flex rounded transition flex-shrink-0 outline-none"
|
||||||
|
type="button"
|
||||||
|
on:click={() => {
|
||||||
|
params.reasoning_effort = (params?.reasoning_effort ?? null) === null ? 'medium' : null;
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{#if (params?.reasoning_effort ?? null) === null}
|
||||||
|
<span class="ml-2 self-center"> {$i18n.t('Default')} </span>
|
||||||
|
{:else}
|
||||||
|
<span class="ml-2 self-center"> {$i18n.t('Custom')} </span>
|
||||||
|
{/if}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</Tooltip>
|
||||||
|
|
||||||
|
{#if (params?.reasoning_effort ?? null) !== null}
|
||||||
|
<div class="flex mt-0.5 space-x-2">
|
||||||
|
<div class=" flex-1">
|
||||||
|
<input
|
||||||
|
class="w-full rounded-lg py-2 px-1 text-sm dark:text-gray-300 dark:bg-gray-850 outline-none"
|
||||||
|
type="text"
|
||||||
|
placeholder={$i18n.t('Enter reasoning effort')}
|
||||||
|
bind:value={params.reasoning_effort}
|
||||||
|
autocomplete="off"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class=" py-0.5 w-full justify-between">
|
<div class=" py-0.5 w-full justify-between">
|
||||||
<Tooltip
|
<Tooltip
|
||||||
content={$i18n.t(
|
content={$i18n.t(
|
||||||
|
Loading…
Reference in New Issue
Block a user