This is a Python-based application that combines the strengths of knowledge graphs and vector databases to enhance Retrieval-Augmented Generation (RAG) systems. By leveraging Neo4j for graph storage and OpenAI's language models, GraphRAG provides structured, context-rich responses to complex queries.
- Graph-Enhanced Retrieval:Utilizes Neo4j to store and query knowledge graphs, capturing intricate relationships between data entities
- Vector Similarity Search:Integrates vector databases for efficient similarity-based retrieval
- OpenAI Integration:Employs OpenAI's language models for generating coherent and context-aware responses
- Modular Architecture:Designed with modularity in mind, allowing easy customization and extension
- Python 3.9
- Docker & Docker Compose
- pyenv & pyenv-virtualenv
- OpenAI API Ky
git clone https://github.com/kgovind0001/GraphRAG-SupplyChain.git
cd GraphRAG-SupplyChainCreate a .env file in the root directory and add your OpenAI API key:
OPENAI_API_KEY=your_openai_api_key_here
NEO4J_URI="neo4j://localhost:7687"
NEO4J_USERNAME = "neo4j"
NEO4J_PASSWORD = "password"Use pyenv and pyenv-virtualenv to create and activate a Python 3.9.0 environment:
pyenv install 3.9.0
pyenv virtualenv 3.9.0 graphrag-env
pyenv activate graphrag-envInstall the required Python package:
pip install -r requirements.txtEnsure Docker and Docker Compose are installed, then start the Neo4j server:
docker-compose up -dThis will set up a Neo4j instance with the necessary plugins for vectorized storage and OpenAI integration.
Start the GraphRAG applicatio:
streamlit run app.pyGraphRAG-SupplyChain/
├── sample_data/ # Input data files
├── src/ # Source code
├── __init__.py
├── models # Pydantic models
│ ├── __init__.py
│ ├── models.py
├── supply_chain_assistant.py # Core RAG pipeline implementation
└── tools # Functions for graph operations
├── __init__.py
├── supply_count.py
└── supply_list.py
├── .env # Environment variables
├── requirements.txt # Python dependencies
├── app.py # Streamlit application
└── docker-compose.yml # Docker Compose configuration
After running the application, you can test its functionality by:
- Adding sample data to the
sample_data/directory. - Ensuring the data is ingested and processed correctly.
- Submitting queries and verifying the responses are accurate and contextually relevent.
Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
Developed by Kishan Govind. Huge Thanks to medium post for the motivation.
Feel free to customize this README further to match your project's specific details and requirements.
