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 09ce35d4279f4..f1895c53c245d 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 @@ -200,13 +200,15 @@ 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 + docid_first_node = doc_id_to_nodes.get(doc_id, [TextNode()])[0] summary_node_dict[doc_id] = TextNode( text=summary_response.response, relationships={ NodeRelationship.SOURCE: RelatedNodeInfo(node_id=doc_id) }, - metadata=metadata, + metadata=docid_first_node.metadata, + excluded_embed_metadata_keys=docid_first_node.excluded_embed_metadata_keys, + excluded_llm_metadata_keys=docid_first_node.excluded_llm_metadata_keys, ) self.docstore.add_documents([summary_node_dict[doc_id]]) logger.info( @@ -227,7 +229,6 @@ def _add_nodes_to_index( node_with_embedding = node.copy() node_with_embedding.embedding = id_to_embed_map[node.node_id] summary_nodes_with_embedding.append(node_with_embedding) - self._vector_store.add(summary_nodes_with_embedding) def _build_index_from_nodes(