How neo4j/neo4j-graphrag-python works
Project type and purpose
• This is not a web front-end/backend application but a Python SDK/library (“neo4j-graphrag”) that enables developers to build Graph Retrieval-Augmented Generation (GraphRAG) applications.
• It provides two major feature sets:
• Knowledge Graph construction pipelines (SimpleKGPipeline & customizable Pipeline)
• Retrieval and RAG generation (Vector/Hybrid/Text2Cypher retrievers + GraphRAG generator)
• It integrates with Neo4j (graph database), external vector stores (Weaviate, Pinecone, Qdrant), and LLM providers (OpenAI, Anthropic, Cohere, Vertex AI, Mistral, Ollama).
File structure
• Top-level “src/neo4j_graphrag” holds the production library code, organized by functionality:
• embeddings/ – pluggable embedder adapters
• llm/ – pluggable LLM adapters
• retrievers/ – Vector, Hybrid, Text2Cypher, External store integrations
• generation/ – GraphRAG orchestration that receives retrieved context + LLM
• experimental/pipeline/ – fully configurable pipeline engine: components, config reader, orchestrator, notifications
• indexes.py – create / upsert Neo4j vector indexes
• schema.py, filters.py, neo4j_queries.py – domain logic for graph operations
• Tests are split into unit (per-module) and e2e (requiring Neo4j + optional vector DBs).
• Examples folder demonstrates usage patterns.
README for additional insights
• Confirms core abstractions: SimpleKGPipeline vs. Pipeline, retrievers, GraphRAG class.
• Emphasizes external dependencies: Neo4j driver, LLM providers, optional vector DB clients.
• Shows sample flows:
a) Build KG: text → embedder → pipeline components → Neo4j write
b) Create/populate vector index: Neo4j index APIs
c) Retrieve & answer: query → retriever → GraphRAG → LLM → answer
Final reminder
Be detailed: include every major module, component family, and external integration. Don’t overthink—separate the library into its logical sub-systems (Pipeline, Embeddings, LLM, Retrievers, Indexing, EG storage, Generation) and map out how they connect to Neo4j, vector DBs, and LLM APIs.