Find answers from the community

Updated 2 months ago

Troubleshooting GraphRAG Pipeline with LlamaIndex and Neo4J

At a glance

The community member is building a GraphRAG pipeline with LlamaIndex and Neo4J. They are trying to load an existing graph to their index, but they are getting an AttributeError when trying to do a query. The issue is that the GraphRAGStore object does not have an entity_info attribute. The community member's code works if they build the communities before with graphrag_index.property_graph.build_communities(), but this function is very expensive to run.

In the comments, another community member suggests that the code is using a custom graph store, and the community member will need to save and load the communities to disk or elsewhere. Since the graph store is already custom, the community member should be able to easily add this functionality.

There is no explicitly marked answer in the comments.

[QUESTION]

Hey, guys. Good evening!

So I'm building a GraphRAG pipeline with LlamaIndex and Neo4J. I'm trying to load an existing graph to my index (to avoid rebuilding it, etc.), and it's working. However, I get the following error when I try to do a query:

AttributeError: 'GraphRAGStore' object has no attribute 'entity_info'

Here's my code:

Plain Text
def load_graphrag():
  graphrag_index = PropertyGraphIndex.from_existing(
        property_graph_store=graph_store, 
        embed_kg_nodes=True
    )

    graphrag_query_engine = GraphRAGQueryEngine(
        graph_store=graph_store,
        llm=llm,
        index=graphrag_index,
        similarity_top_k=20,
    )
  return graphrag_query_engine

def main():
    graphrag = load_graphrag()
    response = graphrag.query(query_str)


It only works if I build the communities before with graphrag_index.property_graph.build_communities()

but running this function is very expensive. Does anybody knows how to solve it? Thx!!
L
a
2 comments
this is using the code from that graphrag notebook right? So its using a custom graph store? You'll need to save and load the communities to disk or elsewhere. Since the graph store is already custom, should be easy to add
Add a reply
Sign up and join the conversation on Discord