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

Connected

Exercise

The final link in the chain

With the text-to-cypher chain from Chapter 1 and the vector retriever from earlier in this Chapter, you now have the components to create a chain that provides multiple ways—both vectors and nodes and relationships—to access the information in your knowledge graph.

The text_to_cypher_chain and line_retriever (the Neo4j vector retriever) variables are available for you to use, along with a question-answering prompt for hybrid retrieval, graphrag_qa_prompt.

Instructions

100 XP
  • Pass the "question" key to the vector retriever (line_retriever) to get relevant results using vector search.
  • Extract the query from the graph object to execute the Cypher statement generated by the text_to_cypher_chain.
  • Execute graphrag_qa_chain on the input provided.