-
Notifications
You must be signed in to change notification settings - Fork 508
Description
@marcusschiesser and I agree in #2232 that, when a Document is roundtripped through a VectorStore, it should be returned as a Document. It is currently returned as a TextNode.
The culprit is metadataDictToNode, which returns only Nodes of type INDEX and TEXT. This function is used in most vector stores to rehydrate a JSON dict representing a node into a Node object. The function should probably be modified to return Document (and perhaps other types of nodes that might be stored in a VectorStore).
Note that nodeToMetadata, the counterpart to metadataDictToNode does appear to properly record the nodeType and _node_type attributes in the metadata dict that is written to Postgres in PGVectorStore: {"doc_id": "None", "nodeType": "Document", "_node_type": "Document", "ref_doc_id": "None", "create_date": "2025-11-28T22:45:33.046Z", "document_id": "None", "_node_content": "{\"id_\":\"5bb16627-f6c0-459c-bb18-71642813ef21\",\"excludedEmbedMetadataKeys\":[],\"excludedLlmMetadataKeys\":[],\"relationships\":{},\"text\":\"\",\"textTemplate\":\"\",\"metadataSeparator\":\"\\n\",\"type\":\"DOCUMENT\",\"hash\":\"+yyksHlikZPxyhP5bhcUU4c04Jy/8FWHIuNN3Ef3V98=\"}"}