haham7/nbc-chatbot
0
NBC 2016 RAG Chatbot
AI-powered chatbot for the National Building Code of India 2016 (NBC 2016). Built with LangGraph, Qdrant, and Neo4j.
Features
- Hybrid Search: Dense + sparse vector search via Qdrant
- Multi-turn Conversation: LangGraph with 10-turn memory
- Guardrails: Off-topic detection for NBC-related queries
- Clause Citation: References NBC clauses in answers
- Graph Traversal: Neo4j for cross-reference expansion
Architecture
User → API → LangGraph Agent → Qdrant (vectors) + Neo4j (graph) → LLM → ResponseQuick Start (Local)
# Install dependencies
pip install -r requirements.txt
# Start services
docker compose up -d
# API at http://localhost:8000
# UI at http://localhost:8501Cloud Deployment
Option 1: Render (Recommended)
- Create accounts:
- Render.com - Web service
- Qdrant Cloud - Vector DB (free tier)
- Neo4j Aura - Graph DB (free tier)
- Get credentials:
- Qdrant: API key + URL (e.g.,
https://xyz.qdrant.cloud) - Neo4j: Username + password + bolt URL
- Deploy on Render:
- Connect GitHub repo
- Set environment variables:
OPENAI_API_KEY=sk-...
QDRANT_URL=https://xyz.qdrant.cloud
NEO4J_URI=bolt://xyz.databases.neo4j.io
NEO4J_USER=neo4j
NEO4J_PASSWORD=your_password
CHAT_MODEL=gpt-4o- Build:
pip install -r requirements.txt - Start:
python api.py
Option 2: Railway
# Install Railway CLI
npm i -g @railway/cli
railway login
railway init
railway upAdd environment variables in Railway dashboard.
Option 3: Hugging Face (UI only)
- Push to GitHub
- Go to https://huggingface.co/spaces
- Create Space → Streamlit
- Point to your API URL (or deploy API separately)
Environment Variables
OPENAI_API_KEY=sk-... # Required for LLM
QDRANT_URL=... # Qdrant Cloud URL
NEO4J_URI=... # Neo4j Aura bolt URL
NEO4J_USER=neo4j
NEO4J_PASSWORD=...
CHAT_MODEL=gpt-4o # Default: gpt-4oAPI Endpoints
Project Structure
chat_architect/
├── api.py # FastAPI application
├── ui.py # Streamlit UI
├── Dockerfile # API container
├── Dockerfile.ui # UI container
├── docker-compose.yml
├── render.yaml # Render config
├── scripts/
│ ├── ingest.py
│ ├── retrieval_pipeline.py
│ └── chat_agent.py
└── requirements.txtLicense
MIT License
