Introducing GraphRAG with LangChain and Neo4j

Part 1: Getting Started with Graph Databases in the LLMs Era

Valentina Alto
Microsoft Azure
Published in
11 min readApr 28, 2024

--

In my latest article about graph-based techniques in the LLM-powered applications landscape, we explored how these data structures can be levaraged in the context of multi-agents frameworks. More specifically, we covered a new LangChain library, LangGraph, introduced in January 2024 and based on the mathematical object of graph as representative framework for agentic applications.

The main goal of LangGraph is to overcome the main limitations of traditional LangChain’s chains, that is, the lack of cycles into their runtime; this limitation can be easily bypassed by introducing a graph-like structure which easily introduces cycles into chains that are, by design, directed acyclic graphs (DAGs).

However, graphs are powerful tools also in organizing the knowledge base in Retrieval Augmented Generation (RAG) scenarios. More specifically, they enhance the “Retrieval” phase and lead to a more meaningful context retrieval, with the final result of getting more accurate generated responses. To achieve that, the idea is that of storing the knowledge base into graph-based databases (such as Neo4j) leveraging the semantic power of LLMs to correctly extract and map entities and relationships.

--

--

Valentina Alto
Microsoft Azure

Data&AI Specialist at @Microsoft | MSc in Data Science | AI, Machine Learning and Running enthusiast