File size: 1,511 Bytes
bfc6f8c
 
 
 
 
 
08d6aa3
bfc6f8c
 
 
e92d49a
 
 
 
 
 
 
 
 
bfc6f8c
 
 
 
 
e92d49a
 
 
 
 
 
 
 
 
 
 
 
 
bfc6f8c
 
e92d49a
 
 
 
 
bfc6f8c
e92d49a
 
 
bfc6f8c
e92d49a
 
 
 
 
 
bfc6f8c
e92d49a
 
 
 
 
bfc6f8c
e92d49a
bfc6f8c
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
---
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`.