| --- |
| title: CSFAQ Project |
| emoji: π» |
| colorFrom: purple |
| colorTo: red |
| sdk: docker |
| app_port: 7860 |
| pinned: false |
| --- |
| |
| # FAQ RAG Chatbot |
|
|
| RAG chatbot for a FAQ knowledge base. Uses FAISS for vector search with dense embeddings and a BM25 hybrid retriever. |
|
|
| ## Requirements |
| - Python 3.11+ (this repo uses 3.13 in the dev environment) |
| - Virtualenv with dependencies in `requirements.txt` |
|
|
| ## Quick setup |
| 1. Activate virtualenv: |
| ```powershell |
| cd C:\Users\gupta\Desktop\faq-ai-chatbot |
| myenv\Scripts\Activate.ps1 |
| ``` |
| 2. Install packages: |
| ```powershell |
| pip install -r requirements.txt |
| ``` |
| 3. Copy `.env` and add keys: |
| ```powershell |
| copy .env.example .env |
| ``` |
|
|
| ## Environment variables (`.env`) |
| - `GOOGLE_GENAI_API_KEY` β API key for the Google GenAI LLM |
| - `HF_TOKEN` β Hugging Face token to avoid unauthenticated download slowdowns |
|
|
| ## Build the vectorstore |
| Run once to compute embeddings and persist the FAISS index: |
|
|
| ```powershell |
| myenv\Scripts\python.exe build_index.py |
| ``` |
|
|
| On first run this can take ~15β25s depending on hardware and network. |
|
|
| ## Run CLI |
| ```powershell |
| myenv\Scripts\python.exe cli.py |
| ``` |
|
|
| ## Run API |
| ```powershell |
| myenv\Scripts\python.exe -m uvicorn app:app --reload |
| ``` |
|
|
| Then POST JSON to `http://127.0.0.1:8000/chat`: |
| ```json |
| { "question": "What is VINS?" } |
| ``` |
|
|
| ## Notes |
| - The first run must compute embeddings if the index does not exist. |
| - To avoid repeated downloads and speed up startup: set `HF_TOKEN` and run `build_index.py` once. |
| - Do not commit `vectorstore/`, `myenv/`, or `.env`. |
|
|