Text2Cypher
Required Graph Shape
Description
The user question is translated to a cypher query by the LLM which is then executed against the database. The data returned by the execution is provided to the LLM.
Usage
The two related GraphRAG patterns Cypher Templates and Dynamic Cypher Generation are both limited by the queries / query snippets that are defined during implementation. This pattern is highly flexible. There are no predefined queries and (in theory) the LLM can generate any query. However, this pattern is not 100% reliable. LLMs are not perfect when translating text to cypher. If the LLM is not able to translate the given user query correctly, it will not be able to provide any answer.
Further reading
- Integrating Neo4j into the LangChain ecosystem (Tomaz Bratanic, April 2024)
- LangChain Cypher Search: Tips & Tricks (Tomaz Bratanic, June 2024)