mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-16 06:03:26 -05:00
[GH-ISSUE #24537] issue: Reasoning tags are displayed as raw output for Gemini 3 Flash via LiteLLM #107319
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @arnoulddw on GitHub (May 10, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/24537
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.9.4
Ollama Version (if applicable)
Not applicable. The affected model is accessed through LiteLLM, not Ollama.
Operating System
Debian GNU/Linux, kernel 6.12.85+deb13-amd64, x86_64
Browser
Chrome 147.0.7727.137
Confirmation
README.md.Expected Behavior
When a model returns content wrapped in reasoning tags such as:
Open WebUI should detect the reasoning block and hide it or render it in the collapsible reasoning/thinking UI, not display the raw tags and reasoning text in the assistant’s final visible answer.
This should work when the model-level Advanced Parameter
Reasoning Tagsis set to the default supported tags, and also when explicitly configured with:Actual Behavior
For a Gemini 3 Flash model accessed via LiteLLM, Open WebUI stores and displays the raw
<think>block directly in the assistant message content.The exported chat JSON shows the assistant message content beginning with:
The raw tags are present in both:
and:
Changing
Reasoning TagsfromDefaultto explicit custom<think>/</think>did not resolve the issue.Steps to Reproduce
Run Open WebUI v0.9.4 using Docker.
Configure Open WebUI to use LiteLLM as an OpenAI-compatible provider.
Configure a LiteLLM model alias for Gemini 3 Flash high reasoning, for example:
Secrets/API keys are redacted.
In Open WebUI, add/select the model with ID:
Open the model settings:
Test with:
Then also test with custom reasoning tags:
Start a new chat with the Gemini 3 Flash model.
Send a simple rewriting/proofreading prompt. Example redacted form:
Observe the assistant response.
Expected result at step 10
The reasoning content should be hidden or shown only in Open WebUI’s reasoning/thinking UI. The final visible assistant message should contain only the final answer.
Actual result at step 10
The assistant response visibly includes the raw reasoning block before the final answer:
Logs & Screenshots
Screenshots of the model Advanced Params page and a redacted chat export can be provided if needed.
Relevant redacted export evidence:
Browser console logs and Docker logs are not included in this draft.
Additional Information
This appears to involve the interaction between:
The issue is not that the model emits a
<think>block. The issue is that Open WebUI has aReasoning Tagssetting that appears intended to parse/hide this pattern, but the raw tags remain visible and stored as normal assistant content for this LiteLLM/Gemini response path.@owui-terminator[bot] commented on GitHub (May 10, 2026):
🔍 Related Issues Found
I found some existing issues that might be related. Please check if any of these are duplicates or contain helpful solutions:
🟣 #23879 issue: reasoning_content is ignored in non-stream openai API
This is directly related: it reports that
reasoning_contentis ignored in non-stream OpenAI-compatible responses, which matches the symptom of reasoning not being parsed/rendered correctly when coming through LiteLLM/Gemini.by vanmilleru ·
bug🟣 #20231 issue: Non-streaming responses with thinking enabled are not parsed correctly (thinking content merged into final answer)
This issue describes non-streaming responses with thinking enabled not being parsed correctly, causing
<think>content to be merged into the final visible answer. That is very close to the current report’s raw<think>block being shown in the assistant message.by hamid370 ·
bug🟣 #17020 issue: Reasoning Tag disable does not seem to work
This older bug shows reasoning tag handling can fail even when reasoning is disabled/configured, indicating the same reasoning-tag parsing/settings path is implicated. It is not identical, but it is relevant to tag parsing behavior.
by RocketRider ·
bug🟣 #23844 issue: wrap in convert_output_to_messages leaks reasoning markup for chat templates that don't strip (Gemma 4 et al.) — regression of #23742
This is a close match for leaked
<think>markup, though specifically in a chat-template/tool-path regression. It confirms the same class of issue where reasoning tags are preserved in visible output instead of being stripped/hidden.by nulltea ·
bug🟣 #21832 issue: Post-tool “thinking” text leaks outside reasoning tags again
This issue reports ‘thinking’ text leaking outside reasoning tags again after tool use. While tool-related, it is the same symptom family: reasoning content/tag markup appearing in normal assistant output instead of the reasoning UI.
by kksaohun ·
bug💡 If your issue is a duplicate, please close it and add any additional details to the existing issue instead.
This comment was generated automatically. React with 👍 if helpful, 👎 if not.
@thefounderofantirome commented on GitHub (May 12, 2026):
This looks less like a model problem and more like a response-shape mismatch between LiteLLM's OpenAI-compatible output and the Open WebUI reasoning-tag parser.
Because the raw
<think>...</think>block is being stored directly into both:chat.history.messages[*].contentchat.history.messages[*].output[0].content[0].textI would check two things first:
<think>...</think>rather than as a structured reasoning/content separationThe fastest isolation is:
If the LiteLLM response is a single flattened text field, then the short-term unblock is usually to normalize the relay output before Open WebUI sees it, or patch Open WebUI to run the reasoning-tag split on that response path too.
I would also test the same model once through LiteLLM in streaming mode and once in non-stream mode. If only one mode leaks raw
<think>tags, that narrows the bug to one parser branch very quickly.If anyone needs a quick paid BYO-key debug pass for Open WebUI + LiteLLM reasoning/output normalization, I can help trace the raw response path and turn it into a clean working setup.
@Classic298 commented on GitHub (May 12, 2026):
Just to chime in I can't reproduce with the exact same setup in latest open webui and latest litellm. So might be a version mismatch