Usage of ref_doc_id of Node parsed #73

Open
opened 2026-02-16 00:16:48 -05:00 by yindo · 0 comments
Owner

Originally created by @Joshua-Yu on GitHub (Apr 2, 2024).

Hi there,

I was trying to figure out which node belongs to which document so I used ref_doc_id of node, but it didn't seem to refer to the document. Below is my code:

from llama_index.core.node_parser import MarkdownElementNodeParser

node_parser = MarkdownElementNodeParser(llm=llm, num_workers=8)
nodes = node_parser.get_nodes_from_documents(documents)

base_nodes, objects = node_parser.get_nodes_and_objects(nodes)

for node in base_nodes:
    print(f"ref_doc:{node.ref_doc_id}")
    ... ... 

Any suggestion?

Cheers

Originally created by @Joshua-Yu on GitHub (Apr 2, 2024). Hi there, I was trying to figure out which node belongs to which document so I used ref_doc_id of node, but it didn't seem to refer to the document. Below is my code: ``` from llama_index.core.node_parser import MarkdownElementNodeParser node_parser = MarkdownElementNodeParser(llm=llm, num_workers=8) nodes = node_parser.get_nodes_from_documents(documents) base_nodes, objects = node_parser.get_nodes_and_objects(nodes) for node in base_nodes: print(f"ref_doc:{node.ref_doc_id}") ... ... ``` Any suggestion? Cheers
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: run-llama/llama_cloud_services#73