api parameter "response_mode: blocking" not effect on openAI-API-compatible plugin #330

Closed
opened 2026-02-16 10:19:01 -05:00 by yindo · 3 comments
Owner

Originally created by @Gaocarri on GitHub (May 30, 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

1.1.3

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

We found that all calls to the model by dify were in streaming mode. In fact, we used /v1/workflows/run and added the "response_mode": "blocking" parameter.

To solve my doubts, I ran the OpenAI-API-compatible plugin code locally and added logs. I found that even if the API is set to "blocking", the stream of the _invoke method is still true.

Image

Is this in line with the expected performance? Maybe I misunderstood the meaning of the blocking parameter?

✔️ Expected Behavior

Blocking parameter worked, it can cut down on performance costs.

Actual Behavior

Blocking parameter not worked

Originally created by @Gaocarri on GitHub (May 30, 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 1.1.3 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce We found that all calls to the model by dify were in streaming mode. In fact, we used /v1/workflows/run and added the "response_mode": "blocking" parameter. To solve my doubts, I ran the OpenAI-API-compatible plugin code locally and added logs. I found that even if the API is set to "blocking", the stream of the _invoke method is still true. ![Image](https://github.com/user-attachments/assets/9cf0cbd6-f05a-4e4b-beb5-fbaa4624a35c) Is this in line with the expected performance? Maybe I misunderstood the meaning of the blocking parameter? ### ✔️ Expected Behavior Blocking parameter worked, it can cut down on performance costs. ### ❌ Actual Behavior Blocking parameter not worked
yindo closed this issue 2026-02-16 10:19:01 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (May 30, 2025):

The response_mode parameter is designed to control whether the response from the model is streamed ("streaming") or returned as a single, blocking result ("blocking"). In the Dify codebase, this is implemented by mapping response_mode to a boolean stream parameter: if response_mode is "streaming", stream is set to true; if "blocking", stream is false. This stream parameter is then passed through the invocation chain and ultimately to the _invoke method of your plugin, which should use it to decide whether to return a generator (for streaming) or a full result (for blocking) reference.

If you are seeing stream always set to true in your _invoke method, even when response_mode is "blocking", this suggests that either the mapping from response_mode to stream is not happening as expected, or your plugin is not correctly interpreting the stream parameter. The Dify core system does not apply any further logic to "blocking" beyond setting stream to false; it is up to the plugin implementation to handle this correctly reference.

Please check that your plugin's _invoke method is using the stream parameter as intended. For "blocking", it should return a full result, not a generator or stream. If your plugin always streams regardless of the stream parameter, that would explain the behavior you're seeing.

There are no known systemic bugs in Dify's handling of response_mode; the most common issue is a mismatch between the plugin's implementation and Dify's expectations for the stream parameter.

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (May 30, 2025): <!-- Answer --> The response_mode parameter is designed to control whether the response from the model is streamed ("streaming") or returned as a single, blocking result ("blocking"). In the Dify codebase, this is implemented by mapping response_mode to a boolean stream parameter: if response_mode is "streaming", stream is set to true; if "blocking", stream is false. This stream parameter is then passed through the invocation chain and ultimately to the _invoke method of your plugin, which should use it to decide whether to return a generator (for streaming) or a full result (for blocking) [reference](https://github.com/langgenius/dify/blob/92528360f9f5ae0d9af5a603a2824d9caffe5b9d/api/controllers/inner_api/plugin/plugin.py). If you are seeing stream always set to true in your _invoke method, even when response_mode is "blocking", this suggests that either the mapping from response_mode to stream is not happening as expected, or your plugin is not correctly interpreting the stream parameter. The Dify core system does not apply any further logic to "blocking" beyond setting stream to false; it is up to the plugin implementation to handle this correctly [reference](https://github.com/crazywoola/dify-docs-mintlify/blob/2f1a095e3bb3beae6f0e754cd65c0a20aabc1812/en/plugins/quick-start/develop-plugins/model-plugin/predefined-model.mdx). Please check that your plugin's _invoke method is using the stream parameter as intended. For "blocking", it should return a full result, not a generator or stream. If your plugin always streams regardless of the stream parameter, that would explain the behavior you're seeing. There are no known systemic bugs in Dify's handling of response_mode; the most common issue is a mismatch between the plugin's implementation and Dify's expectations for the stream parameter. <!-- Dosu Comment Footer --> *To reply, just mention my name [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/f6a78f84-2e6e-451d-9634-530d8bd3a610?feedback_type=other)</sup>&nbsp;&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/issues/20516)
Author
Owner

@Gaocarri commented on GitHub (Jun 3, 2025):

@crazywoola i think maybe it is dify's bug,dify does not pass the response_mode parameter to the plugin. Could you please move the issue back to langgenius/dify?

@Gaocarri commented on GitHub (Jun 3, 2025): @crazywoola i think maybe it is dify's bug,dify does not pass the response_mode parameter to the plugin. Could you please move the issue back to langgenius/dify?
Author
Owner

@dosubot[bot] commented on GitHub (Aug 19, 2025):

Hi, @Gaocarri. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that in Dify v1.1.3 self-hosted, setting "response_mode": "blocking" does not disable streaming as expected with the OpenAI-compatible plugin.
  • The expected behavior is that streaming should be disabled, but it appears to continue, causing confusion.
  • It was explained that Dify maps "response_mode" to a boolean stream parameter passed to the plugin’s _invoke method.
  • The plugin may not be respecting this parameter, but you suspect Dify might not be passing it correctly.
  • You requested the issue be moved to the main langgenius/dify repository for further investigation.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository.
  • If it is, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 5 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Aug 19, 2025): Hi, @Gaocarri. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that in Dify v1.1.3 self-hosted, setting `"response_mode": "blocking"` does not disable streaming as expected with the OpenAI-compatible plugin. - The expected behavior is that streaming should be disabled, but it appears to continue, causing confusion. - It was explained that Dify maps `"response_mode"` to a boolean `stream` parameter passed to the plugin’s `_invoke` method. - The plugin may not be respecting this parameter, but you suspect Dify might not be passing it correctly. - You requested the issue be moved to the main langgenius/dify repository for further investigation. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository. - If it is, you can keep the discussion open by commenting on this issue; otherwise, I will automatically close it in 5 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#330