diff --git a/llama-index-core/llama_index/core/indices/document_summary/base.py b/llama-index-core/llama_index/core/indices/document_summary/base.py index b9c4d51fbfc81..427192cf6735d 100644 --- a/llama-index-core/llama_index/core/indices/document_summary/base.py +++ b/llama-index-core/llama_index/core/indices/document_summary/base.py @@ -5,6 +5,7 @@ This summary can be used for retrieval. """ + import logging from collections import defaultdict from enum import Enum @@ -199,11 +200,13 @@ def _add_nodes_to_index( nodes=nodes_with_scores, ) summary_response = cast(Response, summary_response) + metadata = doc_id_to_nodes.get(doc_id, [TextNode()])[0].metadata summary_node_dict[doc_id] = TextNode( text=summary_response.response, relationships={ NodeRelationship.SOURCE: RelatedNodeInfo(node_id=doc_id) }, + metadata=metadata, ) self.docstore.add_documents([summary_node_dict[doc_id]]) logger.info(