Property graph index in-memory #13939
-
Hello! I tried the property graph index soon after it was released. One issue I had at that time was the reliance on Neo4j. What I am looking for is a property graph index that can be stored in-memory like the Is this currently possible with the property graph index? I have not looked into the nitty gritty details of the implementation. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 6 replies
-
Yes, it is currently possible to use the property graph index in a manner that allows it to be stored in-memory and also in an external graph database like Neo4j. The Here is an example: from llama_index.core.indices.property_graph import PropertyGraphIndex
from llama_index.graph_stores.neo4j import Neo4jPropertyGraphStore
# Create a Neo4jPropertyGraphStore instance
graph_store = Neo4jPropertyGraphStore(
username="neo4j",
password="neo4j",
url="bolt://localhost:7687",
database="neo4j"
)
# Create the index
index = PropertyGraphIndex.from_documents(
documents,
property_graph_store=graph_store,
) This example shows how to instantiate a Additionally, you can set up Neo4j locally using Docker: docker run \
-p 7474:7474 -p 7687:7687 \
-v $PWD/data:/data -v $PWD/plugins:/plugins \
--name neo4j-apoc \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
-e NEO4JLABS_PLUGINS=\[\"apoc\"\] \
neo4j:latest After launching Neo4j, you can access it at http://localhost:7474/ with the default username/password of |
Beta Was this translation helpful? Give feedback.
-
This is not exactly on topic with the original question but it seems that the |
Beta Was this translation helpful? Give feedback.
-
@dosu Finally, I managed to print the full trace of the exception using
where Given the error, I believe the fix is along the following lines, at the time of construction of the property graph index: graph_index = PropertyGraphIndex(
...
embed_kg_nodes=True if not global__neo4j_disable else False,
...
) This does work! |
Beta Was this translation helpful? Give feedback.
Yes, there is an equivalent in-memory
graph_store
for the property graph index that you can use instead of Neo4j. TheSimplePropertyGraphStore
class in the LlamaIndex framework implements a simple in-memory labelled property graph store.Here is the relevant code snippet: