LangChain और Neo4j के साथ Graph RAG
Adam Cowley
Manager, Developer Education at Neo4j




Paul Graham, Generative AI के बारे में क्या सोचते हैं?
Paul Graham ने कितनी Generative AI स्टार्टअप्स में निवेश किया है?
| टेक्स्ट | वेक्टर एम्बेडिंग |
|---|---|
| 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] |

| टेक्स्ट | वेक्टर एम्बेडिंग |
|---|---|
| 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] |

| टेक्स्ट | वेक्टर एम्बेडिंग |
|---|---|
| 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] |

langchain-neo4j LangChain इंटीग्रेशन
from langchain_neo4j.graphs.graph_document \ import Nodebook = Node(type="Book",id=f"9781098127107",properties={ "title": "Building Knowledge Graphs" })

from langchain_neo4j.graphs.graph_document \
import Node, Relationship
book = Node(type="Book", id=f"9781098127107")
jesus = Node(type="Person", id="dr-jesus-barrasa")
jim = Node(type="Person", id="chief-scientist")
for author in [jesus, jim]: relationship = Relationship()

from langchain_neo4j.graphs.graph_document \
import Node, Relationship
book = Node(type="Book", id=f"9781098127107")
jesus = Node(type="Person", id="dr-jesus-barrasa")
jim = Node(type="Person", id="chief-scientist")
for author in [jesus, jim]: relationship = Relationship(source=book,)

from langchain_neo4j.graphs.graph_document \
import Node, Relationship
book = Node(type="Book", id=f"9781098127107")
jesus = Node(type="Person", id="dr-jesus-barrasa")
jim = Node(type="Person", id="chief-scientist")
for author in [jesus, jim]: relationship = Relationship(source=book,target=author,)

from langchain_neo4j.graphs.graph_document \
import Node, Relationship
book = Node(type="Book", id=f"9781098127107")
jesus = Node(type="Person", id="dr-jesus-barrasa")
jim = Node(type="Person", id="chief-scientist")
for author in [jesus, jim]: relationship = Relationship(source=book,target=author,type="WRITTEN_BY"properties=dict(...))

from langchain_neo4j import Neo4jGraphgraph = Neo4jGraph( url=NEO4J_URI, username=NEO4J_USERNAME, password=NEO4J_PASSWORD )
from langchain_neo4j.graphs.graph_document import GraphDocument# Nodes और Relationships के लिए रैपर doc = GraphDocument(nodes=[book, jesus, jim],relationships=[jesus_wrote_book, jim_wrote_book])# नोड्स और रिश्तों को डेटाबेस में सेव करें graph.add_graph_documents([graph_document])


LangChain और Neo4j के साथ Graph RAG