Congratulations!

Graph RAG with LangChain and Neo4j

Adam Cowley

Manager, Developer Education at Neo4j

Chapter 1

Text Vector Embedding
He's just a city boy born [0.12, -0.34, 0.56, 0.78, ..., -0.91]
born and raised in South Detroit [0.22, 0.45, -0.67, 0.11, ..., 0.33]
He took the midnight train [-0.55, 0.89, 0.12, -0.44, ..., 0.67]
going anywhere [0.78, -0.23, 0.45, 0.91, ..., -0.12]

A graph diagram showing the entities mentioned in the lyrics for Don't stop believing.  A small town boy, with BORN and RAISED relationships to South Detroit

Graph RAG with LangChain and Neo4j

Chapter 1

The node diagram including the Book and two WRITTEN_BY relationships to authors to demonstrate that nodes can have many relationships.

Graph RAG with LangChain and Neo4j

Chapter 1

The results are injected into the prompt ready to be sent to the LLM

Graph RAG with LangChain and Neo4j

Chapter 2

A diagram representing a hierarchy a document, one-to-many relationships to pages, each of which has many chunk nodes associated with it

act_splitter = RecursiveCharacterTextSplitter(
    # Split text into acts
    separators=[ r"\n\nTHE PROLOGUE.",  r"\n\nACT",
                 r"\n\n\*\*\* END"],
    is_separator_regex=True
)

scene_splitter = RecursiveCharacterTextSplitter(
    # Split act into scenes
    separators=[r"\nSCENE "],
    is_separator_regex=True
)
Graph RAG with LangChain and Neo4j

Chapter 2

The text properties on the nodes are used to create an embedding

Graph RAG with LangChain and Neo4j

Chapter 2

An example domain graph model consisting of a person who works at a company, located in an address.  The person holds a credit card, which has an order placed against it at a company in the same location

Graph RAG with LangChain and Neo4j

Chapter 3

entity_resolution5.jpg

Graph RAG with LangChain and Neo4j

Chapter 3

 

ragas.png

 

  • Context Precision: Measures the proportion of relevant chunks in retrieved documents
  • Noise Sensitivity: Measures amount of irrelevant information in retrieved documents
Graph RAG with LangChain and Neo4j

Chapter 3

Graph RAG with LangChain and Neo4j

graph_academy.png

1 https://graphacademy.neo4j.com/
Graph RAG with LangChain and Neo4j

Let's practice!

Graph RAG with LangChain and Neo4j

Preparing Video For Download...