Uniting LLMs with Knowledge Graphs to Create Fact Based Chatbots

An In-Depth End-to-End Tutorial for Structuring Raw Data into Knowledge And Fact Driven LLM Chatbots

Cristian Velasquez
13 min readJan 31, 2024

In this article, the structured, relationship-focused architecture of knowledge graphs is combined with the sophisticated language understanding abilities of LLMs.

Knowledge graphs contribute a layer of structured data, rich in relationships and context, enabling LLMs to navigate and interpret information pools with higher accuracy and less hallucination.

Our objective is to provide readers with a comprehensive, end-to-end guide on developing their knowledge graphs facilitated by the capabilities of LLMs.

We will demonstrate how to 1) transform unstructured text data into a structured and queryable format, 2) Index the data into a knowledge Graph using llama_index and neo4j, 3) Query the database using natural language with Text2Cypher Text2Cypher

Finallly, we will visualize the query results using an interactive Network Graph using Pyvis with a Natural Language response. We will use a complex unstructured Supply Chain data to derive complex entities and relationships.

2. Key Fundamental Concepts

--

--

Cristian Velasquez

Data Science, Tech, Finance | Options Trader | Former Data Science Lead at Deloitte, EY, Capgemini, DHL | linkedin.com/in/cris-velasquez | entreprenerdly.com