[GH-ISSUE #13314] Add the enable_thinking parameter to Qwen3 #55547

Closed
opened 2026-05-05 17:37:59 -05:00 by GiteaMirror · 42 comments
Owner

Originally created by @lingyezhixing on GitHub (Apr 29, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/13314

Check Existing Issues

  • 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

Originally created by @lingyezhixing on GitHub (Apr 29, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/13314 ### 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_
Author
Owner

@1790374044 commented on GitHub (Apr 29, 2025):

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.
(;´д`)ゞ

<!-- gh-comment-id:2837832301 --> @1790374044 commented on GitHub (Apr 29, 2025): 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. (;´д`)ゞ
Author
Owner

@ZV-Liu commented on GitHub (Apr 29, 2025):

+1

<!-- gh-comment-id:2837839493 --> @ZV-Liu commented on GitHub (Apr 29, 2025): +1
Author
Owner

@Wannabeasmartguy commented on GitHub (Apr 29, 2025):

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.

<!-- gh-comment-id:2837842783 --> @Wannabeasmartguy commented on GitHub (Apr 29, 2025): 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.
Author
Owner

@1790374044 commented on GitHub (Apr 29, 2025):

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. (;´д`)ゞ

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.
...( _ _)ノ|

<!-- gh-comment-id:2837849973 --> @1790374044 commented on GitHub (Apr 29, 2025): > 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. (;´д`)ゞ 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. ...( _ _)ノ|
Author
Owner

@1790374044 commented on GitHub (Apr 29, 2025):

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.

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.

<!-- gh-comment-id:2837861023 --> @1790374044 commented on GitHub (Apr 29, 2025): > 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. 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.
Author
Owner

@1790374044 commented on GitHub (Apr 30, 2025):

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. (;´д`)ゞ

Although as stated in #1484 , Function can cover this usage scenario, but using Function is 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
  1. place it in http://your-webui-url/admin/functions as a Filter Function
  2. 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 filter you created in the previous step
  3. 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.

<!-- gh-comment-id:2840635309 --> @1790374044 commented on GitHub (Apr 30, 2025): > > 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. (;´д`)ゞ > > Although as stated in [#1484](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. ...( _ _)ノ| As mentioned above, `Function` can be used for this. Yesterday I found [Gemini Safety Settings off](https://openwebui.com/f/kkoolldd/disable_gemini_content_safety_setting_for_openai_api_and_openrouter) . So... ```python 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 ``` 1. place it in http://your-webui-url/admin/functions as a `Filter Function` 2. 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 `filter` you created in the previous step 3. 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*.
Author
Owner

@zhongli0226 commented on GitHub (Apr 30, 2025):

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

<!-- gh-comment-id:2840663254 --> @zhongli0226 commented on GitHub (Apr 30, 2025): 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
Author
Owner

@cpwan commented on GitHub (Apr 30, 2025):

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


<!-- gh-comment-id:2840991133 --> @cpwan commented on GitHub (Apr 30, 2025): This one works. But does not allow user to toggle in chat config. ```python 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 ```
Author
Owner

@TheNexter commented on GitHub (Apr 30, 2025):

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

<!-- gh-comment-id:2841310865 --> @TheNexter commented on GitHub (Apr 30, 2025): 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
Author
Owner

@Xi-Gong commented on GitHub (Apr 30, 2025):

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. (;´д`)ゞ

Although as stated in #1484 , Function can cover this usage scenario, but using Function is 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.

<!-- gh-comment-id:2841594903 --> @Xi-Gong commented on GitHub (Apr 30, 2025): > > 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. (;´д`)ゞ > > Although as stated in [#1484](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. ...( _ _)ノ| We need custom model parameter settings in OpenWebUI. Adding some simple parameters through Functions complicates model management process.
Author
Owner

@TheDropZone commented on GitHub (Apr 30, 2025):

Image Image

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

<!-- gh-comment-id:2841761968 --> @TheDropZone commented on GitHub (Apr 30, 2025): <img width="304" alt="Image" src="https://github.com/user-attachments/assets/d5b402f9-bbb5-436a-9df1-a17739a65515" /> <img width="337" alt="Image" src="https://github.com/user-attachments/assets/f4bc856b-2bf8-410f-913f-49dc65c8b8a7" /> 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
Author
Owner

@cpwan commented on GitHub (Apr 30, 2025):

Image Image

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.

<!-- gh-comment-id:2841787628 --> @cpwan commented on GitHub (Apr 30, 2025): > <img width="304" alt="Image" src="https://github.com/user-attachments/assets/d5b402f9-bbb5-436a-9df1-a17739a65515" /> > > <img width="337" alt="Image" src="https://github.com/user-attachments/assets/f4bc856b-2bf8-410f-913f-49dc65c8b8a7" /> > > 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.
Author
Owner

@1790374044 commented on GitHub (Apr 30, 2025):

Now different models have different ways to enable reasoning.
How to make a toggle work with different models may be a complicated challenge.
(;′⌒`)

<!-- gh-comment-id:2841796927 --> @1790374044 commented on GitHub (Apr 30, 2025): Now different models have different ways to enable reasoning. How to make a toggle work with different models may be a complicated challenge. (;′⌒`)
Author
Owner

@TheDropZone commented on GitHub (Apr 30, 2025):

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

<!-- gh-comment-id:2842296558 --> @TheDropZone commented on GitHub (Apr 30, 2025): 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
Author
Owner

@At87668 commented on GitHub (May 1, 2025):

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.

<!-- gh-comment-id:2844591225 --> @At87668 commented on GitHub (May 1, 2025): 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.
Author
Owner

@dongs0104 commented on GitHub (May 1, 2025):

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.

<!-- gh-comment-id:2845978411 --> @dongs0104 commented on GitHub (May 1, 2025): > 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.
Author
Owner

@EntropyYue commented on GitHub (May 11, 2025):

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

Image

<!-- gh-comment-id:2869608744 --> @EntropyYue commented on GitHub (May 11, 2025): 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 ![Image](https://github.com/user-attachments/assets/82bd20e3-39c6-47fb-ac4d-4ed5d8ecf415)
Author
Owner

@ssakar commented on GitHub (May 11, 2025):

How would you handle the fact that in thinking and non-thinking mode, different sampling parameters are recommended?

<!-- gh-comment-id:2869611386 --> @ssakar commented on GitHub (May 11, 2025): How would you handle the fact that in thinking and non-thinking mode, different sampling parameters are recommended?
Author
Owner

@kenvix commented on GitHub (May 11, 2025):

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

<!-- gh-comment-id:2870033708 --> @kenvix commented on GitHub (May 11, 2025): > 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
Author
Owner

@fifiand1 commented on GitHub (May 13, 2025):

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.

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.

Image
openwebui是否可以加个按钮,实现自动给用户prompt尾部添加/no_think或/think

<!-- gh-comment-id:2875473635 --> @fifiand1 commented on GitHub (May 13, 2025): > 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. > 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. ![Image](https://github.com/user-attachments/assets/0c6e2ceb-dc00-4aa7-a576-0a0a40f81707) openwebui是否可以加个按钮,实现自动给用户prompt尾部添加/no_think或/think
Author
Owner

@dongfangzan commented on GitHub (May 15, 2025):

How about this one?
Add a swtich checkbox on model edit page to enable switching think/non-think mode
Image

Then add a think button on message input
Image

Image

For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.

Image

If anyone were interested in this solution, I could submit the code.

<!-- gh-comment-id:2883379055 --> @dongfangzan commented on GitHub (May 15, 2025): How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode ![Image](https://github.com/user-attachments/assets/15aa7efb-ddb8-46fc-8e44-0e861107d3ae) Then add a think button on message input ![Image](https://github.com/user-attachments/assets/34c9933e-21cb-450e-ad46-c2041b74f698) <img width="1201" alt="Image" src="https://github.com/user-attachments/assets/1c313453-1ff0-43e1-9988-610365cf15da" /> For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button. <img width="854" alt="Image" src="https://github.com/user-attachments/assets/f11ae5ec-22fa-4c65-8658-c900701abc30" /> If anyone were interested in this solution, I could submit the code.
Author
Owner

@MicahZoltu commented on GitHub (May 15, 2025):

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.

<!-- gh-comment-id:2883403662 --> @MicahZoltu commented on GitHub (May 15, 2025): 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.
Author
Owner

@EntropyYue commented on GitHub (May 15, 2025):

@dongfangzan I'm interested in this, can you upload to github?

<!-- gh-comment-id:2883462303 --> @EntropyYue commented on GitHub (May 15, 2025): @dongfangzan I'm interested in this, can you upload to github?
Author
Owner

@MicahZoltu commented on GitHub (May 15, 2025):

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.

<!-- gh-comment-id:2883520170 --> @MicahZoltu commented on GitHub (May 15, 2025): 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.
Author
Owner

@MicahZoltu commented on GitHub (May 15, 2025):

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.

<!-- gh-comment-id:2883539642 --> @MicahZoltu commented on GitHub (May 15, 2025): 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.
Author
Owner

@1790374044 commented on GitHub (May 15, 2025):

How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode Image

Then add a think button on message input Image
Image

For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
Image

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?
>︿<

<!-- gh-comment-id:2883563787 --> @1790374044 commented on GitHub (May 15, 2025): > How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode ![Image](https://github.com/user-attachments/assets/15aa7efb-ddb8-46fc-8e44-0e861107d3ae) > > Then add a think button on message input ![Image](https://github.com/user-attachments/assets/34c9933e-21cb-450e-ad46-c2041b74f698) > <img alt="Image" width="1201" src="https://private-user-images.githubusercontent.com/21303403/444077706-1c313453-1ff0-43e1-9988-610365cf15da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzc3MDYtMWMzMTM0NTMtMWZmMC00M2UxLTk5ODgtNjEwMzY1Y2YxNWRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1ZjY1ZDA2ZjUxNWZiODIwOWI5Mzg3MDRkMTBhODYyMGJmZDg0MGFmNjVhZGFiYWNmZWNhZDgxYTU4OTMwOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K32JyX-yia1YLwJEjWJY5IoPyBijxLMZL0wFMEE3lUo"> > > For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button. > <img alt="Image" width="854" src="https://private-user-images.githubusercontent.com/21303403/444078776-f11ae5ec-22fa-4c65-8658-c900701abc30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzg3NzYtZjExYWU1ZWMtMjJmYS00YzY1LTg2NTgtYzkwMDcwMWFiYzMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1MmQ4OTg3YWU4NjczZjc0NjYzN2M1NjY4YzIxYTVjYzgwY2JkYTE2YjllNGIwMDM1MDRlMDM5ZjZlOTA3NDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cx46qLdOZFrAzejxrSiqlOykcP02MPg_Jg8fyOgct4w"> > > 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? >︿<
Author
Owner

@dongfangzan commented on GitHub (May 15, 2025):

How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode Image
Then add a think button on message input Image
Image
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
Image
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.

Image

Nevermind whether open-webui could accept this pr, I've used it in my production.

<!-- gh-comment-id:2883587155 --> @dongfangzan commented on GitHub (May 15, 2025): > > How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode ![Image](https://github.com/user-attachments/assets/15aa7efb-ddb8-46fc-8e44-0e861107d3ae) > > Then add a think button on message input ![Image](https://github.com/user-attachments/assets/34c9933e-21cb-450e-ad46-c2041b74f698) > > <img alt="Image" width="1201" src="https://private-user-images.githubusercontent.com/21303403/444077706-1c313453-1ff0-43e1-9988-610365cf15da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzc3MDYtMWMzMTM0NTMtMWZmMC00M2UxLTk5ODgtNjEwMzY1Y2YxNWRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1ZjY1ZDA2ZjUxNWZiODIwOWI5Mzg3MDRkMTBhODYyMGJmZDg0MGFmNjVhZGFiYWNmZWNhZDgxYTU4OTMwOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K32JyX-yia1YLwJEjWJY5IoPyBijxLMZL0wFMEE3lUo"> > > For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button. > > <img alt="Image" width="854" src="https://private-user-images.githubusercontent.com/21303403/444078776-f11ae5ec-22fa-4c65-8658-c900701abc30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzg3NzYtZjExYWU1ZWMtMjJmYS00YzY1LTg2NTgtYzkwMDcwMWFiYzMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1MmQ4OTg3YWU4NjczZjc0NjYzN2M1NjY4YzIxYTVjYzgwY2JkYTE2YjllNGIwMDM1MDRlMDM5ZjZlOTA3NDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cx46qLdOZFrAzejxrSiqlOykcP02MPg_Jg8fyOgct4w"> > > 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. <img width="1904" alt="Image" src="https://github.com/user-attachments/assets/831310e3-afbb-47b1-9356-798579cfaca3" /> Nevermind whether open-webui could accept this pr, I've used it in my production.
Author
Owner

@1790374044 commented on GitHub (May 15, 2025):

How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode Image
Then add a think button on message input Image
Image
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
Image
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.
Image

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
...( _ _)ノ|

<!-- gh-comment-id:2883674435 --> @1790374044 commented on GitHub (May 15, 2025): > > > How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode ![Image](https://github.com/user-attachments/assets/15aa7efb-ddb8-46fc-8e44-0e861107d3ae) > > > Then add a think button on message input ![Image](https://github.com/user-attachments/assets/34c9933e-21cb-450e-ad46-c2041b74f698) > > > <img alt="Image" width="1201" src="https://private-user-images.githubusercontent.com/21303403/444077706-1c313453-1ff0-43e1-9988-610365cf15da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzc3MDYtMWMzMTM0NTMtMWZmMC00M2UxLTk5ODgtNjEwMzY1Y2YxNWRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1ZjY1ZDA2ZjUxNWZiODIwOWI5Mzg3MDRkMTBhODYyMGJmZDg0MGFmNjVhZGFiYWNmZWNhZDgxYTU4OTMwOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K32JyX-yia1YLwJEjWJY5IoPyBijxLMZL0wFMEE3lUo"> > > > For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button. > > > <img alt="Image" width="854" src="https://private-user-images.githubusercontent.com/21303403/444078776-f11ae5ec-22fa-4c65-8658-c900701abc30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzg3NzYtZjExYWU1ZWMtMjJmYS00YzY1LTg2NTgtYzkwMDcwMWFiYzMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1MmQ4OTg3YWU4NjczZjc0NjYzN2M1NjY4YzIxYTVjYzgwY2JkYTE2YjllNGIwMDM1MDRlMDM5ZjZlOTA3NDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cx46qLdOZFrAzejxrSiqlOykcP02MPg_Jg8fyOgct4w"> > > > 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. > <img alt="Image" width="1904" src="https://private-user-images.githubusercontent.com/21303403/444103329-831310e3-afbb-47b1-9356-798579cfaca3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTIwOTgsIm5iZiI6MTc0NzMxMTc5OCwicGF0aCI6Ii8yMTMwMzQwMy80NDQxMDMzMjktODMxMzEwZTMtYWZiYi00N2IxLTkzNTYtNzk4NTc5Y2ZhY2EzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDEyMjMxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBhNDAzYWUwZjRjN2E0ZWE5ZjBmMmNmYWZmZGNhOWQ4MzY3NzMyMGRjMzAzN2FiOGRjNTk0MWUxOTZjNjg4ZjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JbzHxT3nMhJ8qvO8VkOXRtufH5dfM5vpwCEbE0L1AXQ"> > > 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](https://docs.anthropic.com/en/api/openai-sdk#extended-thinking-support), [Llama-3_3-Nemotron-Super-49B-v1](https://huggingface.co/nvidia/Llama-3_3-Nemotron-Super-49B-v1#use-it-with-transformers) ...( _ _)ノ|
Author
Owner

@dongfangzan commented on GitHub (May 15, 2025):

How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode Image
Then add a think button on message input Image
Image
For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button.
Image
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.
Image
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.

<!-- gh-comment-id:2883689262 --> @dongfangzan commented on GitHub (May 15, 2025): > > > > How about this one? Add a swtich checkbox on model edit page to enable switching think/non-think mode ![Image](https://github.com/user-attachments/assets/15aa7efb-ddb8-46fc-8e44-0e861107d3ae) > > > > Then add a think button on message input ![Image](https://github.com/user-attachments/assets/34c9933e-21cb-450e-ad46-c2041b74f698) > > > > <img alt="Image" width="1201" src="https://private-user-images.githubusercontent.com/21303403/444077706-1c313453-1ff0-43e1-9988-610365cf15da.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzc3MDYtMWMzMTM0NTMtMWZmMC00M2UxLTk5ODgtNjEwMzY1Y2YxNWRhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWU1ZjY1ZDA2ZjUxNWZiODIwOWI5Mzg3MDRkMTBhODYyMGJmZDg0MGFmNjVhZGFiYWNmZWNhZDgxYTU4OTMwOTYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.K32JyX-yia1YLwJEjWJY5IoPyBijxLMZL0wFMEE3lUo"> > > > > For other models that do not support switching between thinking/non-thinking modes, there does not exist the Thinking button. > > > > <img alt="Image" width="854" src="https://private-user-images.githubusercontent.com/21303403/444078776-f11ae5ec-22fa-4c65-8658-c900701abc30.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTAxNjUsIm5iZiI6MTc0NzMwOTg2NSwicGF0aCI6Ii8yMTMwMzQwMy80NDQwNzg3NzYtZjExYWU1ZWMtMjJmYS00YzY1LTg2NTgtYzkwMDcwMWFiYzMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDExNTEwNVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTQ1MmQ4OTg3YWU4NjczZjc0NjYzN2M1NjY4YzIxYTVjYzgwY2JkYTE2YjllNGIwMDM1MDRlMDM5ZjZlOTA3NDcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.cx46qLdOZFrAzejxrSiqlOykcP02MPg_Jg8fyOgct4w"> > > > > 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. > > <img alt="Image" width="1904" src="https://private-user-images.githubusercontent.com/21303403/444103329-831310e3-afbb-47b1-9356-798579cfaca3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NDczMTIwOTgsIm5iZiI6MTc0NzMxMTc5OCwicGF0aCI6Ii8yMTMwMzQwMy80NDQxMDMzMjktODMxMzEwZTMtYWZiYi00N2IxLTkzNTYtNzk4NTc5Y2ZhY2EzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTA1MTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwNTE1VDEyMjMxOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBhNDAzYWUwZjRjN2E0ZWE5ZjBmMmNmYWZmZGNhOWQ4MzY3NzMyMGRjMzAzN2FiOGRjNTk0MWUxOTZjNjg4ZjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.JbzHxT3nMhJ8qvO8VkOXRtufH5dfM5vpwCEbE0L1AXQ"> > > 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](https://docs.anthropic.com/en/api/openai-sdk#extended-thinking-support), [Llama-3_3-Nemotron-Super-49B-v1](https://huggingface.co/nvidia/Llama-3_3-Nemotron-Super-49B-v1#use-it-with-transformers) ...( _ _)ノ| 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.
Author
Owner

@1790374044 commented on GitHub (May 15, 2025):

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?

¯\_(ツ)_/¯

<!-- gh-comment-id:2883702808 --> @1790374044 commented on GitHub (May 15, 2025): 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? ¯\\\_(ツ)\_/¯
Author
Owner

@tjbck commented on GitHub (May 16, 2025):

This will be implemented as a subtype of a Filter Function. There's too much variation in how all the different model providers handle "reasoning" model toggle from the backend, hard coding any params directly to our backend middleware is almost pointless. We'll revisit this approach once the ecosystem matures a bit more.

<!-- gh-comment-id:2887411585 --> @tjbck commented on GitHub (May 16, 2025): This will be implemented as a subtype of a Filter Function. There's too much variation in how all the different model providers handle "reasoning" model toggle from the backend, hard coding any params directly to our backend middleware is almost pointless. We'll revisit this approach once the ecosystem matures a bit more.
Author
Owner

@tjbck commented on GitHub (May 16, 2025):

Image

Image

Toggle Filter support has been added to dev.

e.g.)

from pydantic import BaseModel, Field
from typing import Optional


class Filter:
    class Valves(BaseModel):
        pass

    def __init__(self):
        self.valves = self.Valves()
        self.toggle = True
        # TIP: Use SVG Data URI!
        self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBjbGFzcz0ic2l6ZS02Ij4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xMiAxOHYtNS4yNW0wIDBhNi4wMSA2LjAxIDAgMCAwIDEuNS0uMTg5bS0xLjUuMTg5YTYuMDEgNi4wMSAwIDAgMS0xLjUtLjE4OW0zLjc1IDcuNDc4YTEyLjA2IDEyLjA2IDAgMCAxLTQuNSAwbTMuNzUgMi4zODNhMTQuNDA2IDE0LjQwNiAwIDAgMS0zIDBNMTQuMjUgMTh2LS4xOTJjMC0uOTgzLjY1OC0xLjgyMyAxLjUwOC0yLjMxNmE3LjUgNy41IDAgMSAwLTcuNTE3IDBjLjg1LjQ5MyAxLjUwOSAxLjMzMyAxLjUwOSAyLjMxNlYxOCIgLz4KPC9zdmc+Cg=="""
        pass

    async def inlet(
        self, body: dict, __event_emitter__, __user__: Optional[dict] = None
    ) -> dict:
        await __event_emitter__(
            {
                "type": "status",
                "data": {
                    "description": "Toggled!!",
                    "done": True,
                    "hidden": False,
                },
            }
        )
        return body

<!-- gh-comment-id:2887581867 --> @tjbck commented on GitHub (May 16, 2025): ![Image](https://github.com/user-attachments/assets/e836ac7b-5266-4b7f-b70d-3860facd3ed8) ![Image](https://github.com/user-attachments/assets/322cef79-f89a-434a-8a6d-d0060d49c1bb) Toggle Filter support has been added to dev. e.g.) ```py from pydantic import BaseModel, Field from typing import Optional class Filter: class Valves(BaseModel): pass def __init__(self): self.valves = self.Valves() self.toggle = True # TIP: Use SVG Data URI! self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBjbGFzcz0ic2l6ZS02Ij4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xMiAxOHYtNS4yNW0wIDBhNi4wMSA2LjAxIDAgMCAwIDEuNS0uMTg5bS0xLjUuMTg5YTYuMDEgNi4wMSAwIDAgMS0xLjUtLjE4OW0zLjc1IDcuNDc4YTEyLjA2IDEyLjA2IDAgMCAxLTQuNSAwbTMuNzUgMi4zODNhMTQuNDA2IDE0LjQwNiAwIDAgMS0zIDBNMTQuMjUgMTh2LS4xOTJjMC0uOTgzLjY1OC0xLjgyMyAxLjUwOC0yLjMxNmE3LjUgNy41IDAgMSAwLTcuNTE3IDBjLjg1LjQ5MyAxLjUwOSAxLjMzMyAxLjUwOSAyLjMxNlYxOCIgLz4KPC9zdmc+Cg==""" pass async def inlet( self, body: dict, __event_emitter__, __user__: Optional[dict] = None ) -> dict: await __event_emitter__( { "type": "status", "data": { "description": "Toggled!!", "done": True, "hidden": False, }, } ) return body ```
Author
Owner

@MicahZoltu commented on GitHub (May 17, 2025):

Is there information somewhere on how a user can utilize this filter feature to enable/disable thinking in qwen3?

Should I open a new separate issue for the problem of thinking models breaking a lot of features in the UI like tag generation, title generation, image prompting, and code generation?

<!-- gh-comment-id:2888086923 --> @MicahZoltu commented on GitHub (May 17, 2025): Is there information somewhere on how a user can utilize this filter feature to enable/disable thinking in qwen3? Should I open a new separate issue for the problem of thinking models breaking a lot of features in the UI like tag generation, title generation, image prompting, and code generation?
Author
Owner

@yazon commented on GitHub (May 23, 2025):

Disables thinking for Qwen3 (by default is is enabled).

Image

from collections.abc import Awaitable, Callable

from pydantic import BaseModel


class Filter:
    class Valves(BaseModel):
        pass

    def __init__(self) -> None:
        self.valves = self.Valves()
        self.toggle = True  # Toggle to disable thinking (ON = disabled)
        self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMjgyRDMzIiBkPSJNMTA4Ljk0OCAxMjhoLTRWODIuOTUzbC41OTQtLjU4N2M4Ljc2Ny04LjY2OSAxMy41OTUtMjAuMTg4IDEzLjU5NS0zMi40MzNDMTE5LjEzNyAyNC42MDUgOTguMjQ3IDQgNzIuNTcgNCA0Ni44ODkgNCAyNS45OTUgMjQuNjA1IDI1Ljk5NSA0OS45MzNjMCAuNjk4LjAyNiAxLjM4OC4wNTYgMi4wODJsLjAyNS41ODgtMTQuMjM3IDI0LjMzNmg5Ljc5N3YyMC45MjZjMCA2LjAyNCA0Ljk3NyAxMC45MjYgMTEuMDk1IDEwLjkyNmgyMi43NDFWMTI4aC00di0xNS4yMDlIMzIuNzMxYy04LjMyMyAwLTE1LjA5NS02LjY5NS0xNS4wOTUtMTQuOTI2VjgwLjkzOUg0Ljg2M0wyMi4wMyA1MS41OTdhNDMuNzYgNDMuNzYgMCAwIDEtLjAzNi0xLjY2NEMyMS45OTUgMjIuNCA0NC42ODMgMCA3Mi41NyAwYzI3Ljg4MyAwIDUwLjU2NiAyMi40IDUwLjU2NiA0OS45MzMgMCAxMy4wNDMtNS4wMzEgMjUuMzI1LTE0LjE4OCAzNC42OFYxMjh6Ii8+PHBhdGggZmlsbD0iIzI4MkQzMyIgZD0iTTEwMS44NTcgNTUuMDE4Yy0xLjE3OCA1LjgxNC00LjA3OSAxMS4xOTMtOC4zOTYgMTUuNDU3LTUuODEyIDUuNzMyLTEzLjU0MyA4Ljg5MS0yMS43NjkgOC44OTEtNi4wNCAwLTExLjg5Ni0xLjc0LTE2Ljg3Mi00Ljk2MWwxOS42NDItMTkuMzg2aDI3LjM5NW00LjQ3MS0zLjkzOWgtMzMuNDhMNDguODE0IDc0LjgwMmM2LjMzMSA1LjQ5NiAxNC4zNzQgOC41IDIyLjg4IDguNSA5LjI2OCAwIDE3Ljk4MS0zLjU2MiAyNC41MzItMTAuMDI0IDYuMDc1LTUuOTk5IDkuNjE0LTEzLjgwNyAxMC4xMDItMjIuMTk4ek03Ny44OTMgMTkuMzY1YzExLjc0NiAyLjMxMyAyMC45NjcgMTEuMDk5IDIzLjcxMSAyMi41NzFINzcuODkzVjE5LjM2NW0tMy45MzgtNC40Njh2MzAuOTc3aDMyLjI3NWMtMS41NDgtMTYuODUtMTUuMTU2LTI5LjkxNC0zMi4yNzUtMzAuOTc3ek02NC42NTEgMTkuMzM4djI2LjgzNUw0NS4zMTMgNjUuMjU0YTMwLjE3NiAzMC4xNzYgMCAwIDEtNC43MjQtMTYuMTljLjAwMi0xNC4yNTkgMTAuMjcyLTI2LjU4MiAyNC4wNjItMjkuNzI2bTMuOTM5LTQuNTg3Yy0xNy44MSAxLjUwNy0zMS45MzYgMTYuNDQ0LTMxLjkzOCAzNC4zMTIgMCA4LjE3OSAyLjg5OCAxNS45NyA4LjIwMiAyMi4xNzZsMjMuNzM2LTIzLjQyVjE0Ljc1MXoiLz48L3N2Zz4="""

    async def inlet(
        self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]], __user__: dict | None = None
    ) -> dict:
        try:
            messages = body.get("messages", [])

            # Only add /no_think when toggle is ON (to disable thinking)
            if self.toggle:
                # Find the last user message
                last_user_index = next(
                    (len(messages) - 1 - i for i, msg in enumerate(reversed(messages)) if msg["role"] == "user"),
                    None,
                )

                if last_user_index is not None:
                    last_user_message = messages[last_user_index]["content"]

                    # Add /no_think if not already present
                    if not last_user_message.strip().startswith(("/no_think", "/think")):
                        messages[last_user_index]["content"] = f"/no_think {last_user_message}"
                        body["messages"] = messages

            # Status notification
            status_message = "Thinking disabled (/no_think)" if self.toggle else "Thinking enabled (default)"

            await __event_emitter__({
                "type": "status",
                "data": {
                    "description": f"Qwen3 {status_message}",
                    "done": True,
                    "hidden": False,
                },
            })

        except Exception as e:
            await __event_emitter__({
                "type": "status",
                "data": {
                    "description": f"Error in thinking toggle: {e}",
                    "done": True,
                    "hidden": False,
                },
            })

        return body
<!-- gh-comment-id:2903450043 --> @yazon commented on GitHub (May 23, 2025): Disables thinking for Qwen3 (by default is is enabled). ![Image](https://github.com/user-attachments/assets/dea78962-e759-43ef-b67d-cdd6960161df) ```python from collections.abc import Awaitable, Callable from pydantic import BaseModel class Filter: class Valves(BaseModel): pass def __init__(self) -> None: self.valves = self.Valves() self.toggle = True # Toggle to disable thinking (ON = disabled) self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMjgyRDMzIiBkPSJNMTA4Ljk0OCAxMjhoLTRWODIuOTUzbC41OTQtLjU4N2M4Ljc2Ny04LjY2OSAxMy41OTUtMjAuMTg4IDEzLjU5NS0zMi40MzNDMTE5LjEzNyAyNC42MDUgOTguMjQ3IDQgNzIuNTcgNCA0Ni44ODkgNCAyNS45OTUgMjQuNjA1IDI1Ljk5NSA0OS45MzNjMCAuNjk4LjAyNiAxLjM4OC4wNTYgMi4wODJsLjAyNS41ODgtMTQuMjM3IDI0LjMzNmg5Ljc5N3YyMC45MjZjMCA2LjAyNCA0Ljk3NyAxMC45MjYgMTEuMDk1IDEwLjkyNmgyMi43NDFWMTI4aC00di0xNS4yMDlIMzIuNzMxYy04LjMyMyAwLTE1LjA5NS02LjY5NS0xNS4wOTUtMTQuOTI2VjgwLjkzOUg0Ljg2M0wyMi4wMyA1MS41OTdhNDMuNzYgNDMuNzYgMCAwIDEtLjAzNi0xLjY2NEMyMS45OTUgMjIuNCA0NC42ODMgMCA3Mi41NyAwYzI3Ljg4MyAwIDUwLjU2NiAyMi40IDUwLjU2NiA0OS45MzMgMCAxMy4wNDMtNS4wMzEgMjUuMzI1LTE0LjE4OCAzNC42OFYxMjh6Ii8+PHBhdGggZmlsbD0iIzI4MkQzMyIgZD0iTTEwMS44NTcgNTUuMDE4Yy0xLjE3OCA1LjgxNC00LjA3OSAxMS4xOTMtOC4zOTYgMTUuNDU3LTUuODEyIDUuNzMyLTEzLjU0MyA4Ljg5MS0yMS43NjkgOC44OTEtNi4wNCAwLTExLjg5Ni0xLjc0LTE2Ljg3Mi00Ljk2MWwxOS42NDItMTkuMzg2aDI3LjM5NW00LjQ3MS0zLjkzOWgtMzMuNDhMNDguODE0IDc0LjgwMmM2LjMzMSA1LjQ5NiAxNC4zNzQgOC41IDIyLjg4IDguNSA5LjI2OCAwIDE3Ljk4MS0zLjU2MiAyNC41MzItMTAuMDI0IDYuMDc1LTUuOTk5IDkuNjE0LTEzLjgwNyAxMC4xMDItMjIuMTk4ek03Ny44OTMgMTkuMzY1YzExLjc0NiAyLjMxMyAyMC45NjcgMTEuMDk5IDIzLjcxMSAyMi41NzFINzcuODkzVjE5LjM2NW0tMy45MzgtNC40Njh2MzAuOTc3aDMyLjI3NWMtMS41NDgtMTYuODUtMTUuMTU2LTI5LjkxNC0zMi4yNzUtMzAuOTc3ek02NC42NTEgMTkuMzM4djI2LjgzNUw0NS4zMTMgNjUuMjU0YTMwLjE3NiAzMC4xNzYgMCAwIDEtNC43MjQtMTYuMTljLjAwMi0xNC4yNTkgMTAuMjcyLTI2LjU4MiAyNC4wNjItMjkuNzI2bTMuOTM5LTQuNTg3Yy0xNy44MSAxLjUwNy0zMS45MzYgMTYuNDQ0LTMxLjkzOCAzNC4zMTIgMCA4LjE3OSAyLjg5OCAxNS45NyA4LjIwMiAyMi4xNzZsMjMuNzM2LTIzLjQyVjE0Ljc1MXoiLz48L3N2Zz4=""" async def inlet( self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]], __user__: dict | None = None ) -> dict: try: messages = body.get("messages", []) # Only add /no_think when toggle is ON (to disable thinking) if self.toggle: # Find the last user message last_user_index = next( (len(messages) - 1 - i for i, msg in enumerate(reversed(messages)) if msg["role"] == "user"), None, ) if last_user_index is not None: last_user_message = messages[last_user_index]["content"] # Add /no_think if not already present if not last_user_message.strip().startswith(("/no_think", "/think")): messages[last_user_index]["content"] = f"/no_think {last_user_message}" body["messages"] = messages # Status notification status_message = "Thinking disabled (/no_think)" if self.toggle else "Thinking enabled (default)" await __event_emitter__({ "type": "status", "data": { "description": f"Qwen3 {status_message}", "done": True, "hidden": False, }, }) except Exception as e: await __event_emitter__({ "type": "status", "data": { "description": f"Error in thinking toggle: {e}", "done": True, "hidden": False, }, }) return body
Author
Owner

@Benchangatrul284 commented on GitHub (May 23, 2025):

You can use two filter functions to make default as non-thinking mode and toggle it to thinking mode
First function: automatically add /no_think after user prompt

"""
title: Auto Disable Thinking qwen3
author: Thom Powers
version: 0.1
description:
        - This filter prepends the first user message with "/no_think" to disable thinking mode automatically.
        - The user can still utilize thinking mode by sending a message with "/think" at the beginning.
        - From that point, the model will use the most recent of the two commands.
        - This is for use with virtual assistants (ie. home assistant) which require fast responses, but allows normal model use of thinking mode when typing/using the GUI.
"""

from pydantic import BaseModel, Field
from typing import Callable, Awaitable, Any, Optional
from open_webui.models.users import Users
from open_webui.utils.chat import generate_chat_completion
from open_webui.utils.misc import get_last_user_message


class Filter:
    class Valves(BaseModel):
        priority: int = 1  # higher priority

    class UserValves(BaseModel):
        enable_no_think_prefix: bool = Field(
            default=True,
            description="Automatically prefix first user prompt with /no_think",
        )

    def __init__(self):
        self.valves = self.Valves()
        self.user_valves = self.UserValves()

    async def inlet(
        self,
        body: dict,
        __event_emitter__: Callable[[Any], Awaitable[None]],
        __request__: Any,
        __user__: Optional[dict] = None,
        __model__: Optional[dict] = None,
    ) -> dict:
        try:
            # Prefix only the first user message with /no_think if not already prefixed
            if self.user_valves.enable_no_think_prefix:
                messages = body.get("messages", [])
                first_user_index = next(
                    (i for i, msg in enumerate(messages) if msg["role"] == "user"), None
                )

                if first_user_index is not None:
                    first_user_message = messages[first_user_index]["content"]
                    if not first_user_message.strip().startswith(
                        ("/no_think", "/think")
                    ):
                        messages[first_user_index][
                            "content"
                        ] = f"/no_think {first_user_message}"
                        body["messages"] = messages
        except Exception as e:
            print(f"Error in /no_think prefix logic: {e}")

        return body

And another function to add "Thinking button" (removing all /no_think tag in the user prompt)

"""
title: Qwen No-Think Simple Toggle
author: G30
author_url: https://github.com/open-webui
funding_url: https://github.com/open-webui
version: 0.1.0
description: If self.toggle is True in the code, prepends /no-think to the system prompt. Otherwise, makes no changes related to /no-think.
"""

from pydantic import BaseModel
from typing import Optional, List, Dict, Any, Callable, Awaitable
import logging

# Setup logger
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)  # Set to info for more verbose output
if not logger.handlers:
    handler = logging.StreamHandler()
    formatter = logging.Formatter(
        "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
    )
    handler.setFormatter(formatter)
    logger.addHandler(handler)
    logger.propagate = True


class Filter:
    """
    A simple filter that, if its internal `self.toggle` is True,
    prepends '/no-think' to the system prompt.
    If `self.toggle` is False, it makes no changes to the prompt.
    This toggle is set in the code and not via UI Valves.
    """

    class Valves(BaseModel):
        priority: int = 2
        pass  # No user-configurable valves as per the requested structure

    def __init__(self):
        logger.info("✅ QwenToggle filter is loaded!")
        self.valves = self.Valves()

        # This is the "toggle" state for the filter's action.
        # Set to True: prepends "/no-think".
        # Set to False: the filter does nothing regarding /no-think.
        # To change the behavior, modify this line and restart Open WebUI.
        self.toggle: bool = True

        self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBjbGFzcz0ic2l6ZS02Ij4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xMiAxOHYtNS4yNW0wIDBhNi4wMSA2LjAxIDAgMCAwIDEuNS0uMTg5bS0xLjUuMTg5YTYuMDEgNi4wMSAwIDAgMS0xLjUtLjE4OW0zLjc1IDcuNDc4YTEyLjA2IDEyLjA2IDAgMCAxLTQuNSAwbTMuNzUgMi4zODNhMTQuNDA2IDE0LjQwNiAwIDAgMS0zIDBNMTQuMjUgMTh2LS4xOTJjMC0uOTgzLjY1OC0xLjgyMyAxLjUwOC0yLjMxNmE3LjUgNy41IDAgMSAwLTcuNTE3IDBjLjg1LjQ5MyAxLjUwOSAxLjMzMyAxLjUwOSAyLjMxNlYxOCIgLz4KPC9zdmc+Cg=="""

        active_action_for_log = (
            "removes /no-think" if self.toggle else "filter inactive, no changes made"
        )
        logger.info(
            f"Qwen Think Simple Toggle filter initialized. Default behavior: {active_action_for_log} (based on self.toggle = {self.toggle})"
        )

    async def inlet(
        self,
        body: Dict[str, Any],
        __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]],
        __user__: Optional[Dict[str, Any]] = None,
        __model__: Optional[Dict[str, Any]] = None,
        __request__: Optional[Any] = None,
    ) -> Dict[str, Any]:

        messages: List[Dict[str, str]] = body.get("messages", [])
        if not messages:
            logger.warning("No messages found in body, skipping modification.")
            return body

        # removes it /no_think everywhere
        if self.toggle:
            logger.info(
                "✅ self.toggle is True -> removing /no_think to the last user message"
            )
            # remove /no_think
            for i in range(len(messages)):
                if messages[i].get("role") == "user":
                    content = messages[i].get("content", "")
                    new_content = content.replace("/no_think", "")
                    messages[i]["content"] = new_content
            body["messages"] = messages

        return body

    async def outlet(
        self,
        body: Dict[str, Any],
        __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]],
        __user__: Optional[Dict[str, Any]] = None,
        __model__: Optional[Dict[str, Any]] = None,
        __request__: Optional[Any] = None,
    ) -> Dict[str, Any]:
        logger.info("Qwen No-Think Simple Toggle outlet called, passing through.")
        return body

remember to set the first function to higher priority (smaller number) so that it executes first

Image
<!-- gh-comment-id:2904489882 --> @Benchangatrul284 commented on GitHub (May 23, 2025): You can use two filter functions to make default as non-thinking mode and toggle it to thinking mode First function: automatically add /no_think after user prompt ``` """ title: Auto Disable Thinking qwen3 author: Thom Powers version: 0.1 description: - This filter prepends the first user message with "/no_think" to disable thinking mode automatically. - The user can still utilize thinking mode by sending a message with "/think" at the beginning. - From that point, the model will use the most recent of the two commands. - This is for use with virtual assistants (ie. home assistant) which require fast responses, but allows normal model use of thinking mode when typing/using the GUI. """ from pydantic import BaseModel, Field from typing import Callable, Awaitable, Any, Optional from open_webui.models.users import Users from open_webui.utils.chat import generate_chat_completion from open_webui.utils.misc import get_last_user_message class Filter: class Valves(BaseModel): priority: int = 1 # higher priority class UserValves(BaseModel): enable_no_think_prefix: bool = Field( default=True, description="Automatically prefix first user prompt with /no_think", ) def __init__(self): self.valves = self.Valves() self.user_valves = self.UserValves() async def inlet( self, body: dict, __event_emitter__: Callable[[Any], Awaitable[None]], __request__: Any, __user__: Optional[dict] = None, __model__: Optional[dict] = None, ) -> dict: try: # Prefix only the first user message with /no_think if not already prefixed if self.user_valves.enable_no_think_prefix: messages = body.get("messages", []) first_user_index = next( (i for i, msg in enumerate(messages) if msg["role"] == "user"), None ) if first_user_index is not None: first_user_message = messages[first_user_index]["content"] if not first_user_message.strip().startswith( ("/no_think", "/think") ): messages[first_user_index][ "content" ] = f"/no_think {first_user_message}" body["messages"] = messages except Exception as e: print(f"Error in /no_think prefix logic: {e}") return body ``` And another function to add "Thinking button" (removing all /no_think tag in the user prompt) ``` """ title: Qwen No-Think Simple Toggle author: G30 author_url: https://github.com/open-webui funding_url: https://github.com/open-webui version: 0.1.0 description: If self.toggle is True in the code, prepends /no-think to the system prompt. Otherwise, makes no changes related to /no-think. """ from pydantic import BaseModel from typing import Optional, List, Dict, Any, Callable, Awaitable import logging # Setup logger logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) # Set to info for more verbose output if not logger.handlers: handler = logging.StreamHandler() formatter = logging.Formatter( "%(asctime)s - %(name)s - %(levelname)s - %(message)s" ) handler.setFormatter(formatter) logger.addHandler(handler) logger.propagate = True class Filter: """ A simple filter that, if its internal `self.toggle` is True, prepends '/no-think' to the system prompt. If `self.toggle` is False, it makes no changes to the prompt. This toggle is set in the code and not via UI Valves. """ class Valves(BaseModel): priority: int = 2 pass # No user-configurable valves as per the requested structure def __init__(self): logger.info("✅ QwenToggle filter is loaded!") self.valves = self.Valves() # This is the "toggle" state for the filter's action. # Set to True: prepends "/no-think". # Set to False: the filter does nothing regarding /no-think. # To change the behavior, modify this line and restart Open WebUI. self.toggle: bool = True self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyNCAyNCIgc3Ryb2tlLXdpZHRoPSIxLjUiIHN0cm9rZT0iY3VycmVudENvbG9yIiBjbGFzcz0ic2l6ZS02Ij4KICA8cGF0aCBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIGQ9Ik0xMiAxOHYtNS4yNW0wIDBhNi4wMSA2LjAxIDAgMCAwIDEuNS0uMTg5bS0xLjUuMTg5YTYuMDEgNi4wMSAwIDAgMS0xLjUtLjE4OW0zLjc1IDcuNDc4YTEyLjA2IDEyLjA2IDAgMCAxLTQuNSAwbTMuNzUgMi4zODNhMTQuNDA2IDE0LjQwNiAwIDAgMS0zIDBNMTQuMjUgMTh2LS4xOTJjMC0uOTgzLjY1OC0xLjgyMyAxLjUwOC0yLjMxNmE3LjUgNy41IDAgMSAwLTcuNTE3IDBjLjg1LjQ5MyAxLjUwOSAxLjMzMyAxLjUwOSAyLjMxNlYxOCIgLz4KPC9zdmc+Cg==""" active_action_for_log = ( "removes /no-think" if self.toggle else "filter inactive, no changes made" ) logger.info( f"Qwen Think Simple Toggle filter initialized. Default behavior: {active_action_for_log} (based on self.toggle = {self.toggle})" ) async def inlet( self, body: Dict[str, Any], __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]], __user__: Optional[Dict[str, Any]] = None, __model__: Optional[Dict[str, Any]] = None, __request__: Optional[Any] = None, ) -> Dict[str, Any]: messages: List[Dict[str, str]] = body.get("messages", []) if not messages: logger.warning("No messages found in body, skipping modification.") return body # removes it /no_think everywhere if self.toggle: logger.info( "✅ self.toggle is True -> removing /no_think to the last user message" ) # remove /no_think for i in range(len(messages)): if messages[i].get("role") == "user": content = messages[i].get("content", "") new_content = content.replace("/no_think", "") messages[i]["content"] = new_content body["messages"] = messages return body async def outlet( self, body: Dict[str, Any], __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]], __user__: Optional[Dict[str, Any]] = None, __model__: Optional[Dict[str, Any]] = None, __request__: Optional[Any] = None, ) -> Dict[str, Any]: logger.info("Qwen No-Think Simple Toggle outlet called, passing through.") return body ``` remember to set the first function to higher priority (smaller number) so that it executes first <img width="662" alt="Image" src="https://github.com/user-attachments/assets/1986068b-ca32-4735-af89-63639764ace3" />
Author
Owner

@nickyisadog commented on GitHub (Jun 16, 2025):

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

same....
no reason to use reasoning to generate title...

<!-- gh-comment-id:2975687589 --> @nickyisadog commented on GitHub (Jun 16, 2025): > 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 same.... no reason to use reasoning to generate title...
Author
Owner

@ZV-Liu commented on GitHub (Jul 23, 2025):

Image 通过在请求体中添加是否开启思考的参数后,能够实现思考模式的开启与关闭,但是面临一个问题,当关闭思考模式时,仍会显示正在思考,必须通过折叠按钮查看返回信息? ```python from typing import Callable, Awaitable from pydantic import BaseModel from typing import Optional, List, Dict, Any, Callable, Awaitable

Assume your Filter class is defined as previously corrected:

class Filter:
class Valves(BaseModel):
pass

def __init__(self) -> None:
    self.valves = self.Valves()
    self.toggle = True  # Toggle to disable thinking (ON = disabled)
    self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMjgyRDMzIiBkPSJNMTA4Ljk0OCAxMjhoLTRWODIuOTUzbC41OTQtLjU4N2M4Ljc2Ny04LjY2OSAxMy41OTUtMjAuMTg4IDEzLjU5NS0zMi40MzNDMTE5LjEzNyAyNC42MDUgOTguMjQ3IDQgNzIuNTcgNCA0Ni44ODkgNCAyNS45OTUgMjQuNjA1IDI1Ljk5NSA0OS45MzNjMCAuNjk4LjAyNiAxLjM4OC4wNTYgMi4wODJsLjAyNS41ODgtMTQuMjM3IDI0LjMzNmg5Ljc5N3YyMC45MjZjMCA2LjAyNCA0Ljk3NyAxMC45MjYgMTEuMDk1IDEwLjkyNmgyMi43NDFWMTI4aC00di0xNS4yMDlIMzIuNzMxYy04LjMyMyAwLTE1LjA5NS02LjY5NS0xNS4wOTUtMTQuOTI2VjgwLjkzOUg0LjU1NjMgMjIuMDMgNTEuNTk3YTQzLjc2IDQzLjc2IDAgMCAxLS4wMzYtMS42NjhDMjEuOTk1IDIyLjQgNDQuNjgzIDAgNzIuNTcgMGMyNy44ODMgMCA1MC41NjYgMjIuNCA1MC41NjYgNDkuOTMzIDAgMTMuMDQzLTUuMDMxIDI1LjMyNS0xNC4xODggMzQuNjhVMTI4eiIvPjxwYXRoIGZpbGwgPSIjMjgyRDMzIiBkPSJNMTAxLjg1NyA1NS4wMThjLTEuMTc4IDUuODE0LTQuMDc5IDExLjE5My04LjM5NiAxNS40NTctNS44MTIgNS43NzItMTMuNTQzIDguODkxLTIxLjc2OSA4Ljg5MS02LjA0IDAtMTEuODk2LTEuNzQtMTYuODcyLTQuOTYxbDE5LjY0Mi0xOS4zODZoMjcuMzk1bTQuNDcxLTMuOTM5aC0zMy40OEw0OC44MTQgNzQuODAyYzYuMzMxIDUuNDk2IDE0LjM3NCA4LjUgMjIuODggOC41O્યાંLjI2OCAwIDE3Ljk4MS0zLjU2MiAyNC41MzItMTAuMDI0IDYuMDc1LTUuOTk5IDkuNjE0LTEzLjgwNyAxMC4xMDItMjIuMTk4ek03Ny44OTMgMTkuMzY1YzExLjc0NiAyLjMxMyAyMC45NjcgMTEuMDk5IDIzLjcxMSAyMi41NzFINzcuODkzVjE5LjM2NW0tMy45MzgtNC40Njh2MzAuOTc3aDMyLjI3NWMtMS41NDgtMTYuODUtMTUuMTU2LTI5LjkwMTQtMzIuMjc1LTMwLjk3N3ekMTY0LjY1MSAxOS4zMzh2MjYuODM1TDU4LjUxMyA2NS4yNTRhMzAuMTc2IDMwLjE3NiAwIDAgMS00LjcyNC0xNi4xOWMuMDAyLTE0LjI1OSAxMC4yNzItMjYuNTgyIDI0LjA2Mi0yOS43MjZtMy45MzktNC41ODdjLTE3LjgxIDEuNTA3LTMxLjkzNiAxNi40NDQtMzEuOTM4IDM0LjMxMiAwIDguMTc5IDIuODk4IDE1Ljk3IDguMjAyIDIyLjE3NmwyMy43MzYtMjMuNDJWMTQuNzUxeiIvPjwvZ2VzPg=="""

async def inlet(
    self,
    body: dict,
    __event_emitter__: Callable[[dict], Awaitable[None]],
    __user__: dict | None = None,
) -> dict:
    try:
        print(f"DEBUG: Inside inlet - self.toggle: {self.toggle}")
        # Initialize fields, ensuring extra_body and chat_template_kwargs exist

        # Set enable_thinking based on the inverse of self.toggle
        # If self.toggle is True (ON), then thinking is DISABLED (False)
        # If self.toggle is False (OFF), then thinking is ENABLED (True)
        enable_thinking_for_llm = not self.toggle

        body["chat_template_kwargs"] = {
            "enable_thinking": not self.toggle,
            "test_marker": "from_filter_inlet",
        }

        print(f"DEBUG: Inside inlet - set enable_thinking to: {body}")

        status_message = (
            "Thinking disabled via config"
            if self.toggle
            else "Thinking enabled (default)"
        )
        # This part requires __event_emitter__ to be awaited
        await __event_emitter__(
            {
                "type": "status",
                "data": {
                    "description": f"Qwen3 {status_message}",
                    "done": True,
                    "hidden": False,
                },
            }
        )

    except Exception as e:
        # Also ensure this part is correctly handled in async context
        logger.info(f"Error in thinking toggle: {e}")
        await __event_emitter__(
            {
                "type": "status",
                "data": {
                    "description": f"Error in thinking toggle: {e}",
                    "done": True,
                    "hidden": False,
                },
            }
        )
    return body

async def outlet(
    self,
    body: Dict[str, Any],
    __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]],
    __user__: Optional[Dict[str, Any]] = None,
    __model__: Optional[Dict[str, Any]] = None,
    __request__: Optional[Any] = None,
) -> Dict[str, Any]:
    logger.info("Qwen No-Think Simple Toggle outlet called, passing through.")
    logger.info(f"DEBUG: Output: {body}")
    return body

body["chat_template_kwargs"]=[

"enable_thinking"

] = enable_thinking_for_llm

<!-- gh-comment-id:3105556588 --> @ZV-Liu commented on GitHub (Jul 23, 2025): <img width="1047" height="663" alt="Image" src="https://github.com/user-attachments/assets/2174dd25-d70c-4dec-be83-598d2f3827a9" /> 通过在请求体中添加是否开启思考的参数后,能够实现思考模式的开启与关闭,但是面临一个问题,当关闭思考模式时,仍会显示正在思考,必须通过折叠按钮查看返回信息? ```python from typing import Callable, Awaitable from pydantic import BaseModel from typing import Optional, List, Dict, Any, Callable, Awaitable # Assume your Filter class is defined as previously corrected: class Filter: class Valves(BaseModel): pass def __init__(self) -> None: self.valves = self.Valves() self.toggle = True # Toggle to disable thinking (ON = disabled) self.icon = """data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiB4bWw6c3BhY2U9InByZXNlcnZlIj48cGF0aCBmaWxsPSIjMjgyRDMzIiBkPSJNMTA4Ljk0OCAxMjhoLTRWODIuOTUzbC41OTQtLjU4N2M4Ljc2Ny04LjY2OSAxMy41OTUtMjAuMTg4IDEzLjU5NS0zMi40MzNDMTE5LjEzNyAyNC42MDUgOTguMjQ3IDQgNzIuNTcgNCA0Ni44ODkgNCAyNS45OTUgMjQuNjA1IDI1Ljk5NSA0OS45MzNjMCAuNjk4LjAyNiAxLjM4OC4wNTYgMi4wODJsLjAyNS41ODgtMTQuMjM3IDI0LjMzNmg5Ljc5N3YyMC45MjZjMCA2LjAyNCA0Ljk3NyAxMC45MjYgMTEuMDk1IDEwLjkyNmgyMi43NDFWMTI4aC00di0xNS4yMDlIMzIuNzMxYy04LjMyMyAwLTE1LjA5NS02LjY5NS0xNS4wOTUtMTQuOTI2VjgwLjkzOUg0LjU1NjMgMjIuMDMgNTEuNTk3YTQzLjc2IDQzLjc2IDAgMCAxLS4wMzYtMS42NjhDMjEuOTk1IDIyLjQgNDQuNjgzIDAgNzIuNTcgMGMyNy44ODMgMCA1MC41NjYgMjIuNCA1MC41NjYgNDkuOTMzIDAgMTMuMDQzLTUuMDMxIDI1LjMyNS0xNC4xODggMzQuNjhVMTI4eiIvPjxwYXRoIGZpbGwgPSIjMjgyRDMzIiBkPSJNMTAxLjg1NyA1NS4wMThjLTEuMTc4IDUuODE0LTQuMDc5IDExLjE5My04LjM5NiAxNS40NTctNS44MTIgNS43NzItMTMuNTQzIDguODkxLTIxLjc2OSA4Ljg5MS02LjA0IDAtMTEuODk2LTEuNzQtMTYuODcyLTQuOTYxbDE5LjY0Mi0xOS4zODZoMjcuMzk1bTQuNDcxLTMuOTM5aC0zMy40OEw0OC44MTQgNzQuODAyYzYuMzMxIDUuNDk2IDE0LjM3NCA4LjUgMjIuODggOC41O્યાંLjI2OCAwIDE3Ljk4MS0zLjU2MiAyNC41MzItMTAuMDI0IDYuMDc1LTUuOTk5IDkuNjE0LTEzLjgwNyAxMC4xMDItMjIuMTk4ek03Ny44OTMgMTkuMzY1YzExLjc0NiAyLjMxMyAyMC45NjcgMTEuMDk5IDIzLjcxMSAyMi41NzFINzcuODkzVjE5LjM2NW0tMy45MzgtNC40Njh2MzAuOTc3aDMyLjI3NWMtMS41NDgtMTYuODUtMTUuMTU2LTI5LjkwMTQtMzIuMjc1LTMwLjk3N3ekMTY0LjY1MSAxOS4zMzh2MjYuODM1TDU4LjUxMyA2NS4yNTRhMzAuMTc2IDMwLjE3NiAwIDAgMS00LjcyNC0xNi4xOWMuMDAyLTE0LjI1OSAxMC4yNzItMjYuNTgyIDI0LjA2Mi0yOS43MjZtMy45MzktNC41ODdjLTE3LjgxIDEuNTA3LTMxLjkzNiAxNi40NDQtMzEuOTM4IDM0LjMxMiAwIDguMTc5IDIuODk4IDE1Ljk3IDguMjAyIDIyLjE3NmwyMy43MzYtMjMuNDJWMTQuNzUxeiIvPjwvZ2VzPg==""" async def inlet( self, body: dict, __event_emitter__: Callable[[dict], Awaitable[None]], __user__: dict | None = None, ) -> dict: try: print(f"DEBUG: Inside inlet - self.toggle: {self.toggle}") # Initialize fields, ensuring extra_body and chat_template_kwargs exist # Set enable_thinking based on the inverse of self.toggle # If self.toggle is True (ON), then thinking is DISABLED (False) # If self.toggle is False (OFF), then thinking is ENABLED (True) enable_thinking_for_llm = not self.toggle body["chat_template_kwargs"] = { "enable_thinking": not self.toggle, "test_marker": "from_filter_inlet", } print(f"DEBUG: Inside inlet - set enable_thinking to: {body}") status_message = ( "Thinking disabled via config" if self.toggle else "Thinking enabled (default)" ) # This part requires __event_emitter__ to be awaited await __event_emitter__( { "type": "status", "data": { "description": f"Qwen3 {status_message}", "done": True, "hidden": False, }, } ) except Exception as e: # Also ensure this part is correctly handled in async context logger.info(f"Error in thinking toggle: {e}") await __event_emitter__( { "type": "status", "data": { "description": f"Error in thinking toggle: {e}", "done": True, "hidden": False, }, } ) return body async def outlet( self, body: Dict[str, Any], __event_emitter__: Callable[[Dict[str, Any]], Awaitable[None]], __user__: Optional[Dict[str, Any]] = None, __model__: Optional[Dict[str, Any]] = None, __request__: Optional[Any] = None, ) -> Dict[str, Any]: logger.info("Qwen No-Think Simple Toggle outlet called, passing through.") logger.info(f"DEBUG: Output: {body}") return body # body["chat_template_kwargs"]=[ # "enable_thinking" # ] = enable_thinking_for_llm ```
Author
Owner

@gaby commented on GitHub (Aug 1, 2025):

@tjbck This issue was close as completed but I can't find the option in the latest Open-WebUI release?

This is affecting models like Qwen3 and ExaOne, they both do not have the <think> tag at the beginning so the reasoning content shows as output to the users.

<!-- gh-comment-id:3144538658 --> @gaby commented on GitHub (Aug 1, 2025): @tjbck This issue was close as completed but I can't find the option in the latest Open-WebUI release? This is affecting models like Qwen3 and ExaOne, they both do not have the `<think>` tag at the beginning so the reasoning content shows as output to the users.
Author
Owner

@rgaricano commented on GitHub (Aug 1, 2025):

This can of model issues should be managed by model provider, in ollama repo there are some threads opened about, e.g. https://github.com/ollama/ollama/issues/10929

Is an issue related with model versions compatibilities, and have not sense patch here and patch in ollama (or other providers).
By the way, if it's necessary use filter for specific model issues.

<!-- gh-comment-id:3144588865 --> @rgaricano commented on GitHub (Aug 1, 2025): This can of model issues should be managed by model provider, in ollama repo there are some threads opened about, e.g. https://github.com/ollama/ollama/issues/10929 Is an issue related with model versions compatibilities, and have not sense patch here and patch in ollama (or other providers). By the way, if it's necessary use filter for specific model issues.
Author
Owner

@MicahZoltu commented on GitHub (Aug 1, 2025):

I am using Qwen3:30-a3b via ollama and thinking works. I haven't fiddled with enable_thinking though. I do get thinking hidden in the thinking blocks.

<!-- gh-comment-id:3144650742 --> @MicahZoltu commented on GitHub (Aug 1, 2025): I am using `Qwen3:30-a3b` via `ollama` and thinking works. I haven't fiddled with `enable_thinking` though. I do get thinking hidden in the thinking blocks.
Author
Owner

@gaby commented on GitHub (Aug 1, 2025):

In my case the backend is vLLM v0.10.0, not ollama. Adding enable_thinking does make the model reason, but the reasoning_content always shows in the chat mixed with the response, and we never get the "Thinking...".

<!-- gh-comment-id:3144671356 --> @gaby commented on GitHub (Aug 1, 2025): In my case the backend is vLLM v0.10.0, not ollama. Adding `enable_thinking` does make the model reason, but the `reasoning_content` always shows in the chat mixed with the response, and we never get the "Thinking...".
Author
Owner

@gaby commented on GitHub (Aug 11, 2025):

Anyone knows how to make a dropdown with options for reasoning effort? I followed the docs but it doesn't show up in the UI only in the admin panel

<!-- gh-comment-id:3174787627 --> @gaby commented on GitHub (Aug 11, 2025): Anyone knows how to make a `dropdown` with options for reasoning effort? I followed the docs but it doesn't show up in the UI only in the admin panel
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#55547