Skip to content

fix(dflash): expose qwen reasoning in streaming and non-streaming response#124

Merged
davide221 merged 1 commit intoLuce-Org:mainfrom
jkyamog:fix-reasoning-stream
May 8, 2026
Merged

fix(dflash): expose qwen reasoning in streaming and non-streaming response#124
davide221 merged 1 commit intoLuce-Org:mainfrom
jkyamog:fix-reasoning-stream

Conversation

@jkyamog
Copy link
Copy Markdown
Contributor

@jkyamog jkyamog commented May 8, 2026

First off thank you for making this project. I have been using for the past week, in particular on open-webui. I noticed the opening tag is missing. I did ask codex and reviewed by claude to implement a fix. I guess the streaming implementation is a bit more complex that its a state machine.

Here is the summary of the implementation:

Streaming uses a sliding-window state machine (consume_stream_piece) to detect tag boundaries across token boundaries. Respects chat_template_kwargs.enable_thinking — when disabled, tokens stream as plain content without tag parsing.

…sponses

Parse <think>...</think> tags from Qwen model output and expose
reasoning separately:

- OpenAI: reasoning_content field on the message / streaming delta
- Anthropic: thinking content blocks with thinking_delta events

Streaming uses a sliding-window state machine (consume_stream_piece)
to detect tag boundaries across token boundaries.  Respects
chat_template_kwargs.enable_thinking — when disabled, tokens stream
as plain content without tag parsing.
@jkyamog jkyamog changed the title feat(dflash): expose qwen reasoning in streaming and non-streaming response fix(dflash): expose qwen reasoning in streaming and non-streaming response May 8, 2026
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

@davide221
Copy link
Copy Markdown
Contributor

@jkyamog thanks for your first contribution 🚀

@davide221 davide221 merged commit 22412ad into Luce-Org:main May 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants