Open yjc980121 opened 4 hours ago
@yjc980121 Hello there! I'm here to help you with any bugs, questions, or contributions you have for the project. Let's work together to resolve this issue.
To address the issue of the empty retriever_resources
node in the API response, you should verify the following conditions and configurations:
Configuration Check: Ensure that the retriever_resource
configuration is enabled. The configuration should include "retriever_resource": {"enabled": True}
to ensure that retriever resources are included in the response [1].
Context Fetching Conditions: The retriever_resources
node is populated when the _fetch_context
method yields a RunRetrieverResourceEvent
with non-empty retriever_resources
. This requires:
node_data.context.enabled
to be True
.node_data.context.variable_selector
to be set.context_value_variable
retrieved from the variable_pool
to be an ArraySegment
.context_value_variable.value
should contain a "content" key, and the _convert_to_original_retriever_resource
method should return a non-None
value for each item [2].Error Handling: Check for any errors during the retrieval process. The code includes error handling that logs warnings and returns a failed status if a KnowledgeRetrievalNodeError
occurs [3].
Filtering Logic: Ensure that the filtering logic does not exclude relevant retriever resources. This includes checking dataset availability, score thresholds, and segment filtering [4].
By ensuring these conditions and configurations are correctly set, the retriever_resources
node should be populated as expected in the API response.
To continue talking to Dosu, mention @dosu.
Please check if this retriever_resource switch is enabled.
Self Checks
Dify version
0.11.0
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Endpoint: /v1/messages
Description: When making a GET request to the /v1/messages endpoint with the following parameters:
user=abc-123
conversation_id=
and including the Authorization: Bearer {api_key} header, the response contains an empty retriever_resources node. This behavior is inconsistent with the documentation, which provides an example response that includes a non-empty retriever_resources node.
Expected Behavior: The retriever_resources node in the response should contain the expected data, allowing the caller to display the source of the referenced information when viewing the conversation history.
Actual Behavior: The retriever_resources node in the response is empty, which prevents the caller from displaying the source of the referenced information in the conversation history.
Steps to Reproduce:
Make a GET request to /v1/messages with the query parameters user=abc-123 and conversation_id=.
Include the Authorization: Bearer {api_key} header.
Observe the response, specifically the retriever_resources node.
Impact: This issue prevents the caller from displaying the source of the referenced information in the conversation history, which is a critical feature for the application.
Request: Please investigate why the retriever_resources node is empty and update the API to return the expected data as described in the documentation.
✔️ Expected Behavior
❌ Actual Behavior