Unable to Retrieve KnowledgeGraphIndex from Neo4j #15957
Replies: 1 comment
-
Hey there, @jamesjohnson1025! I'm here to help you with any bugs, questions, or contributions you have. Just give me a shout, and I'll do my best to assist you while we wait for a human maintainer. I found some similar issues and discussions that might help you resolve the problem:
To successfully retrieve a from llama_index.core import StorageContext, KnowledgeGraphIndex
from llama_index.graph_stores.neo4j import Neo4jGraphStore
# Define your Neo4j connection parameters
username = "neo4j"
password = "xxx"
url = "bolt://localhost:7687"
database = "embeddingneo4j"
# Instantiate the Neo4jGraphStore
graph_store = Neo4jGraphStore(
username=username,
password=password,
url=url,
database=database,
)
# Create a storage context with the graph store
storage_context = StorageContext.from_defaults(graph_store=graph_store)
# Retrieve the KnowledgeGraphIndex from the storage context
index = KnowledgeGraphIndex.from_storage_context(storage_context=storage_context)
# Now you can use the index to query the knowledge graph
query_engine = index.as_query_engine(include_text=True, response_mode="tree_summarize", embedding_mode="hybrid", similarity_top_k=5)
response = query_engine.query("Can we get all the custom fields from audience list filter?")
from IPython.display import Markdown, display
display(Markdown(f"<b>{response}</b>")) This code sets up the connection to your Neo4j instance, creates a Make sure your Neo4j instance is correctly configured and that the node labels match those expected by the retriever. If you encounter any issues, you might want to increase logging verbosity to get detailed output during the retrieval process [4]. |
Beta Was this translation helpful? Give feedback.
-
I'm attempting to create a KnowledgeGraphIndex, store it in Neo4j, and then retrieve it for querying. However, I'm encountering issues when trying to load the index from Neo4j. The index seems to be created and stored successfully (I guess so), but retrieval fails.
The error says ValueError(f"Failed to load index with ID {index_id}")
Please let me know if I am wrong.
When using Neo4jGraphStore, shouldn't the index be automatically saved in the Neo4j database? If I still need to use a persist directory to save the index locally, I'm curious about the purpose of Neo4jGraphStore. Could you clarify the role of Neo4jGraphStore and explain whether local storage is necessary when using it?
Beta Was this translation helpful? Give feedback.
All reactions