mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-06 05:25:04 +00:00
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:
16
templates/neo4j-cypher-memory/ingest.py
Normal file
16
templates/neo4j-cypher-memory/ingest.py
Normal 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"})
|
||||
"""
|
||||
)
|
Reference in New Issue
Block a user