Memgraph logo
Back to blog
GraphChat: How to Ask Questions and Talk to the Data in Your Graph DB?

GraphChat: How to Ask Questions and Talk to the Data in Your Graph DB?

By Sara Tilly
9 min readMarch 5, 2025

If you’ve ever been intimidated by Cypher (or any query language, really), then Memgraph’s GraphChat is about to change the game for you. With GraphChat, you can talk to your data—literally. With just a few Cypher basics, you ask the questions in plain English, and GraphChat does the hard work of translating them into Cypher and delivering the answers you need, again in plain English.

Let's dive into how GraphChat works, why it's useful, and how it fits into the growing world of GenAI and GraphRAG applications.

What is GraphChat?

At its core, GraphChat is a natural language querying feature integrated into Memgraph Lab. It leverages Large Language Models (LLMs), like OpenAI's GPT-4, to translate human language into Cypher, the language used for querying graph databases. Think of it as the middle layer that lets you avoid the technicalities of Cypher and allows you to focus on getting the information you need.

memgraph-lab-graphchat-high-level-overview-how-it-works

GraphChat is designed to make querying accessible to anyone, regardless of their technical skill. Whether you’re a data scientist or a business analyst, you no longer need to write complex queries. Just ask, and GraphChat will handle the rest.

Our Head of Platform Engineering held a great webinar about GraphChat titled From Questions to Queries: How to Talk to Your Graph Database With LLMs? so be sure to watch it.

Why Do You Need GraphChat?

If you’ve ever dealt with graph databases, you know that Cypher is powerful but can be complex. So why do you need GraphChat?

  1. Lower the learning curve - Cypher can be intimidating, especially for non-technical users. With GraphChat, you just ask your question in natural language, and let the model do the rest.
  2. Fast insights - GraphChat is ideal when you need to quickly extract insights from your graph data. For example, “What is the shortest route between City A and City B?” or “Who are the top 3 influencers in this network?”
  3. Error handling and retries - GraphChat doesn’t just translate—if it encounters a problem, it will try to correct invalid Cypher queries. The default retry setting is three times however you can change this. This feature ensures you get accurate results without needing to tinker with syntax.
  4. Conversations history and context - GraphChat remembers past messages, maintaining up to five previous interactions by default (adjustable by the user). This means smoother conversations where you can reference previous results without repeating yourself. You can also exclude specific messages from context if needed.
  5. Threads for better organization - Like ChatGPT, GraphChat supports threads, so you can separate different discussions. This is particularly useful for comparing models—chat with one model in one thread and another in a separate thread.
  6. Advanced customization - Choose from multiple providers (Ollama, Azure OpenAI, OpenAI), models (GPT-4, GPT-4o, etc.), and fine-tune parameters like temperature, history depth, and retry count. GraphChat adapts to your needs, whether you’re prioritizing speed, precision, or creativity.
  7. Collaboration-friendly – Business analysts, product managers, and decision-makers can interact with graph data directly, without relying on engineers. GraphChat democratizes access to insights, making data-driven decision-making more efficient across teams.

GraphChat in the GraphRAG and GenAI Ecosystem

Here’s where things get really interesting. GraphChat isn’t just about querying databases in isolation—it can be a part of a larger picture called GraphRAG (Retrieval-Augmented Generation). So, what’s that all about?

What is GraphRAG?

GraphRAG, or Graph Retrieval-Augmented Generation, is an advanced AI framework that combines Large Language Models (LLMs) with graph databases to create intelligent, context-aware applications. While LLMs excel at generating human-like text, they often lack access to real-time, domain-specific information, leading to inaccuracies or "hallucinations." GraphRAG addresses this by integrating LLMs with knowledge graphs, ensuring AI outputs are grounded in accurate, up-to-date data.

how-graphrag-works-in-memgraph

In this architecture, Memgraph serves as the context engine, dynamically feeding relevant information from your knowledge graph into the LLM's context window. This integration enables the development of personalized AI applications, such as chatbots and agents, that deliver precise, context-rich responses. By leveraging Memgraph's in-memory graph database, GraphRAG facilitates real-time data retrieval and multi-hop reasoning, enhancing the AI's ability to understand complex relationships within the data.

Moreover, Memgraph 3.0 introduces features like improvements to GraphChat, vector search, allowing for similarity-based queries within the graph, and advanced algorithms for community detection and centrality analysis. These tools empower developers to build AI systems that not only generate coherent text but also provide insights deeply rooted in the underlying data structures. This synergy between LLMs and graph databases through GraphRAG represents a significant advancement in creating AI applications that are both intelligent and reliable.

How to Use GraphChat?

Setup in Memgraph Lab

Getting started with GraphChat is pretty straightforward. Here’s what you need:

  • Memgraph running with MAGE (Memgraph’s graph algorithm library).
  • OpenAI API key or your preferred LLM provider (Azure OpenAI or Ollama).
  • A populated database with structured data.

To set things up, just run the installation script. It takes care of starting both Memgraph (with MAGE) and Memgraph Lab in Docker:

For Linux/macOS:

curl https://install.memgraph.com | sh

For Windows:

iwr https://windows.memgraph.com | iex

This will spin up two containers—one for Memgraph with MAGE and another for Memgraph Lab—so you can start querying right away.

GraphChat in Memgraph Lab UI

Read more details on GraphChat docs.

Example Query: Explore the Deaths in Game of Thrones

Imagine you're a fan of the Game of Thrones series and want to explore the brutal world of Westeros using Memgraph. With the GoT Deaths dataset, you can run Cypher queries to uncover interesting insights, like which character is the most treasonous or who is the ultimate winner of the game.

Let’s say you want to find out which character is the "killer influencer"—the one who acts as a key intermediary in the deaths of others. With GraphChat, you could ask a natural language question like, “Who is the most influential killer in Game of Thrones?”

GraphChat would translate this into a Cypher query behind the scenes, like this:

MATCH (c:Character)-[r:KILLED]->(v:Victim)
WITH c, COUNT(r) AS kills
ORDER BY kills DESC
RETURN c.name AS KillerInfluencer, kills
LIMIT 1;

The result will show the most “influential” killer in the world of Westeros based on death connections.

If you're interested in trying more queries and exploring this dataset, check out Memgraph's GoT Deaths Collection. You can analyze suicides, treasonous characters, and even plot the shortest path of killings with the highest victim count.

The Tech Stack Behind It

GraphChat runs without relying on external frameworks to keep things lightweight and fast. It directly handles translating natural language into Cypher, using your database schema to provide the necessary context and optimize query generation—no extra layers or overhead involved.

It’s worth noting that GraphChat isn’t just a gimmick—it’s functional. It supports connection to various LLM providers, including OpenAI, Azure OpenAI, and Ollama. This flexibility means you can choose the model that best fits your needs, whether it’s faster processing, enhanced privacy, or domain-specific knowledge.

GraphChat’s Role in GraphRAG

GraphChat is one way to interact with your GraphRAG setup. It’s like the practical, hands-on tool for querying data that’s backed by your knowledge graph. While GraphRAG helps with broader context (understanding relationships, connections, and communities within your data), GraphChat allows you to drill down and ask specific, functional questions that deliver precise answers.

Diagram showing the comparison between graphrag and GraphChat in Memgraph Lab

Example use cases:

  • A recommendation system built with GraphRAG could pull suggestions for your next holiday destination, while GraphChat answers specific questions about the cost or travel time.
  • A customer service chatbot enhanced by GraphRAG could answer general questions, while GraphChat handles more detailed inquiries like "How many interactions has this customer had with support?"

By combining LLMs and graph databases, enterprises can deploy more accurate AI models for decision intelligence, knowledge discovery, and search—without relying solely on out-of-the-box LLMs, which often miss domain-specific knowledge.

Why Enterprises Need GraphChat

Enterprises are increasingly moving toward customized AI solutions. Why? Because relying on out-of-the-box models doesn’t cut it when you need domain-specific knowledge and accurate responses.

GraphChat is essential because:

  • Privacy concerns. Enterprises often handle proprietary data that can’t be fed into public models. With GraphChat and Memgraph, you can query and interact with your own data in-house.
  • Accuracy. Out-of-the-box models tend to hallucinate. By grounding responses in your graph data, GraphChat ensures that the answers are accurate and contextually relevant.
  • Custom queries. Unlike generic LLM-based chatbots, GraphChat integrates directly with your graph data, so it’s always equipped with the context to handle complex, domain-specific queries.

Conclusion

GraphChat is much more than a natural language interface. It’s a key part of the larger GraphRAG and GenAI ecosystem, helping enterprises and teams easily query, manage, and leverage their graph data for insights—without needing deep technical expertise in Cypher or graph databases.

So, if you’ve ever felt lost in the world of graph queries, give GraphChat a try. Whether you’re a data scientist or a business leader, you can ask your graph database questions, and get precise answers in plain English.

Further Reading

Join us on Discord!
Find other developers performing graph analytics in real time with Memgraph.
© 2025 Memgraph Ltd. All rights reserved.