- Install Neo4j (please use 5.x version)
- Install Neo4j GDS (graph data science) plugin
- Start neo4j server
- Get the
NEO4J_URL
,NEO4J_USER
andNEO4J_PASSWORD
- By default,
NEO4J_URL
isneo4j://localhost:7687
,NEO4J_USER
isneo4j
andNEO4J_PASSWORD
isneo4j
- By default,
Pass your neo4j instance to GraphRAG
:
from nano_graphrag import GraphRAG
from nano_graphrag._storage import Neo4jStorage
neo4j_config = {
"neo4j_url": os.environ.get("NEO4J_URL", "neo4j://localhost:7687"),
"neo4j_auth": (
os.environ.get("NEO4J_USER", "neo4j"),
os.environ.get("NEO4J_PASSWORD", "neo4j"),
)
}
GraphRAG(
graph_storage_cls=Neo4jStorage,
addon_params=neo4j_config,
)