During this course, you will:
-
Use the Neo4j link:https://neo4j.com/docs/neo4j-graphrag-python/current/[GraphRAG for Python ()
neo4j_graphrag) package to create a knowledge graph from unstructured and structured data -
Create vector and text to Cypher retrievers that use the knowledge graph to provide context to an LLM
You must set up a development environment to run the code examples and exercises.
Get started
The repository, neo4j-graphacademy/genai-graphrag-python, 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
You will need Python installed and 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 github.com/neo4j-graphacademy/genai-graphrag-python repository:
git clone https://github.com/neo4j-graphacademy/genai-graphrag-pythonInstall the required packages using pip:
cd genai-graphrag-python
pip install -r requirements.txtYou do not need to create a Neo4j database as you will use the provided sandbox instance.
The sandbox uses Neo4j’s GenAI functions, you can find out more about how to configure them in the Neo4j GenAI integration documentation.
Setup the environment
Create a copy of the .env.example file and name it .env.
Fill in the required values.
# Create a copy of this file and name it .env
OPENAI_API_KEY="sk-..."
NEO4J_URI="{instance-scheme}://{instance-ip}:{instance-boltPort}"
NEO4J_USERNAME="{instance-username}"
NEO4J_PASSWORD="{instance-password}"
NEO4J_DATABASE="{instance-database}"Add your Open AI API key (OPENAI_API_KEY), which you can get from platform.openai.com.
Test your setup
You can test your setup by running genai-graphrag-python/test_environment.py - this will attempt to connect to the Neo4j sandbox and the OpenAI API.
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.
Continue
When you are ready, you can move on to the next task.
Lesson Summary
In this lesson, you setup your development environment to build a knowledge graph.
In the next module, you will create a knowledge graph from unstructured and structured data using an LLM.