1. Learn
  2. /
  3. Courses
  4. /
  5. Graph RAG with LangChain and Neo4j

Connected

Exercise

Building a text-to-Cypher chain

You've written you're own Cypher queries, so let's try using LLMs to generate them! Generating a Cypher query from a user query in natural language is a key part of a text-to-Cypher Graph RAG workflow.

You're working with the same database as the previous exercise, containing nodes that represent people, companies, and WORKS_FOR relationships available as graph.

Instructions

100 XP
  • Update the partial_variables dictionary to insert the graph schema into the prompt.
  • Create the text-to-Cypher chain using the prompt, llm, and parsing to a string.