I have a list of nodes like that
nodes= [TextNode(
text=f"{original_code}",
id_="parent_1",
},
TextNode(
text=f"{chunk}",
id_="child_1_1",
metadata={
"KG_RELATIONS_KEY": [Relation(
source_id="parent_1",
target_id="child_1_1",
label=get_node_rel_string(NodeRelationship.PARENT),
)]),....
]
And I create PropertyGraphIndex using kg_extractors by ImplicitPathExtractor()
property_graph_index = PropertyGraphIndex(
nodes=nodes,
kg_extractors=[ImplicitPathExtractor()] # Provide nodes directly to PropertyGraphIndex
)
but when I retrieve a node via
property_graph_index.as_retriever()
the result that give me
Node ID: 807bc464-c42c-4824-bfcb-3dcac920237f
Text: parent_1-> PARENT -> child_1_1
Score: 0.000
I just expectation that the result retrieve base on the vector embeding of the node.text
I have tried advise of Dosu bot in Github
from llama_index.core.indices.property_graph import VectorContextRetriever
# Assuming you have an embedding model set up
embed_model = OpenAIEmbedding(model_name="text-embedding-3-small")
vector_retriever = VectorContextRetriever(
index.property_graph_store,
embed_model=embed_model,
similarity_top_k=2, # Number of top similar nodes to retrieve
path_depth=1, # Depth of relations to follow after node retrieval
include_text=True # Include source chunk text with retrieved paths
)
retriever = property_graph_index.as_retriever(sub_retrievers=[vector_retriever])
nodes = retriever.retrieve("Your query text here")
but it always give a empty result
Anyone can help me explain for me or give me some advise ?