kumardatascience/Multi-Source-RAG-AI-System-with-Query-Routing
1
1---2title: Multi-Source RAG AI Assistant3emoji: ๐ค4colorFrom: blue5colorTo: indigo6sdk: docker7app_port: 80008pinned: false9---10 11 12# ๐ค AI Chat Assistant13 14[](https://github.com/kumardatascience/ai-chat-assistant-themis/actions/workflows/ci.yml)15 16๐ **[Live Demo on Hugging Face Spaces โ](https://huggingface.co/spaces/kumardatascience/Multi-Source-RAG-AI-System-with-Query-Routing)**17 18An 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**.19 20## โจ Features21 22- ๐ฌ ChatGPT-like UI with streaming responses23- ๐ฆ Intelligent query routing (direct / rag / web / multi)24- ๐ Document Q&A with ChromaDB25- ๐ Live web search via Tavily26- ๐ง Conversation memory27- ๐ Transparent reasoning steps28- ๐ณ Dockerized29- โ
CI tested via GitHub Actions30 31## ๐ Quick Start32 33**Prerequisites:** Python 3.12+, [Gemini API key](https://aistudio.google.com/apikey), [Tavily API key](https://tavily.com)34 35```bash36# Clone and set up37git clone https://github.com/kumardatascience/ai-chat-assistant-themis.git38cd ai-chat-assistant-themis39python3 -m venv .venv40source .venv/bin/activate41pip install -r requirements.txt42 43# Add your API keys44cp .env.example .env45# Edit .env and fill in GOOGLE_API_KEY and TAVILY_API_KEY46 47# (Optional) Add documents to data/documents/ then index them48python3 src/app/rag.py49 50# Run51cd src/app52chainlit run main.py -w53```54 55Open [http://localhost:8000](http://localhost:8000).56 57## ๐ณ Docker58 59```bash60docker build -t ai-chat-assistant .61docker run --rm -p 8000:8000 --env-file .env ai-chat-assistant62```63 64## ๐งช Tests65 66```bash67pytest -v68```69 70## ๐ Project Structure71 72```73src/app/74โโโ main.py # Chainlit entry point75โโโ llm.py # Gemini wrapper76โโโ rag.py # Document indexing + retrieval77โโโ web_search.py # Tavily search78โโโ router.py # LlamaIndex Workflow router79data/documents/ # Your PDFs/text files80tests/ # Pytest tests81Dockerfile82.github/workflows/ci.yml83```84 85## ๐ ๏ธ Tech Stack86 87Chainlit ยท Google Gemini ยท LlamaIndex Workflows ยท ChromaDB ยท Tavily ยท HuggingFace embeddings (BAAI/bge-small-en-v1.5) ยท pytest ยท Docker ยท GitHub Actions88 89## ๐ License90 91MIT92 