Unleashing the Power of NLP with LlamaIndex and Neo4j

Source: DALL-E 3

Unlocking the true potential of natural language processing (NLP) has never been easier. We’re thrilled to introduce a game-changing starter kit that seamlessly combines the power of the LlamaIndex library with the robustness of the Neo4j graph database. This dynamic duo empowers you to store, index, and query documents with unparalleled efficiency and flexibility.

Imagine creating conversational AI assistants, document retrieval systems, and other NLP applications that can easily understand and process natural language queries. That’s exactly what this starter kit enables you to do. With LlamaIndex’s efficient indexing and querying capabilities and Neo4j’s expertise in handling complex relationships, you can build NLP applications that store and retrieve information from documents with lightning-fast performance.

Whether you’re a seasoned developer or just starting out, this combination of LlamaIndex and Neo4j will provide you with the tools you need to create your NLP applications.

The Starter Kit

The LlamaIndex Neo4j Integration Starter Kit is a comprehensive repository that provides everything you need to use LlamaIndex and Neo4j for your NLP projects. This kit includes a Python notebook and a FastAPI application demonstrating how to integrate these technologies and unlock their potential seamlessly.

Key features:

  • Document Storage and Indexing — The kit showcases how to store documents in a Neo4j graph database, allowing you to organize and manage your textual data efficiently. Using LlamaIndex’s indexing capabilities, you can create a KnowledgeGraphIndex from the retrieved documents and store it in the Neo4j database with embeddings.
  • Querying and Retrieval — With the starter kit, you’ll learn how to query the KnowledgeGraphIndex using a query engine, enabling you to extract relevant information from your indexed documents. Additionally, you can create a GPTVectorStoreIndex from the documents and perform queries on it, showcasing the flexibility and power of LlamaIndex.
  • Graph Database Querying — The starter kit demonstrates how to directly query the Neo4j database using Cypher queries with the help of the Neo4jQueryToolSpec and OpenAI Agent classes. This allows you to use the graph structure of your data and perform complex queries to uncover valuable insights.
  • FastAPI Integration — To make your NLP application accessible and interactive, the starter kit includes a FastAPI application that provides an API endpoint for sending and receiving chat messages. This enables you to build a conversational interface powered by LlamaIndex and Neo4j, opening up endless user interaction and engagement possibilities.

Getting Started

Get started with the LlamaIndex Neo4j Integration Starter Kit by following these steps:

1. Clone the repository:

git clone https://github.com/your-username/llama-index-neo4j-starter-kit.git
cd llama-index-neo4j-starter-kit

2. Install the required dependencies using Poetry or pip:

# Using Poetry
poetry install

# Using pip
pip install -r requirements.txt

3. Update your Neo4j credentials in the credentials.json file in the project directory. If you have an existing Neo4j DB you would like to use, input your current credentials and OpenAI API key. For a sample dataset, use the following Neo4j credentials for read-only access to a hosted sample dataset (SEC Data). Your own OpenAI API key will be needed to run this server:


NOTE: The NEO4J_URI value can use the Neo4j or bolt URI scheme. For more details on which to use, see this example.

4. Explore the Jupyter Notebook (starter_kit_notebook.ipynb) to learn how to use LlamaIndex and Neo4j for document storage, indexing, and querying.

5. Run the FastAPI application to interact with the conversational interface:

poetry run uvicorn llamaindex_starter_kit.main:app --reload
The FastAPI application will be available at

With these steps, you’ll be ready to dive into the world of NLP with LlamaIndex and Neo4j.

The LlamaIndex Neo4j Integration Starter Kit is just the beginning of your journey into the world of advanced NLP applications. By harnessing the power of this dynamic duo, you’ll be able to create sophisticated solutions that understand and process natural language with unparalleled efficiency and accuracy.

Get Involved

We invite you to explore the starter kit, experiment with configurations, and contribute to its development. Your ideas, suggestions, and contributions are invaluable in pushing the boundaries of what’s possible with NLP and graph databases. Join our community, share your experiences, and let’s collaborate to create the future of NLP together.

So, what are you waiting for? Clone the repository, dive into the notebook, and embark on your journey to build amazing NLP applications with LlamaIndex and Neo4j today.

For more details and code samples, please refer to the GitHub repository.

Unleashing the Power of NLP with LlamaIndex and Neo4j: A Starter Kit was originally published in Neo4j Developer Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.