Add the enable_thinking parameter to Qwen3
Check Existing Issues
- [x] I have searched the existing issues and discussions.
Problem Description
The latest Qwen3 cannot switch response mode in the current open webui version
Desired Solution you'd like
Add the enable_thinking parameter to Qwen3
Alternatives Considered
Add the enable_thinking parameter to Qwen3
Additional Context
No response
If it is really impossible to add options to a single model, providing extra_body option is also fine. At least we have a way to solve some minor adaptation problems by ourselves.
(;´д`)ゞ
+1
To disable the thinking process, what is required of you is to add /no_think to your prompt (for the current round) or the system message (for the entire dialogue) without making any other settings.
If it is really impossible to add options to a single model, providing
extra_bodyoption is also fine. At least we have a way to solve some minor adaptation problems by ourselves. (;´д`)ゞ
Although as stated in https://github.com/open-webui/open-webui/issues/1484 , Function can cover this usage scenario, but using Function is too much like using a sledgehammer to crack a nut.
...( _ _)ノ|
To disable the thinking process, what is required of you is to add
no_thinkto your prompt (for the current round) or the system message (for the entire dialogue) without making any other settings.
In some cases (like qwen-plus provided by aliyun) , enable_thinking is turned off by default, which leads to the inability to enable the thinking process.
If it is really impossible to add options to a single model, providing
extra_bodyoption is also fine. At least we have a way to solve some minor adaptation problems by ourselves. (;´д`)ゞAlthough as stated in #1484 ,
Functioncan cover this usage scenario, but usingFunctionis too much like using a sledgehammer to crack a nut. ...( _ _)ノ|
As mentioned above, Function can be used for this.
Yesterday I found Gemini Safety Settings off .
So...
from pydantic import BaseModel, Field
from typing import Optional
class Filter:
class Valves(BaseModel):
enable_thinking: bool = Field(
default=True, description="whether reasoning or not"
)
thinking_budget: int = Field(default=38912, description="max reasoning length")
pass
def __init__(self):
# Indicates custom file handling logic. This flag helps disengage default routines in favor of custom
# implementations, informing the WebUI to defer file-related operations to designated methods within this class.
# Alternatively, you can remove the files directly from the body in from the inlet hook
# self.file_handler = True
# Initialize 'valves' with specific configurations. Using 'Valves' instance helps encapsulate settings,
# which ensures settings are managed cohesively and not confused with operational flags like 'file_handler'.
self.valves = self.Valves()
pass
def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
# Modify the request body or validate it before processing by the chat completion API.
# This function is the pre-processor for the API where various checks on the input can be performed.
# It can also modify the request before sending it to the API.
body["enable_thinking"] = self.valves.enable_thinking
if self.valves.enable_thinking and self.valves.thinking_budget > 0:
body["thinking_budget"] = self.valves.thinking_budget
return body
- place it in http://your-webui-url/admin/functions as a
Filter Function - go to http://your-webui-url/workspace/models, create a new model based on qwen3 (in my case, based on qwen-plus-latest) and use
filteryou created in the previous step - use this new model
I'm a novice, so I don't know why it works. But, it is not as complicated as Pipe Function, and, it just works.
A switch to turn on thinking could be added at the bottom of the dialog so that you can choose whether to start thinking or not
This one works. But does not allow user to toggle in chat config.
from pydantic import BaseModel, Field
from typing import Optional
class Filter:
class Valves(BaseModel):
enable_thinking: bool = Field(
default=True, description="whether reasoning or not"
)
def __init__(self):
self.valves = self.Valves()
def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict:
body["chat_template_kwargs"] = {"enable_thinking": self.valves.enable_thinking}
return body
Very important, in title generation we don't need to be able to force the non thinking version to generate instead of the thinking version for Qwen3
If it is really impossible to add options to a single model, providing
extra_bodyoption is also fine. At least we have a way to solve some minor adaptation problems by ourselves. (;´д`)ゞAlthough as stated in #1484 ,
Functioncan cover this usage scenario, but usingFunctionis too much like using a sledgehammer to crack a nut. ...( _ _)ノ|
We need custom model parameter settings in OpenWebUI. Adding some simple parameters through Functions complicates model management process.
The "Think" or "Reason" toggles are becoming fairly standard on AI chat interfaces and apps alike. I think a toggle such as that (or potentially enhanced with a dropdown, on the toggle, to fine-tune the thinking effort/level on models that support it) would address a lot of the before mentioned desires, in a user friendly way, that is standard with what users are coming to expect with AI chat interfaces
![]()
![]()
The "Think" or "Reason" toggles are becoming fairly standard on AI chat interfaces and apps alike. I think a toggle such as that (or potentially enhanced with a dropdown, on the toggle, to fine-tune the thinking effort/level on models that support it) would address a lot of the before mentioned desires, in a user friendly way, that is standard with what users are coming to expect with AI chat interfaces
In fact, they can be different models under the button. For instance, deepseek v3 and deepseek r1 are different models even it is rendered as a button toggle.
Now different models have different ways to enable reasoning.
How to make a toggle work with different models may be a complicated challenge.
(;′⌒`)
Ideally, it would be actioned by the standard openai "reasoning" field, with the effort object. But, openai reasoning.effort doesn't support disabling currently, just low/medium/high. So yah, being flexible for various models will be the hard part.
But I do think the think/reason toggle, from a ui perspective, is the way to go in terms of user experience
I think could let an administrator to configure the thinking option for the model, can turn it on/off, or turn it on to use another thinking model.
The think option is not displayed by default.
Now different models have different ways to enable reasoning. How to make a toggle work with different models may be a complicated challenge. (;′⌒`)
@1790374044 that's true
There are several publicly available hybrid thinking models, but a standard has not been established yet.
https://huggingface.co/nvidia/Llama-3_3-Nemotron-Super-49B-v1 https://huggingface.co/NousResearch/DeepHermes-3-Llama-3-8B-Preview
I don’t think this feature will follow an official API standard, but I believe Qwen’s approach could be adopted as the de facto standard.
Perhaps we can use a function to add custom buttons (similar to enabling a filter when pressed, and if they are checked in the model settings interface, they will be displayed Because they function like filters, we can fully customize their behavior after pressing the button, such as adding a sentence to enable or disable inference when prompted by the system
How would you handle the fact that in thinking and non-thinking mode, different sampling parameters are recommended?
This one works. But does not allow user to toggle in chat config.这个可以运行,但不允许用户在聊天配置中切换。
from pydantic import BaseModel, Field from typing import Optional
class Filter: class Valves(BaseModel): enable_thinking: bool = Field( default=True, description="whether reasoning or not" )
def __init__(self): self.valves = self.Valves() def inlet(self, body: dict, __user__: Optional[dict] = None) -> dict: body["chat_template_kwargs"] = {"enable_thinking": self.valves.enable_thinking} return body
It looks like this must be done by removing the parameter --enable-reasoning --reasoning-parser deepseek_r1 on the vllm side, or else it will cause the output to be mistakenly thought of as thinking
To disable the thinking process, what is required of you is to add
/no_thinkto your prompt (for the current round) or the system message (for the entire dialogue) without making any other settings.
Specifically, you can add /think and /no_think to user prompts or system messages to switch the model’s thinking mode from turn to turn.
openwebui是否可以加个按钮,实现自动给用户prompt尾部添加/no_think或/think
How about this one?
Add a swtich checkbox on model edit page to enable switching think/non-think mode
Then add a think button on message input
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
If anyone were interested in this solution, I could submit the code.
For prompting, I would want the switch on the chat window or model selector, not buried deep in the model details. Perhaps the model details page could have configuration on how to apply the switch (/think and /no_think for qwen3).
Of more interest to me though would be Open Web UI turning off thinking for certain operations automatically, like for summary generation.
@dongfangzan I'm interested in this, can you upload to github?
I just tested to verify, title and tag generation at the least don't work without putting /no_think in the prompts that are used. I'm guessing because the output ends up not being formatted like the prompt declares because of the extra <thinking></thinking>. Also, thinking is much slower and unnecessary (waste of resources) for title and tag generation. Being able to teach OpenWebUI how to enable/disable thinking for each model on a per-query basis would allow OpenWebUI to fix this problem automatically.
For image and code generation, I would like the model to think deeply, but I believe things will break if the output includes the <thinking></thinking> tags. This is another situation where it feels like OpenWebUI should be aware of how models think and filter that out of the final response.
How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode
Then add a think button on message input
![]()
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
If anyone were interested in this solution, I could submit the code.
I'm sorry if I offended you.
If I understand correctly, is this solution only effective for qwen3?
If it is a solution limited to qwen3, might open-webui not accept such a pr?
>︿<
How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode
Then add a think button on message input
![]()
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
If anyone were interested in this solution, I could submit the code.
I'm sorry if I offended you.
If I understand correctly, is this solution only effective for qwen3? If it is a solution limited to qwen3, might open-webui not accept such a pr? >︿<
No, any model can be effective with this solution if they used the same parameter enable_thinking: true. However, for now there is only one model which support switching thinking/non-thinking modes.
You can have a look at the qwen3 Offical document below.
Nevermind whether open-webui could accept this pr, I've used it in my production.
How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode
Then add a think button on message input
![]()
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
If anyone were interested in this solution, I could submit the code.
I'm sorry if I offended you. If I understand correctly, is this solution only effective for qwen3? If it is a solution limited to qwen3, might open-webui not accept such a pr? >︿<
No, any model can be effective with this solution if they used the same parameter
enable_thinking: true. However, for now there is only one model which support switching thinking/non-thinking modes.You can have a look at the qwen3 Offical document below.
Nevermind whether open-webui could accept this pr, I've used it in my production.
However, for now there is only one model which support switching thinking/non-thinking modes.
In fact, there are some other models. For example,Claude 3.7 Sonnet, Llama-3_3-Nemotron-Super-49B-v1
...( _ _)ノ|
How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode
Then add a think button on message input
![]()
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
If anyone were interested in this solution, I could submit the code.
I'm sorry if I offended you. If I understand correctly, is this solution only effective for qwen3? If it is a solution limited to qwen3, might open-webui not accept such a pr? >︿<
No, any model can be effective with this solution if they used the same parameter
enable_thinking: true. However, for now there is only one model which support switching thinking/non-thinking modes. You can have a look at the qwen3 Offical document below.Nevermind whether open-webui could accept this pr, I've used it in my production.
However, for now there is only one model which support switching thinking/non-thinking modes.
In fact, there are some other models. For example,Claude 3.7 Sonnet, Llama-3_3-Nemotron-Super-49B-v1 ...( _ _)ノ|
Alright, I really didn't notice that. Most of my works are related to Qwen. This is indeed a difficult problem to solve if there is not a standard API.
Actually, I've been curious for a long time...
Why not place some dynamically generated buttons next to the "Web Search" button based on the Filter used?
Clicking the button would open a pop-up window containing a toggle switch and configuration options for the Filter.
Does this sound like it could serve as a fallback solution for adapting models?
¯\_(ツ)_/¯


