Neo4j + LangChain GraphRAG tutorial vs vector RAG

Learn how GraphRAG combines vector retrieval with graph relationships, then follow Neo4j ingestion and LangChain-generated Cypher queries.

Player not loading? Watch on YouTube

This tutorial compares vector RAG with GraphRAG through a Neo4j and LangChain example. The speaker explains how similarity search retrieves text chunks, then argues that explicit graph relationships can help answer questions about connected entities. Policy documents and company relationships illustrate the use cases. He also notes that graph retrieval is unnecessary when text similarity alone meets the task.

The code walkthrough reads a text file about AI organizations and splits it into chunks with custom paragraph and size logic. LangChain's LLMGraphTransformer extracts nodes and relationships, which the code writes to Neo4j. The example lets the LLM choose entity and relationship types; the speaker describes options for restricting them. Including source text creates document nodes alongside the extracted entities. The ingestion script clears the existing graph before writing.

The retrieval section introduces a vector retriever and a LangChain prompt that asks an LLM to generate Cypher. The walkthrough reaches that prompt explanation without showing a completed query result or a measured improvement over vector search. The example uses an OpenAI connection and API credentials; it does not demonstrate an offline or fully self-hosted model setup.