details of deepseek-r1's reasoning_content should not return to model for infer #8246

Closed
opened 2026-02-21 18:24:41 -05:00 by yindo · 2 comments
Owner

Originally created by @sinopec on GitHub (Feb 13, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

0.15.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Integrating the DeepSeek R1 model hosted locally on vLLM, supporting reasoning_context. Dify can display the thinking process well in the detail tag. However, in multi-turn conversations, the thinking process from previous dialogues is also included in the final prompt of the current conversation.

DeepSeek's official recommendation is that the thinking content should not be carried over to the next conversation's prompt.

✔️ Expected Behavior

the think process in between tag should not in included in the current prompt

Actual Behavior

all conversations's think process is included in the current prompt

Originally created by @sinopec on GitHub (Feb 13, 2025). ### Self Checks - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 0.15.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Integrating the DeepSeek R1 model hosted locally on vLLM, supporting reasoning_context. Dify can display the thinking process well in the detail tag. However, in multi-turn conversations, the thinking process from previous dialogues is also included in the final prompt of the current conversation. DeepSeek's official recommendation is that the thinking content should not be carried over to the next conversation's prompt. ### ✔️ Expected Behavior the think process in between <detail> tag should not in included in the current prompt ### ❌ Actual Behavior all conversations's think process is included in the current prompt
yindo added the 🐞 bug label 2026-02-21 18:24:41 -05:00
yindo closed this issue 2026-02-21 18:24:41 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Feb 13, 2025):

Hello @sinopec! I'm here to help you with any bugs, questions, or contributions you have for the project. Let me know how I can assist you!

To address the issue where the reasoning content within the <detail> tag is being included in the prompt for subsequent conversation turns, you can consider using Dify's mechanisms for filtering or excluding parts of the conversation. Dify allows you to set Stop Sequences to signal the LLM to stop generating text at specific points, which can help in excluding unwanted content from the prompt. Additionally, in Expert Mode, you can adjust the position of context and chat history within the prompts, providing more control over what is included [1].

If these options do not resolve the issue, you might need to look into customizing the prompt construction logic to ensure that the reasoning content is excluded as per DeepSeek's recommendations.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other | Bug Report

@dosubot[bot] commented on GitHub (Feb 13, 2025): <!-- Greeting --> Hello @sinopec! I'm here to help you with any bugs, questions, or contributions you have for the project. Let me know how I can assist you! <!-- Answer --> To address the issue where the reasoning content within the `<detail>` tag is being included in the prompt for subsequent conversation turns, you can consider using Dify's mechanisms for filtering or excluding parts of the conversation. Dify allows you to set **Stop Sequences** to signal the LLM to stop generating text at specific points, which can help in excluding unwanted content from the prompt. Additionally, in **Expert Mode**, you can adjust the position of context and chat history within the prompts, providing more control over what is included <sup>[[1]](https://github.com/langgenius/dify-docs/blob/main/en/learn-more/prompt-engineering/prompt-engineering-1/README.md)</sup>. If these options do not resolve the issue, you might need to look into customizing the prompt construction logic to ensure that the reasoning content is excluded as per DeepSeek's recommendations. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.* --- <sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=hallucination) | [Other](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=other) | [Bug Report](https://app.dosu.dev/response-feedback/a835f432-a112-4af4-9a0f-9e1ccde15667?feedback_type=bug_report)</sup>
Author
Owner

@crazywoola commented on GitHub (Feb 13, 2025):

https://github.com/langgenius/dify/issues/13521#issuecomment-2655351036

@crazywoola commented on GitHub (Feb 13, 2025): https://github.com/langgenius/dify/issues/13521#issuecomment-2655351036
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#8246