Welcome to Introduction to GraphRAG
Welcome to the hands-on Introduction to GraphRAG Workshop, where you will learn:
-
How to use GraphRAG to improve the quality of LLM-generated content
-
How to build a knowledge graph from unstructured data
-
How to combine vector search with knowledge graphs to improve the quality of LLM-generated content
-
How to use retrievers to read data from the knowledge graph
-
How to convert natural language questions into database queries using an LLM
Get started
The repository, neo4j-graphacademy/workshop-graphrag-introduction, has been created for this course. It contains any starter code and resources you need.
You can use a GitHub codespace as an online IDE and workspace for this course. It will automatically clone the course repository and set up your environment.
GitHub Codespaces
You will need to login with a GitHub account. The GitHub Codespaces free monthly usage will cover the duration of this course.
Develop on your local machine
To follow along locally, you will need:
-
The ability to install packages using
pip
.
You may want to set up a virtual environment using venv
or virtualenv
to keep your dependencies separate from other projects.
Clone the repository
Clone the github.com/neo4j-graphacademy/workshop-graphrag-introduction repository:
git clone https://github.com/neo4j-graphacademy/workshop-graphrag-introduction
Install the required packages using pip
and download the required data:
cd workshop-graphrag-introduction
pip install -r requirements.txt
You do not need to create a Neo4j database as you will use the provided instance.
The instance uses Neo4j’s GenAI functions, you can find out more about how to configure them in the Neo4j GenAI integration documentation.
Configure the environment
Today we will need an API key to use OpenAI’s LLMs and embedding models.
You can use the OPENAI_API_KEY
provided, or use your own API key generated from platform.openai.com.
We have created a Neo4j instance for you to use during this workshop.
Create a file called .env
and copy the following code into it.
OPENAI_API_KEY=sk-...
NEO4J_URI=bolt://{instance-ip}:{instance-boltPort}
NEO4J_USERNAME={instance-username}
NEO4J_PASSWORD={instance-password}
Test your setup
You can test your setup by running workshop-graphrag-introduction/test_environment.py
- this will attempt to connect to the Neo4j sandbox and the OpenAI API.
python workshop-graphrag-introduction/test_environment.py
You will see an OK
message if you have set up your environment correctly. If any tests fail, check the contents of the .env
file.
Keep your codespace running
To avoid creating a new environment for each challenge, you can keep your environment running for the duration of the workshop.
The environment will automatically pause after a period of inactivity.
Are you ready?
When you are ready, you can move on to the next lesson.
Lesson Summary
You have setup your development environment and are ready for hands-on practice.
In the next lesson, you will learn the fundamentals of GraphRAG.