zhipuai tool calls error #701

Closed
opened 2026-02-16 10:20:14 -05:00 by yindo · 1 comment
Owner

Originally created by @952446418 on GitHub (Oct 10, 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.7.2

Plugin version

zai-sdk>=0.0.3.1、pydantic==2.8.2

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

  1. Set up the ZhipuAI LLM plugin in Dify
  2. Trigger a tool-call request via streaming
  • Ensure the ZhipuAI plugin uses streaming response mode (the default for most LLM streaming setups in Dify).
  1. Observe the unhandled tool-call chunks
  • Check the Dify backend logs (or plugin execution logs) during the streaming response.
  • Notice that chunks containing delta.delta.tool_calls (i.e., the streaming tool-call instructions from ZhipuAI) are skipped and not processed.
  • Verify the root cause: The original if condition skips chunks where finish_reason is None, content is empty, and reasoning_content is empty—without checking tool_calls. Since tool-call chunks meet these empty content/reasoning conditions, they are incorrectly filtered out by continue.
  1. Confirm failed tool invocation
  • The Agent fails to execute the requested tool.
  • Inspect the streaming response flow: No tool-call metadata is passed to the subsequent logic, as the critical tool_calls chunks were skipped.

✔️ Error log

No response

Originally created by @952446418 on GitHub (Oct 10, 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.7.2 ### Plugin version zai-sdk>=0.0.3.1、pydantic==2.8.2 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1. Set up the ZhipuAI LLM plugin in Dify 2. Trigger a tool-call request via streaming - Ensure the ZhipuAI plugin uses streaming response mode (the default for most LLM streaming setups in Dify). 3. Observe the unhandled tool-call chunks - Check the Dify backend logs (or plugin execution logs) during the streaming response. - Notice that chunks containing delta.delta.tool_calls (i.e., the streaming tool-call instructions from ZhipuAI) are skipped and not processed. - Verify the root cause: The original if condition skips chunks where finish_reason is None, content is empty, and reasoning_content is empty—without checking tool_calls. Since tool-call chunks meet these empty content/reasoning conditions, they are incorrectly filtered out by continue. 4. Confirm failed tool invocation - The Agent fails to execute the requested tool. - Inspect the streaming response flow: No tool-call metadata is passed to the subsequent logic, as the critical tool_calls chunks were skipped. ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:20:14 -05:00
yindo closed this issue 2026-02-16 10:20:14 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 10, 2025):

Hi @952446418! I'm Dosu and I’m helping the dify-official-plugins team.

The issue with ZhipuAI tool-call chunks being skipped during streaming in Dify v1.7.2 is caused by filtering logic that ignores chunks with empty content and reasoning, even if they contain tool_calls. This prevents the agent from executing the requested tool.

A recent update after v1.7.2 refactored the chunk merging logic and may resolve this problem by ensuring all relevant streaming chunks, including tool-call metadata, are processed correctly. If possible, consider updating to a version that includes or is newer than this merged PR from August 2025, which unifies and improves streaming chunk handling. If you need an immediate workaround, review your backend's chunk filtering logic and ensure it does not skip chunks solely based on empty content/reasoning—allow chunks with tool_calls to pass through.

To reply, just mention @dosu.


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

@dosubot[bot] commented on GitHub (Oct 10, 2025): <!-- Greeting --> Hi @952446418! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify-official-plugins team. <!-- Answer --> The issue with ZhipuAI tool-call chunks being skipped during streaming in Dify v1.7.2 is caused by filtering logic that ignores chunks with empty content and reasoning, even if they contain tool_calls. This prevents the agent from executing the requested tool. A recent update after v1.7.2 refactored the chunk merging logic and may resolve this problem by ensuring all relevant streaming chunks, including tool-call metadata, are processed correctly. If possible, consider updating to a version that includes or is newer than [this merged PR from August 2025](https://github.com/langgenius/dify/pull/24575), which unifies and improves streaming chunk handling. If you need an immediate workaround, review your backend's chunk filtering logic and ensure it does not skip chunks solely based on empty content/reasoning—allow chunks with tool_calls to pass through. <!-- 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/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/617ce011-7c70-46b4-b119-4c2b30eff89f?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-official-plugins/issues/1832)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#701