dify icon indicating copy to clipboard operation
dify copied to clipboard

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

Open sinopec opened this issue 10 months ago • 2 comments

Self Checks

  • [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
  • [x] I have searched for existing issues search for existing issues, including closed ones.
  • [x] I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [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 tag should not in included in the current prompt

❌ Actual Behavior

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

sinopec avatar Feb 13 '25 12:02 sinopec

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] avatar Feb 13 '25 12:02 dosubot[bot]

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

crazywoola avatar Feb 13 '25 13:02 crazywoola