GraphRAG Medical Chatbot is a Retrieval-Augmented Generation (RAG) system designed to answer complex biological questions related to the BSG gene, associated diseases, proteins, and molecular interactions.
Unlike traditional RAG pipelines that rely exclusively on vector similarity search, this project leverages a Knowledge Graph (Neo4j) to retrieve structured biomedical relationships through dynamically generated Cypher queries.
The system combines:
- 🧠 Large Language Models (Google Gemini)
- 🗄 Graph database reasoning (Neo4j)
- 🔎 Optional hybrid fallback search
- 💬 Conversational memory via LangChain
- 🌐 Interactive UI built with Streamlit
This architecture enables precise, explainable, and relationship-aware answers to biomedical queries.
- Converts natural language questions into Cypher queries
- Retrieves structured biomedical data from Neo4j
- Grounds responses in graph data to reduce hallucinations
- Uses Google Gemini (2.x Flash / Pro models) via
langchain-google-genai - Synthesizes structured graph results into human-readable explanations
- Deterministic Cypher generation (temperature = 0)
- Maintains chat history across interactions
- Supports contextual follow-up questions
- Built with Streamlit
- Clean chat-based UI
- Sidebar with example biomedical queries
| Component | Technology |
|---|---|
| Language | Python 3.10+ |
| LLM | Google Gemini (via langchain-google-genai) |
| Graph DB | Neo4j |
| Orchestration | LangChain Core + Community |
| Frontend | Streamlit |
| Environment | python-dotenv |
git clone https://github.com/Ciccio1307/GraphRAG.git
cd GraphRAGpython3 -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt
Copy the example file and fill in your credentials:
cp .env.example .envThen open .env and replace the placeholder values with your real credentials:
| Variable | Where to get it |
|---|---|
GOOGLE_API_KEY / GEMINI_API_KEY |
Google AI Studio |
NEO4J_URI / NEO4J_USER / NEO4J_PASSWORD |
Your local Neo4j instance or AuraDB |
GRAPHRAG_*_MODEL |
Leave as-is or swap for another Gemini model |
Never commit your
.envfile. It is listed in.gitignoreand should stay local only.
Option A — Quick Start (Mac/Linux)
./start_demo.sh
Option B — Manual Start
streamlit run src/main_3.py