kumardatascience/Multi-Source-RAG-AI-System-with-Query-Routing
1
๐ค AI Chat Assistant

๐ [Live Demo on Hugging Face Spaces โ](https://huggingface.co/spaces/kumardatascience/Multi-Source-RAG-AI-System-with-Query-Routing)
An intelligent AI chatbot that routes queries between direct LLM, document retrieval (RAG), and live web search โ built with LlamaIndex Workflows, Gemini, ChromaDB, Tavily, and Chainlit.
โจ Features
- ๐ฌ ChatGPT-like UI with streaming responses
- ๐ฆ Intelligent query routing (direct / rag / web / multi)
- ๐ Document Q&A with ChromaDB
- ๐ Live web search via Tavily
- ๐ง Conversation memory
- ๐ Transparent reasoning steps
- ๐ณ Dockerized
- โ CI tested via GitHub Actions
๐ Quick Start
Prerequisites: Python 3.12+, Gemini API key, Tavily API key
# Clone and set up
git clone https://github.com/kumardatascience/ai-chat-assistant-themis.git
cd ai-chat-assistant-themis
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Add your API keys
cp .env.example .env
# Edit .env and fill in GOOGLE_API_KEY and TAVILY_API_KEY
# (Optional) Add documents to data/documents/ then index them
python3 src/app/rag.py
# Run
cd src/app
chainlit run main.py -wOpen http://localhost:8000.
๐ณ Docker
docker build -t ai-chat-assistant .
docker run --rm -p 8000:8000 --env-file .env ai-chat-assistant๐งช Tests
pytest -v๐ Project Structure
src/app/
โโโ main.py # Chainlit entry point
โโโ llm.py # Gemini wrapper
โโโ rag.py # Document indexing + retrieval
โโโ web_search.py # Tavily search
โโโ router.py # LlamaIndex Workflow router
data/documents/ # Your PDFs/text files
tests/ # Pytest tests
Dockerfile
.github/workflows/ci.yml๐ ๏ธ Tech Stack
Chainlit ยท Google Gemini ยท LlamaIndex Workflows ยท ChromaDB ยท Tavily ยท HuggingFace embeddings (BAAI/bge-small-en-v1.5) ยท pytest ยท Docker ยท GitHub Actions
๐ License
MIT
