Add Citations and Attributions to Agent Node
Self Checks
- [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] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
- [x] Please do not modify this template :) and fill in all the required fields.
1. Is this request related to a challenge you're experiencing? Tell me about your story.
Are there any plans for this feature?
2. Additional context or comments
No response
3. Can you help us with this feature?
- [x] I am interested in contributing to this feature.
@Nov1c444 Have any plan about this?
Thank you for your valuable suggestion. We appreciate your input and agree it would be effective, however we don't currently have plans to implement this feature in the short term.
Can you assign this issue to me? I will implement this feature.
I plan to support Array[Object] type parameters for the tool plugin. Andd add retriever_resource type in MessageType. Or Any type(refer to context parameters of LLM node)
I refer to the log type. The log message returned by the tool plugin is converted into AgentLogEvent type in dify-api. the retriever_resource message returned by the plugin will be converted into AgentRetrieverResourceEvent type.
class MessageType(Enum):
TEXT = "text"
FILE = "file"
BLOB = "blob"
JSON = "json"
LINK = "link"
IMAGE = "image"
IMAGE_LINK = "image_link"
VARIABLE = "variable"
BLOB_CHUNK = "blob_chunk"
LOG = "log"
RETRIEVER_RESOURCES = "retriever_resources "
@Nov1c444 What do you think?
Solution
Action 2.1 Detailed steps:
Add two new features to the Agent strategy
- features[n] = context
- parameters[n].XXX.context.enabled = true
Example (using the official Agent strategy plugin)
- For the
feature features[n] = context, the dify-web frontend renders a context selection box based on the parameter information.
- For the
parameters[n].XXX.context.enabled = truefeature, support for selecting context variables in the field (see LLM node)
Action 2.2 Detailed steps:
-
The dify-api backend obtains the context and prompt word parameters. If the prompt word contains context variables, the context is converted into text and filled into the parameters.
-
Pass the parameters to the plugin.
Action 2.3 Detailed steps:
- If the Agent Node specifies the context, push the reference and attribution on the Agent node (dify-api).
Thank you for your contribution. I will review it this week. If you'd like to discuss some details with me afterwards, you can add my WeChat: No1v444
When is this feature expected to go online? I noticed that the dify-plugin has added the create_retriever_resource_message method, but dify itself does not yet support this message type.
It will be merged in this week.