Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: Python SDK retrieve document_name is empty (#12062)

Stephen Hu2118bc255632
diff --git a/sdk/python/ragflow_sdk/modules/chunk.py b/sdk/python/ragflow_sdk/modules/chunk.py
index b71314d8ae..0f5bf596b6 100644
--- a/sdk/python/ragflow_sdk/modules/chunk.py
+++ b/sdk/python/ragflow_sdk/modules/chunk.py
@@ -33,6 +33,7 @@ class Chunk(Base):
self.create_timestamp = 0.0
self.dataset_id = None
self.document_name = ""
+ self.documnet_keyword = ""
self.document_id = ""
self.available = True
# Additional fields for retrieval results
@@ -46,6 +47,11 @@ class Chunk(Base):
res_dict.pop(k)
super().__init__(rag, res_dict)
+ #for backward compatibility
+ if not self.document_name:
+ self.document_name = self.documnet_keyword
+
+
def update(self, update_message: dict):
res = self.put(f"/datasets/{self.dataset_id}/documents/{self.document_id}/chunks/{self.id}", update_message)
res = res.json()