Failed to transform agent message using tongyi function calling #61

Closed
opened 2026-02-16 10:17:57 -05:00 by yindo · 4 comments
Owner

Originally created by @canyangyang on GitHub (Mar 11, 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.0.0

Plugin version

tongyi 0.0.9

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Create a chatflow with agent function calling and qwen max, failed running agent node

✔️ Error log

Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [tongyi] Error: PluginInvokeError: {"args":{},"error_type":"KeyError","message":"'name'"}"}

Image

Originally created by @canyangyang on GitHub (Mar 11, 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.0.0 ### Plugin version tongyi 0.0.9 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Create a chatflow with agent function calling and qwen max, failed running agent node ### ✔️ Error log Failed to transform agent message: PluginInvokeError: {"args":{},"error_type":"Exception","message":"read llm model failed: request failed: [tongyi] Error: PluginInvokeError: {\"args\":{},\"error_type\":\"KeyError\",\"message\":\"'name'\"}"} ![Image](https://github.com/user-attachments/assets/e3d43127-a05c-4d0f-9046-383c69cc2829)
yindo added the bug label 2026-02-16 10:17:57 -05:00
yindo closed this issue 2026-02-16 10:17:57 -05:00
Author
Owner

@canyangyang commented on GitHub (Mar 11, 2025):

It looks like a json convert problem. Please check the \models\llm\llm.py_convert_tools.

Image

heres the document of qwen function calling feature

https://help.aliyun.com/zh/model-studio/user-guide/qwen-function-calling?spm=a2c4g.11186623.help-menu-search-2400256.d_0#cf2f65edde0il

@canyangyang commented on GitHub (Mar 11, 2025): It looks like a json convert problem. Please check the \models\llm\llm.py\_convert_tools. ![Image](https://github.com/user-attachments/assets/971d6159-3f3d-422d-b0a6-7d36eadf8111) heres the document of qwen function calling feature https://help.aliyun.com/zh/model-studio/user-guide/qwen-function-calling?spm=a2c4g.11186623.help-menu-search-2400256.d_0#cf2f65edde0il
Author
Owner

@xiandan-erizo commented on GitHub (Mar 13, 2025):

same

@xiandan-erizo commented on GitHub (Mar 13, 2025): same
Author
Owner

@Thiswhyme commented on GitHub (Mar 18, 2025):

同样问题

@Thiswhyme commented on GitHub (Mar 18, 2025): 同样问题
Author
Owner

@jiandanfeng commented on GitHub (Mar 18, 2025):

This is a question from Tongyi, and the response from the official website is as follows:
{
"status_code": 200,
"request_id": "33cf0a53-ea38-9f47-8fce-b93b55d86573",
"code": "",
"message": "",
"output": {
"text": null,
"finish_reason": null,
"choices": [
{
"finish_reason": "tool_calls",
"message": {
"role": "assistant",
"content": "",
"tool_calls": [
{
"function": {
"name": "get_current_weather",
"arguments": "{"location": "杭州市"}"
},
"index": 0,
"id": "call_9f62f52f3a834a8194f634",
"type": "function"
}
]
}
}
]
},
"usage": {
"input_tokens": 217,
"output_tokens": 18,
"total_tokens": 235
}
}
When the actual response does:When finish_reason = tool_calls, function is empty
{"status_code": 200, "request_id": "xxxx", "code": "", "message": "", "output": {"text": null, "finish_reason": null, "choices": [{"finish_reason": "null", "message": {"role": "assistant", "content": "", "tool_calls": [{"index": 0, "id": "call_46b2d6ab57224ea09b09ce", "type": "function", "function": {"name": "get_current_time", "arguments": "{}"}}]}}]}, "usage": {"input_tokens": 217, "output_tokens": 13, "total_tokens": 230, "prompt_tokens_details": {"cached_tokens": 0}}}
{"status_code": 200, "request_id": "yyyyy", "code": "", "message": "", "output": {"text": null, "finish_reason": null, "choices": [{"finish_reason": "tool_calls", "message": {"role": "assistant", "content": "", "tool_calls": [{"index": 0, "id": "", "type": "function", "function": {}}]}}]}, "usage": {"input_tokens": 217, "output_tokens": 13, "total_tokens": 230, "prompt_tokens_details": {"cached_tokens": 0}}}

@jiandanfeng commented on GitHub (Mar 18, 2025): This is a question from Tongyi, and the response from the official website is as follows: { "status_code": 200, "request_id": "33cf0a53-ea38-9f47-8fce-b93b55d86573", "code": "", "message": "", "output": { "text": null, "finish_reason": null, "choices": [ { "finish_reason": "tool_calls", "message": { "role": "assistant", "content": "", "tool_calls": [ { "function": { "name": "get_current_weather", "arguments": "{\"location\": \"杭州市\"}" }, "index": 0, "id": "call_9f62f52f3a834a8194f634", "type": "function" } ] } } ] }, "usage": { "input_tokens": 217, "output_tokens": 18, "total_tokens": 235 } } When the actual response does:When finish_reason = tool_calls, function is empty {"status_code": 200, "request_id": "xxxx", "code": "", "message": "", "output": {"text": null, "finish_reason": null, "choices": [{"finish_reason": "null", "message": {"role": "assistant", "content": "", "tool_calls": [{"index": 0, "id": "call_46b2d6ab57224ea09b09ce", "type": "function", "function": {"name": "get_current_time", "arguments": "{}"}}]}}]}, "usage": {"input_tokens": 217, "output_tokens": 13, "total_tokens": 230, "prompt_tokens_details": {"cached_tokens": 0}}} {"status_code": 200, "request_id": "yyyyy", "code": "", "message": "", "output": {"text": null, "finish_reason": null, "choices": [{"finish_reason": "tool_calls", "message": {"role": "assistant", "content": "", "tool_calls": [{"index": 0, "id": "", "type": "function", "function": {}}]}}]}, "usage": {"input_tokens": 217, "output_tokens": 13, "total_tokens": 230, "prompt_tokens_details": {"cached_tokens": 0}}}
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#61