From f4858808f5fce4ebcc988ec2bdcab38778931fba Mon Sep 17 00:00:00 2001
From: ilya shusterman <shusterilyaman@gmail.com>
Date: Wed, 6 Mar 2024 20:15:34 +0200
Subject: [PATCH] [+] Added document metadata to the summary node dictionary.
 (#11671)

---
 .../llama_index/core/indices/document_summary/base.py          | 3 +++
 1 file changed, 3 insertions(+)

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 b9c4d51fbf..427192cf67 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 @@ the summary to the underlying Nodes.
 This summary can be used for retrieval.
 
 """
+
 import logging
 from collections import defaultdict
 from enum import Enum
@@ -199,11 +200,13 @@ class DocumentSummaryIndex(BaseIndex[IndexDocumentSummary]):
                 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(
-- 
GitLab