neo4j-graphrag-python  by neo4j

Python SDK for Neo4j GraphRAG app development

created 1 year ago
685 stars

Top 50.7% on sourcepulse

GitHubView on GitHub
Project Summary

This package provides a Python SDK for building Graph Retrieval Augmented Generation (GraphRAG) applications, leveraging Neo4j's graph database capabilities. It's designed for developers seeking a robust, first-party solution for integrating knowledge graphs with LLMs, offering enhanced retrieval and question-answering functionalities.

How It Works

The library facilitates GraphRAG by enabling the construction and querying of knowledge graphs. It supports building knowledge graphs from text or PDFs using SimpleKGPipeline or the more customizable Pipeline class, which extract entities and relationships. For retrieval, it offers various retrievers, including VectorRetriever for similarity searches against vector indexes stored in Neo4j, and integrates with LLM providers for generation.

Quick Start & Requirements

  • Install: pip install neo4j-graphrag
  • Optional dependencies for LLM providers (e.g., openai, ollama) and vector databases (e.g., weaviate, pinecone) can be installed with extras: pip install "neo4j-graphrag[openai]".
  • Requires Python 3.9-3.12.
  • Neo4j instance and APOC core library (for KG construction) are necessary.
  • OpenAI API key is required for examples using OpenAI models.
  • Documentation: https://neo4j.com/docs/graphrag-for-python/current/

Highlighted Details

  • Supports multiple LLM providers (Ollama, OpenAI, Vertex AI, Cohere, Anthropic, MistralAI).
  • Enables hybrid retrieval by combining vector search with graph traversal.
  • Provides tools for creating and populating vector indexes within Neo4j.
  • Offers Text2CypherRetriever for natural language to Cypher query translation.

Maintenance & Community

  • First-party library from Neo4j, indicating strong support and maintenance.
  • Community support available via Neo4j Online Community and Discord.
  • Contribution requires signing a contributor license agreement.

Licensing & Compatibility

  • The specific license is not explicitly stated in the README, but as a Neo4j product, it is likely to be compatible with commercial use.

Limitations & Caveats

  • Vector index similarity search in Neo4j uses approximate nearest neighbor, which may not yield exact results.
  • End-to-end tests require running Neo4j and Weaviate services via Docker Compose.
Health Check
Last commit

4 days ago

Responsiveness

1 day

Pull Requests (30d)
16
Issues (30d)
15
Star History
166 stars in the last 90 days

Explore Similar Projects

Feedback? Help us improve.