neo4j/neo4j-graphrag-python

Neo4j GraphRAG for Python

What it solves

This package provides a streamlined way for developers to build Graph Retrieval Augmented Generation (GraphRAG) applications. It simplifies the process of creating knowledge graphs from unstructured text and using those graphs to provide more accurate, context-aware answers to LLM queries.

How it works

The library integrates Neo4j with various LLM providers (such as OpenAI, Anthropic, and Google) and embedding models. It operates through three primary workflows:

  1. Knowledge Graph Construction: Using the Pipeline or SimpleKGPipeline classes, it extracts entities and relationships from text or PDFs to build a structured knowledge graph in Neo4j.
  2. Indexing: It provides tools to create and populate vector indexes within Neo4j to enable semantic search.
  3. Retrieval and Generation: It uses specialized retrievers (like VectorRetriever) to fetch relevant graph data and passes it to an LLM via the GraphRAG class to generate a final response.

Who it’s for

Python developers building AI applications that require structured knowledge retrieval, complex relationship mapping, and hybrid search capabilities using Neo4j.

Highlights

  • First-party support: Official library maintained by Neo4j for long-term stability.
  • Flexible LLM Integration: Supports a wide array of providers including Ollama, OpenAI, Vertex AI, Gemini, Cohere, Anthropic, MistralAI, and Amazon Bedrock.
  • Hybrid Retrieval: Supports combining vector search with graph traversal and Text2Cypher retrieval.
  • External Vector Store Support: Ability to use external vector databases like Weaviate, Pinecone, and Qdrant.

Related

  • Project
  • Project
  • Project
  • Project
  • Project