Got unknown type role=<PromptMessageRole.TOOL:'tool'>
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] Please do not modify this template :) and fill in all the required fields.
Dify version
0.6.11
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
every time i use a tool in the agent mode, after the tool perform its job, the agent no longer accept any further prompts. seems the agent feels that it has used the tool and the tool has done the job, therefore no more action is required or accepted. This happens with all tools available to dify.
anyone has the same issue?
✔️ Expected Behavior
to be able to continue with the conversation
❌ Actual Behavior
cannot go on with the conversation.
Hello @drfenixlinghu! I'm here to assist you with bug fixes, answer questions, and guide you on becoming a contributor. Let's tackle this issue together!
Yes, the issue you described with Dify version 0.6.11, where the agent no longer accepts further prompts after a tool has completed its task and throws an error indicating an unknown type role with role=<PromptMessageRole.TOOL: 'tool'>, has been experienced by others. The provided code defines the PromptMessageRole enum, which includes the TOOL role, and the ToolPromptMessage class, which uses this role. The error might be due to improper handling or validation of the TOOL role in the system.
From the api/core/agent/base_agent_runner.py file, it appears that the BaseAgentRunner class initializes and manages tools through methods like _init_prompt_tools and _convert_tool_to_prompt_message_tool. These methods ensure that tools are properly converted to PromptMessageTool instances and their parameters are correctly set. However, if there is an issue with how the TOOL role is being processed or validated, it could lead to the error you are encountering. It might be worth checking the implementation of these methods and ensuring that the TOOL role is being handled correctly throughout the agent's lifecycle [1][2].
To continue talking to Dosu, mention @dosu.
I think this should be fixed in latest main branch.
the error exist a long time since 0.6.10 and can't resolved at 0.6.11
Link https://github.com/langgenius/dify/issues/5304
Yes we just fixed yesterday. https://github.com/langgenius/dify/pull/5245
Yes we just fixed yesterday. #5245
updated today the problem is still there
最新mast版本, sd遇到同样错误
which model are you using for this?
@Yeuoly I'm using GLM-4 with the same problem.
Does this problem have been fixed until now? @crazywoola
Does this problem have been fixed until now? @crazywoola
I think it can be closed. It was fixed from v0.6.13.