Upgrade to 0.8.3, metadata still lacks the return of token usage information. #5743

Closed
opened 2026-02-21 18:12:24 -05:00 by yindo · 1 comment
Owner

Originally created by @DayoWang on GitHub (Sep 23, 2024).

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

0.8.3

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

Upgrade to 0.8.3, metadata still lacks the return of usage information. Upgrade to 0.8.3, metadata still lacks the return of usage information. Moreover, it seems that the retriever_resources also did not return.

✔️ Expected Behavior

Return the metadata in the correct format.

Actual Behavior

The metadata data returned is empty.

Originally created by @DayoWang on GitHub (Sep 23, 2024). ### 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 0.8.3 ### Cloud or Self Hosted Cloud, Self Hosted (Docker) ### Steps to reproduce Upgrade to 0.8.3, metadata still lacks the return of usage information. Upgrade to 0.8.3, metadata still lacks the return of usage information. Moreover, it seems that the retriever_resources also did not return. ### ✔️ Expected Behavior Return the metadata in the correct format. ### ❌ Actual Behavior The metadata data returned is empty.
yindo added the 🐞 bug label 2026-02-21 18:12:24 -05:00
yindo closed this issue 2026-02-21 18:12:24 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 23, 2024):

I found two similar issues that might be relevant to your problem:

  1. Why doesn't the output of the workflow orchestration API include metadata like the Agent does (closed) [1].
  2. Can't get usage info in metadata object (closed) [2].

The metadata still lacks the return of usage information and retriever_resources after upgrading to Dify version 0.8.3 because the return_retriever_resource_info method is defined but not called anywhere in the provided code. To ensure that the metadata includes the return of usage information and retriever_resources, you need to call the return_retriever_resource_info method at the appropriate place in your code where the retriever resources are available and need to be processed.

Here is an example of how you might call this method:

for hit_callback in self.hit_callbacks:
    hit_callback.return_retriever_resource_info(context_list)

Make sure to place this call in the relevant part of your code where the retriever resources are being handled, such as after the context_list is populated with the necessary information [3][4].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Sep 23, 2024): <!-- Answer --> I found two similar issues that might be relevant to your problem: 1. [Why doesn't the output of the workflow orchestration API include metadata like the Agent does](https://github.com/langgenius/dify/issues/8530) (closed) <sup>[[1]](https://github.com/langgenius/dify/issues/8530)</sup>. 2. [Can't get usage info in metadata object](https://github.com/langgenius/dify/issues/8608) (closed) <sup>[[2]](https://github.com/langgenius/dify/issues/8608)</sup>. The metadata still lacks the return of usage information and retriever_resources after upgrading to Dify version 0.8.3 because the `return_retriever_resource_info` method is defined but not called anywhere in the provided code. To ensure that the metadata includes the return of usage information and retriever_resources, you need to call the `return_retriever_resource_info` method at the appropriate place in your code where the retriever resources are available and need to be processed. Here is an example of how you might call this method: ```python for hit_callback in self.hit_callbacks: hit_callback.return_retriever_resource_info(context_list) ``` Make sure to place this call in the relevant part of your code where the retriever resources are being handled, such as after the `context_list` is populated with the necessary information <sup>[[3]](https://github.com/langgenius/dify/blob/main/api/core/callback_handler/index_tool_callback_handler.py)</sup><sup>[[4]](https://github.com/langgenius/dify/blob/main/api/core/tools/tool/dataset_retriever/dataset_retriever_tool.py)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#5743