Missing content(only reasoning_content) when enable thinking by deepseek-ai/DeepSeek-V3.2(siliconflow) in Agent #871

Closed
opened 2026-02-16 10:20:48 -05:00 by yindo · 2 comments
Owner

Originally created by @leslie2046 on GitHub (Dec 12, 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 Dify issues & Dify Official Plugins, 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

1.11.0

Plugin version

0.0.37

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

Image Image

✔️ Error log

No response

Originally created by @leslie2046 on GitHub (Dec 12, 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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/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 1.11.0 ### Plugin version 0.0.37 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce <img width="1125" height="715" alt="Image" src="https://github.com/user-attachments/assets/0f391fcd-a116-40dc-a9f1-db23cfdb4dd0" /> <img width="1044" height="365" alt="Image" src="https://github.com/user-attachments/assets/98cc2b22-563d-480e-b686-c66d4681c821" /> ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:20:48 -05:00
yindo closed this issue 2026-02-16 10:20:48 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 12, 2025):

This is a known issue with DeepSeek models: when thinking mode is enabled, sometimes only the reasoning_content is returned and the final content is missing. This often happens due to output handling bugs in the plugin, especially with streamed responses that use string replace operations, which can cause missing or incomplete content. Similar problems have been reported for DeepSeek v3.1 and v3.2 in both siliconflow and other providers (example, details and workaround).

If you are self-hosted and comfortable patching code, a common workaround is to modify the plugin's streamed output handling: instead of using string replace to build up the response, append new content directly (e.g., full_text += resp_content[len(full_text):]). This prevents character loss and empty output.

Other things to try: increase the max_tokens parameter, reduce prompt size, or split large knowledge base chunks. If direct API calls to DeepSeek-V3.2 with thinking mode enabled return both reasoning_content and content, the issue is almost certainly in the plugin's output handling logic.

Keep an eye out for plugin updates, as this area is under active development. If you need more details on where to patch, let me know your deployment details and I can point you to the relevant code section.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 12, 2025): <!-- Answer --> This is a known issue with DeepSeek models: when thinking mode is enabled, sometimes only the reasoning_content is returned and the final content is missing. This often happens due to output handling bugs in the plugin, especially with streamed responses that use string replace operations, which can cause missing or incomplete content. Similar problems have been reported for DeepSeek v3.1 and v3.2 in both siliconflow and other providers ([example](https://github.com/langgenius/dify-official-plugins/issues/2185), [details and workaround](https://github.com/langgenius/dify-official-plugins/issues/1621)). If you are self-hosted and comfortable patching code, a common workaround is to modify the plugin's streamed output handling: instead of using string replace to build up the response, append new content directly (e.g., `full_text += resp_content[len(full_text):]`). This prevents character loss and empty output. Other things to try: increase the max_tokens parameter, reduce prompt size, or split large knowledge base chunks. If direct API calls to DeepSeek-V3.2 with thinking mode enabled return both reasoning_content and content, the issue is almost certainly in the plugin's output handling logic. Keep an eye out for plugin updates, as this area is under active development. If you need more details on where to patch, let me know your deployment details and I can point you to the relevant code section. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b64c39bf-1a47-47c3-a90a-eb6595d1b554?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20issue%20with%20DeepSeek%20models%3A%20when%20thinking%20mode%20is%20enabled%2C%20sometimes%20only%20the%20reasoning_content%20is%20returned%20and%20the%20final%20content%20is%20missing.%20This%20often%20happens%20due%20to%20output%20handling%20bugs%20in%20the%20plugin%2C%20especially%20with%20streamed%20responses%20that%20use%20string%20replace%20operations%2C%20which%20can%20cause%20missing%20or%20incomplete%20content.%20Similar%20problems%20have%20been%20reported%20for%20DeepSeek%20v3.1%20and%20v3.2%20in%20both%20siliconflow%20and%20other%20providers%20%28%5Bexample%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2185%29%2C%20%5Bdetails%20and%20workaround%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1621%29%29.%0A%0AIf%20you%20are%20self-hosted%20and%20comfortable%20patching%20code%2C%20a%20common%20workaround%20is%20to%20modify%20the%20plugin%27s%20streamed%20output%20handling%3A%20instead%20of%20using%20string%20replace%20to%20build%20up%20the%20response%2C%20append%20new%20content%20directly%20%28e.g.%2C%20%60full_text%20%2B%3D%20resp_content%5Blen%28full_text%29%3A%5D%60%29.%20This%20prevents%20character%20loss%20and%20empty%20output.%0A%0AOther%20things%20to%20try%3A%20increase%20the%20max_tokens%20parameter%2C%20reduce%20prompt%20size%2C%20or%20split%20large%20knowledge%20base%20chunks.%20If%20direct%20API%20calls%20to%20DeepSeek-V3.2%20with%20thinking%20mode%20enabled%20return%20both%20reasoning_content%20and%20content%2C%20the%20issue%20is%20almost%20certainly%20in%20the%20plugin%27s%20output%20handling%20logic.%0A%0AKeep%20an%20eye%20out%20for%20plugin%20updates%2C%20as%20this%20area%20is%20under%20active%20development.%20If%20you%20need%20more%20details%20on%20where%20to%20patch%2C%20let%20me%20know%20your%20deployment%20details%20and%20I%20can%20point%20you%20to%20the%20relevant%20code%20section.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/2244)
Author
Owner

@leslie2046 commented on GitHub (Dec 21, 2025):

This is due to the unstable use of the thinking mode enabled tool in the DeepSeekV3.2 model itself.

The reasons are as follows.

  • Pro/deepseek-ai/DeepSeek-V3.2 tool use accuracy rate
    10/10 enable think
    10/10 disable think
  • deepseek-ai/DeepSeek-V3.2 tool use accuracy rate
    1/10 enable think
    2/10 disable think

import os
import sys
from openai import OpenAI

# Configuration
API_KEY = 'sk-xxxxxxxxxxxxx'
BASE_URL = "https://api.siliconflow.cn/v1"
MODEL_NAME = "Pro/deepseek-ai/DeepSeek-V3.2" 

def main():
    if not API_KEY:
        print("Error: Please set the SILICONFLOW_API_KEY environment variable.")
        print("Example: $env:SILICONFLOW_API_KEY='sk-...'")
        sys.exit(1)

    print(f"Initializing OpenAI client with base_url={BASE_URL}")
    client = OpenAI(
        api_key=API_KEY,
        base_url=BASE_URL
    )

    print(f"Sending request to model: {MODEL_NAME}")
    messages = [
        {'role': 'system', 'content': '你是一名助手'},
        {'role': 'user', 'content': '当前时间'}
    ]
    
    tools = [
        {
            "type": "function",
            "function": {
                "name": "get_current_time",
                "description": "Get the current time",
                "parameters": {
                    "type": "object",
                    "properties": {},
                    "required": []
                }
            }
        }
    ]

    
    try:
        response = client.chat.completions.create(
            model=MODEL_NAME,
            messages=messages,
            tools=tools,
            stream=True,
            extra_body={
                "enable_thinking": True,
                "thinking_budget": 512
            }
        )
        
        print("\n--- Streaming Response ---")
        for i, chunk in enumerate(response):
            delta = chunk.choices[0].delta
            
            # OpenAI SDK might not attribute dynamic fields to the object, 
            # so we check the underlying dictionary
            delta_dict = delta.model_dump() if hasattr(delta, 'model_dump') else delta.__dict__
            
            # SiliconFlow/DeepSeek often puts reasoning in 'reasoning_content'
            reasoning = delta_dict.get('reasoning_content')
            content = delta.content
            tool_calls = delta.tool_calls
            
            # if reasoning:
                # print(f"\n[Thinking]: {reasoning}", end="", flush=True)
            # if content:
                # print(f"[Content]: {content}", end="", flush=True)
            if tool_calls:
                print(f"\n[Tool Call]: {tool_calls}", end="", flush=True)
            
        print("\n\n--- Stream Finished ---")

    except Exception as e:
        print(f"\nAn error occurred: {e}")

if __name__ == "__main__":
    main()


1. sometimes response no tool_calls

Initializing OpenAI client with base_url=https://api.siliconflow.cn/v1
Sending request to model: deepseek-ai/DeepSeek-V3.2

--- Streaming Response ---


--- Stream Finished ---

2. sometimes response with tool_calls

Initializing OpenAI client with base_url=https://api.siliconflow.cn/v1
Sending request to model: Pro/deepseek-ai/DeepSeek-V3.2

--- Streaming Response ---

[Tool Call]: [ChoiceDeltaToolCall(index=0, id='019b4097ac95e12d1fefa0ffb86ee8ce', function=ChoiceDeltaToolCallFunction(arguments='', name='get_current_time'), type='function')]
[Tool Call]: [ChoiceDeltaToolCall(index=0, id=None, function=ChoiceDeltaToolCallFunction(arguments='{', name=None), type=None)]
[Tool Call]: [ChoiceDeltaToolCall(index=0, id=None, function=ChoiceDeltaToolCallFunction(arguments='}', name=None), type=None)]

--- Stream Finished ---
@leslie2046 commented on GitHub (Dec 21, 2025): ### This is due to the unstable use of the thinking mode enabled tool in the DeepSeekV3.2 model itself. The reasons are as follows. - Pro/deepseek-ai/DeepSeek-V3.2 tool use accuracy rate 10/10 enable think 10/10 disable think - deepseek-ai/DeepSeek-V3.2 tool use accuracy rate 1/10 enable think 2/10 disable think --- ``` import os import sys from openai import OpenAI # Configuration API_KEY = 'sk-xxxxxxxxxxxxx' BASE_URL = "https://api.siliconflow.cn/v1" MODEL_NAME = "Pro/deepseek-ai/DeepSeek-V3.2" def main(): if not API_KEY: print("Error: Please set the SILICONFLOW_API_KEY environment variable.") print("Example: $env:SILICONFLOW_API_KEY='sk-...'") sys.exit(1) print(f"Initializing OpenAI client with base_url={BASE_URL}") client = OpenAI( api_key=API_KEY, base_url=BASE_URL ) print(f"Sending request to model: {MODEL_NAME}") messages = [ {'role': 'system', 'content': '你是一名助手'}, {'role': 'user', 'content': '当前时间'} ] tools = [ { "type": "function", "function": { "name": "get_current_time", "description": "Get the current time", "parameters": { "type": "object", "properties": {}, "required": [] } } } ] try: response = client.chat.completions.create( model=MODEL_NAME, messages=messages, tools=tools, stream=True, extra_body={ "enable_thinking": True, "thinking_budget": 512 } ) print("\n--- Streaming Response ---") for i, chunk in enumerate(response): delta = chunk.choices[0].delta # OpenAI SDK might not attribute dynamic fields to the object, # so we check the underlying dictionary delta_dict = delta.model_dump() if hasattr(delta, 'model_dump') else delta.__dict__ # SiliconFlow/DeepSeek often puts reasoning in 'reasoning_content' reasoning = delta_dict.get('reasoning_content') content = delta.content tool_calls = delta.tool_calls # if reasoning: # print(f"\n[Thinking]: {reasoning}", end="", flush=True) # if content: # print(f"[Content]: {content}", end="", flush=True) if tool_calls: print(f"\n[Tool Call]: {tool_calls}", end="", flush=True) print("\n\n--- Stream Finished ---") except Exception as e: print(f"\nAn error occurred: {e}") if __name__ == "__main__": main() ``` **1. sometimes response no tool_calls** ``` Initializing OpenAI client with base_url=https://api.siliconflow.cn/v1 Sending request to model: deepseek-ai/DeepSeek-V3.2 --- Streaming Response --- --- Stream Finished --- ``` **2. sometimes response with tool_calls** ``` Initializing OpenAI client with base_url=https://api.siliconflow.cn/v1 Sending request to model: Pro/deepseek-ai/DeepSeek-V3.2 --- Streaming Response --- [Tool Call]: [ChoiceDeltaToolCall(index=0, id='019b4097ac95e12d1fefa0ffb86ee8ce', function=ChoiceDeltaToolCallFunction(arguments='', name='get_current_time'), type='function')] [Tool Call]: [ChoiceDeltaToolCall(index=0, id=None, function=ChoiceDeltaToolCallFunction(arguments='{', name=None), type=None)] [Tool Call]: [ChoiceDeltaToolCall(index=0, id=None, function=ChoiceDeltaToolCallFunction(arguments='}', name=None), type=None)] --- Stream Finished --- ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#871