A production-ready hybrid RAG (Retrieval-Augmented Generation) system that combines Neo4j graph database and ChromaDB vector store for intelligent document querying. Features a clean Streamlit interface and modular architecture for easy extension.
Latest Updates
- π‘οΈ Enhanced security with required environment variables for database credentials
- ποΈ Implemented robust ChromaDB and Neo4j connectors with comprehensive error handling
- π Added detailed configuration options in
.env.examplewith clear documentation- π§ͺ Improved test coverage and code quality
- Hybrid Storage: Combines graph (Neo4j) and vector (ChromaDB) databases for optimal retrieval
- Document Processing: Supports PDF, DOCX, TXT, Markdown, and CSV files
- Intelligent Routing: Pattern-based and LLM-based query routing
- Entity Extraction: Multiple extraction methods (spaCy, LLM-based)
- Graph Enhancement: Entity coalescing, relation repair, and community detection
- Modular Architecture: Clean separation of concerns for easy maintenance
- Production Ready: Comprehensive configuration, logging, and error handling
- Python 3.9 or higher
- Neo4j (local installation or Docker) with the Graph Data Science (GDS) plugin
- Ollama (for local LLM inference)
git clone https://github.com/your-username/ragsistant.git
cd ragsistantpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activatepip install -r requirements.txtpython -m spacy download en_core_web_sm# Copy and edit the environment variables
cp .env.example .env
# Important: Set your Neo4j password in the .env file
# NEO4J_PASSWORD is required and has no default for security# Install Python dependencies
pip install -r requirements.txt
# Install development dependencies (optional)
pip install -e ".[dev]"IMPORTANT: RAGsistant requires the Neo4j Graph Data Science (GDS) module. Make sure your Neo4j instance has GDS installed and enabled.
# Using Docker (with GDS)
docker run --name neo4j-gds \
--publish 7474:7474 \
--publish 7687:7687 \
--env NEO4J_AUTH=neo4j/test1234 \
--env NEO4J_PLUGINS='["graph-data-science"]' \
neo4j:latest- Download Neo4j and the Graph Data Science plugin from the official Neo4j website: https://neo4j.com/download-center/#graph-data-science
- Follow Neo4j's instructions to place the GDS JAR in the plugins directory and enable it in your config.
#### Ollama
```bash
# Install Ollama from https://ollama.ai
ollama pull gemma3:1b
ollama pull mxbai-embed-large
# Verify the models are available
ollama list
Before first use, you'll need to initialize the application with:
# This will set up the necessary database schemas and indexes
python -m app.initstreamlit run app/ui.py- Navigate to the web interface (usually http://localhost:8501)
- Use the file uploader to add documents
- Wait for processing to complete
- Enter questions in the chat interface
- The system will automatically route queries to the best retrieval method
- View transparent results showing sources and reasoning
ragsistant/
βββ README.md # This file
βββ requirements.txt # Python dependencies
βββ setup.py # Package configuration
βββ .env.example # Configuration template
βββ .gitignore # Git ignore rules
βββ prd.txt # Product requirements
βββ app/ # Main application
β βββ __init__.py
β βββ ui.py # Streamlit interface
β βββ config.py # Configuration management
β βββ models.py # Data models
β βββ routing.py # Query routing logic
β βββ embedding.py # Embedding functionality
β βββ vectorstore.py # Vector store operations
β βββ core/ # Core functionality
β β βββ __init__.py
β β βββ ingestion.py # Document ingestion
β β βββ chunking.py # Text chunking
β β βββ serialization.py # Data serialization
β βββ db/ # Database connectors
β β βββ __init__.py
β β βββ connections.py # Database connections
β β βββ chroma.py # ChromaDB operations
β β βββ neo4j.py # Neo4j operations
β βββ entity_extraction/ # Entity extraction
β β βββ __init__.py
β β βββ base.py # Base extractor
β β βββ spacy_extractor.py
β β βββ llm_extractor.py
β βββ graph/ # Graph operations
β β βββ __init__.py
β β βββ ingestion_core.py
β β βββ retrieval.py
β β βββ entity_coalescing.py
β β βββ relation_repair.py
β β βββ community_detection.py
β β βββ gap_filling.py
β βββ utils/ # Utilities
β βββ __init__.py
β βββ status.py # Status tracking
β βββ parallel.py # Parallel processing
βββ tests/ # Test suite
β βββ __init__.py
β βββ test_chunking.py
β βββ test_graph_ingest.py
β βββ test_graph_retrieval.py
β βββ test_routing.py
β βββ test_vectorstore.py
βββ docs/ # Documentation
βββ data/ # Data storage
β βββ documents/ # Source documents
β βββ chunks/ # Processed chunks
βββ storage/ # Database storage
βββ chroma_db/ # ChromaDB files
βββ neo4j_data/ # Neo4j data
The application uses environment variables for configuration. Copy .env.example to .env and customize:
NEO4J_URI: Neo4j connection URINEO4J_USERNAME/PASSWORD: Neo4j credentialsCHROMA_DB_PATH: ChromaDB storage path
OLLAMA_BASE_URL: Ollama server URLOLLAMA_MODEL: Default LLM modelEMBEDDING_MODEL: Embedding model name
DEFAULT_CHUNK_SIZE: Text chunk sizeDEFAULT_CHUNK_OVERLAP: Chunk overlap size
Run the test suite:
pytest tests/Run specific tests:
pytest tests/test_chunking.py -v# Install development dependencies
pip install -e ".[dev]"
# Format code
black app/ tests/
# Lint code
flake8 app/ tests/
# Type checking
mypy app/- Create feature branch
- Add tests in
tests/ - Implement functionality in appropriate module
- Update documentation
- Submit pull request
RAGsistant uses a hybrid approach:
- Document Ingestion: Files are processed, chunked, and stored
- Dual Storage: Text chunks go to ChromaDB, entities/relations to Neo4j
- Query Routing: Intelligent routing based on query type
- Retrieval: Vector similarity and graph traversal
- Response Generation: LLM synthesis with source attribution
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Check the documentation
- Review issues
- Join our discussions