How neo4j-graphacademy/genai-workshop-graphrag works
Main Components
• Knowledge Graphs & Vectors Module – This is represented by the “1-knowledge-graphs-vectors” directory. It contains scripts like build_graph.py and create_and_embed_chunks.py that focus on building knowledge graphs, generating vector embeddings, and likely indexing these vectors.
• Neo4j GraphRAG Module – Found in the “2-neo4j-graphrag” directory, this module includes components like:
– hybrid_cypher_retriever.py
– hybrid_retriever.py
– text2cypher_retriever.py
– vector_cypher_retriever.py
– vector_retriever.py
– multimodal_app.py
These scripts indicate an architecture that integrates Neo4j database functionality with methods for retrieving information both via Cypher (graph queries) and vector similarity search. The “solutions” folders under each module contain tested sample solutions that illustrate the intended usage.
• Database Component – Although there isn’t a database configuration in the repository itself, the README instructs users to create a Neo4j instance preloaded with a “recommendations” dataset. This Neo4j instance is a critical external component that the application interacts with.
• Environment & Configuration – Files such as .env.example, devcontainer configuration files, and setup instructions in SETUP.md indicate that containerization and environment setup are integral to running and testing the system.
Relationships and Data Flow
• Data Ingestion & Preprocessing: The “build_graph.py” and “create_and_embed_chunks.py” scripts process raw data to create embeddings and build a knowledge graph. The outputs here feed into the Neo4j instance.
• Retrieval Operations: In the Neo4j GraphRAG module, different retriever components (text-based, vector-based, hybrid, etc.) are responsible for querying the database. The multimodal_app.py likely ties together these retrieval modalities.
• Testing & Solutions: The “solutions” directories in both modules contain ready-made examples that demonstrate how each component should work and integrate with Neo4j, serving as interactable proofs of concept.
Architectural Patterns & Design Principles
• Modular Design: The separation into “1-knowledge-graphs-vectors” and “2-neo4j-graphrag” shows a deliberate modular split between data preparation (embedding and graph construction) and retrieval mechanisms (querying data via different strategies).
• Layered Architecture: Although not a full-stack application (i.e., no distinct frontend-backend separation), the project shows a clear separation between the “data processing” layer and the “retrieval/query” layer.
• Extensibility: The presence of multiple retriever types (vector, cypher, hybrid, and text-to-cypher) highlights the emphasis on experimentation with different retrieval methods.
Technologies and Frameworks
• Neo4j Database – Central to the architecture for storing and querying the knowledge graphs and vector indices.
• Python Modules – The various Python scripts and modules represent the logic handling data processing, embedding creation, and retrieval methods.
• Development Container – The .devcontainer settings indicate a containerized development environment, which should be depicted as a supportive, enabling infrastructure component.