Neo4j LLM Graph Builder

In this lesson, you will use the LLM Graph Builder to construct a simple knowledge graph.

LLM Graph Builder

The Neo4j LLM Graph Builder is a tool for turning unstructured data into a knowledge graph. It automates the same process described in the previous lesson and builds graphs from text.

A screenshot of the LLM Graph Builder

The LLM Graph Builder includes a chat interface to interact with the graph and explore the data. The chatbot can use different Retrieval Augmented Generation (RAG) approaches to answer questions, including GraphRAG, Vector Search, and Text2Cypher.

You can upload text-based documents and import text directly from Wikipedia and YouTube.

The LLM Graph Builder allows you to configure the LLM model, the types of entities and relationships, and a pre-defined schema.

The Neo4j LLM Graph Builder is a Neo4j Labs project is under active development, and features may change.

You can learn more in the Neo4j LLM Graph Builder documentation.

Create a Knowledge Graph

You will use the LLM Graph Builder to create a knowledge graph of the GraphAcademy course content. You can then ask questions about the course content and explore the relationships between the different topics.

To complete this task, you will need to:

  1. Connect the LLM Graph Builder to a Neo4j database

  2. Upload the course content

  3. Generate the knowledge graph

Connect to Neo4j

When you open the Neo4j LLM Graph Builder, you will be prompted to Connect to Neo4j. The LLM Graph Builder will create your knowledge graph in this database.

A screenshot of the LLM Graph Builder connection screen
Open Knowledge Graph Builder →

You can use the Neo4j Sandbox that was created for you when you enrolled in the course:

Protocol

bolt

URI

{instance-ip}:{instance-boltPort}

Database

neo4j

Username

{instance-username}

Password

{instance-password}

Ensure you have the correct connection details and connect.

Upload the course content

You will use the lessons from the Neo4j & Generative AI Fundamentals course. We have converted the lessons into PDF documents so you can upload them.

Download the PDF file for lesson 1 - What is Generative AI.

Use Upload files to upload the PDF file to the LLM Graph Builder.

the LLM Graph Builder upload screen

The file will uploaded and added to the list of documents.

The uploaded document in the documents list

You can upload multiple documents to the LLM Graph Builder to be processed together. When creating a knowledge graph, uploading a single document to test the process is often helpful.

Once you have uploaded the document, you can create the knowledge graph using the Generate Graph button.

The generate graph button highlighted

When generating the graph, the LLM Graph Builder runs the steps described in the previous lesson. The application chunks the data, creates vectors, extracts the nodes and relationships, and creates the graph.

The file status shows 'processing'

Once the document has completed processing, the knowledge graph will be available for exploration.

The files status shows 'completed'

Preview

You can preview the graph for a single document by selecting the document and clicking the Preview Graph button.

The file is selected and Preview Graph button highlighted

The preview shows the nodes and relationships extracted from the document.

A preview of the knowledge graph showing the graph data model with the document and associated entity nodes and relationships

Query the Knowledge Graph

You can use the built-in chatbot to ask questions about the document’s content.

The PDF file for lesson 1 contains information about Generative AI, try asking _.

Asking the chatbot about Knowledge Graphs and getting a response

The chatbot will use the knowledge graph to find the answer.

You can see the context used to answer the question in the Details.

The retrieval information for the chatbot response

The retrieval information shows the sources, chunks, entities and evaluation used to answer the question.

Review the lesson content, experiment by asking other questions, review the response, and explore the retrieval information.

When you are ready, move on to the next lesson.

Summary

In this lesson, you learned how to create a knowledge graph using the Neo4j LLM Graph Builder.

In the next lesson, you will explore and customize the schema.

Chatbot

How can I help you today?