Neo4j CypherQAChain
Neo4j CypherQAChain answers questions about the information stored in a Neo4j graph database, where data is organised as items and the relationships between them (customers who buy products, employees who belong to teams, parts that make up a machine). You write the question in everyday words, an AI model translates it into a Neo4j query, the component runs it and gives you the answer.
Use it when your information is in Neo4j and you want to query it without writing queries by hand.
When to use it
- Ask “which suppliers deliver parts to more than three factories?” over the graph of your supply chain.
- Find which customers bought the same products as a given customer, to prepare recommendations.
- Find out whom an employee reports to and which projects they share with their team, from the org chart stored in Neo4j.
Configuration
Before you start you need a Neo4j database that NappAI can reach and a credential of the Neo4j API service with its address, user and password. See Credentials.
| Field | What it does |
|---|---|
| Credential (required) | The credential of the Neo4j API service. Pick one with Choose an option or create one with Add new credential. |
| Query (required) | The question, written in everyday words. You can type it or connect it, for example, to a Chat Input. |
| Neo4j Database (required) | The name of the Neo4j database you want to query. |
| Limit the number of results | The maximum number of results retrieved from the database. Default: 10. |
| Connection | What to connect |
|---|---|
| Model (required) | An AI model component, for example OpenAI. |
Output
- Text: the answer written by the model from what it found in the database. Connect it to a Chat Output or any text input.
- Data: the query results as they come from the database, one item per result, not written up. Connect them to components that work with data, for example to store or filter them.
Example
Recambios Fresno keeps in Neo4j which parts each machine model uses and which supplier provides them:
- Create a Neo4j API credential with the access details of its database.
- Add Neo4j CypherQAChain, choose that credential and type
recambiosin Neo4j Database. - Connect a Chat Input to Query, a model to Model and Text to a Chat Output.
When the purchasing team asks “which suppliers provide parts for the M-40 machine?”, the chat answers with the list of suppliers taken from the graph.
Good practices
- Use clear names for the item and relationship types in your graph: the model uses them to understand what to query.
- Use a Neo4j user with read-only permissions.