Find answers from the community

Home
Members
Xuất khẩu lao động Nhật Bổn
X
Xuất khẩu lao động Nhật Bổn
Offline, last seen 2 months ago
Joined October 4, 2024
I have a list of nodes like that
Plain Text
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()
Plain Text
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
Plain Text
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 ?
2 comments
L
X
[BUG] I have problem with MongoDBAtlasVectorSearch, I already add node and embedding document but the result when Retrieval or Query (using index.as_retriever() and index.as_query_engine() ) is empty
2 comments
L
X