Neo4j conversation cypher template (#12927)

Adding custom graph memory to Cypher chain

---------

Co-authored-by: Erick Friis <erick@langchain.dev>
This commit is contained in:
Tomaz Bratanic
2023-11-07 20:05:28 +01:00
committed by GitHub
parent 2287a311cf
commit d9abcf1aae
8 changed files with 1770 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
from langchain.graphs import Neo4jGraph
graph = Neo4jGraph()
graph.query(
"""
MERGE (m:Movie {name:"Top Gun"})
WITH m
UNWIND ["Tom Cruise", "Val Kilmer", "Anthony Edwards", "Meg Ryan"] AS actor
MERGE (a:Actor {name:actor})
MERGE (a)-[:ACTED_IN]->(m)
WITH a
WHERE a.name = "Tom Cruise"
MERGE (a)-[:ACTED_IN]->(:Movie {name:"Mission Impossible"})
"""
)