Spaces:
Paused
Paused
Commit ·
d071a56
1
Parent(s): d05a847
docs: expand Quickstart section with prerequisites, 3 execution options, CLI usage, benchmark scripts, data builders, and Docker setup
Browse files
README.md
CHANGED
|
@@ -259,45 +259,152 @@ Throughput: **`51.7 Queries / second`** across 15 Indic languages ($14.50\text{
|
|
| 259 |
|
| 260 |
---
|
| 261 |
|
| 262 |
-
## 🚀 Quickstart & Local Setup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 263 |
|
| 264 |
-
### 1. Clone & Install
|
| 265 |
```bash
|
|
|
|
| 266 |
git clone https://github.com/Rishikvelagapudi/VECTOR.git
|
| 267 |
cd VECTOR
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 268 |
pip install -r requirements.txt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 269 |
cp .env.example .env
|
| 270 |
```
|
| 271 |
|
| 272 |
-
|
| 273 |
```env
|
|
|
|
| 274 |
SARVAM_API_KEY=your_sarvam_api_key_here
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
```
|
|
|
|
| 279 |
|
| 280 |
-
###
|
|
|
|
| 281 |
```bash
|
| 282 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 283 |
python -m app.benchmark 50
|
| 284 |
|
| 285 |
-
#
|
| 286 |
python benchmark/run_cold_start_bench.py
|
| 287 |
|
| 288 |
-
#
|
| 289 |
python benchmark/run_speed_bench_50.py
|
| 290 |
```
|
| 291 |
|
| 292 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 293 |
```bash
|
| 294 |
-
#
|
| 295 |
-
|
| 296 |
|
| 297 |
-
#
|
| 298 |
-
python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 299 |
```
|
| 300 |
-
Open **[http://localhost:7860](http://localhost:7860)** in your browser.
|
| 301 |
|
| 302 |
---
|
| 303 |
|
|
|
|
| 259 |
|
| 260 |
---
|
| 261 |
|
| 262 |
+
## 🚀 Quickstart & Comprehensive Local Setup
|
| 263 |
+
|
| 264 |
+
### ⚙️ Prerequisites & System Requirements
|
| 265 |
+
- **Python**: `Python 3.10+` (Tested on `3.11` and `3.13`)
|
| 266 |
+
- **System Audio Normalizer**: `ffmpeg` (Required for 16kHz audio preprocessing in STT pipeline)
|
| 267 |
+
- **RAM Allocation**: Minimum `8 GB` (`16 GB` recommended for loading full in-memory 15-language FAISS index)
|
| 268 |
+
- **Hardware Acceleration**: `100% CPU Execution` via ONNX Runtime & FAISS-CPU (Zero GPU required)
|
| 269 |
+
|
| 270 |
+
---
|
| 271 |
+
|
| 272 |
+
### 1. 📦 Installation & Environment Setup
|
| 273 |
|
|
|
|
| 274 |
```bash
|
| 275 |
+
# Clone the repository
|
| 276 |
git clone https://github.com/Rishikvelagapudi/VECTOR.git
|
| 277 |
cd VECTOR
|
| 278 |
+
|
| 279 |
+
# Create and activate virtual environment
|
| 280 |
+
python -m venv venv
|
| 281 |
+
# On Windows PowerShell:
|
| 282 |
+
.\venv\Scripts\Activate.ps1
|
| 283 |
+
# On Linux / macOS:
|
| 284 |
+
source venv/bin/activate
|
| 285 |
+
|
| 286 |
+
# Upgrade pip and install all Python dependencies
|
| 287 |
+
pip install --upgrade pip
|
| 288 |
pip install -r requirements.txt
|
| 289 |
+
```
|
| 290 |
+
|
| 291 |
+
---
|
| 292 |
+
|
| 293 |
+
### 2. 🔑 Environment Configuration (`.env`)
|
| 294 |
+
|
| 295 |
+
Copy the template file `.env.example` to `.env`:
|
| 296 |
+
```bash
|
| 297 |
cp .env.example .env
|
| 298 |
```
|
| 299 |
|
| 300 |
+
Configure your secrets in `.env`:
|
| 301 |
```env
|
| 302 |
+
# Sarvam AI STT API Key (Saaras v3 Speech Recognition)
|
| 303 |
SARVAM_API_KEY=your_sarvam_api_key_here
|
| 304 |
+
|
| 305 |
+
# Primary Generative Provider (Gemini Flash / OpenAI-compatible endpoint)
|
| 306 |
+
GEMINI_API_KEY=your_gemini_api_key_here
|
| 307 |
+
LLM_API_KEY=your_gemini_api_key_here
|
| 308 |
+
LLM_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
|
| 309 |
+
LLM_MODEL=gemini-2.5-flash
|
| 310 |
+
|
| 311 |
+
# Hard Safety Overrides & Offline Flags
|
| 312 |
+
ALLOW_NETWORK_CALLS_IN_PIPELINE=true
|
| 313 |
+
ENABLE_PROMPT_GUARD=true
|
| 314 |
+
ENABLE_QUERY_INTENT_FILTER=true
|
| 315 |
+
|
| 316 |
+
# Embedding & Search Engine Configuration
|
| 317 |
+
EMBEDDING_MODEL_NAME=intfloat/multilingual-e5-small
|
| 318 |
+
|
| 319 |
+
# Local Server Settings
|
| 320 |
+
HOST=0.0.0.0
|
| 321 |
+
PORT=7860
|
| 322 |
+
```
|
| 323 |
+
|
| 324 |
+
> [!TIP]
|
| 325 |
+
> **100% Offline Mode**: Setting `ALLOW_NETWORK_CALLS_IN_PIPELINE=false` forces VECTOR to bypass external LLM API calls and run purely on local CPU ONNX models and deterministic TextRank + SVD energy context synthesis.
|
| 326 |
+
|
| 327 |
+
---
|
| 328 |
+
|
| 329 |
+
### 3. 🖥️ Running Application Interfaces
|
| 330 |
+
|
| 331 |
+
VECTOR provides 3 distinct execution entrypoints tailored for developers, API integrators, and terminal power users:
|
| 332 |
+
|
| 333 |
+
#### Option A: Web Command Center UI (`python app.py`)
|
| 334 |
+
Launches the full retro-tropical Web Audio Command Center UI with live Web Audio frequency canvas and real-time 9-stage telemetry waterfall:
|
| 335 |
+
```bash
|
| 336 |
+
python app.py
|
| 337 |
```
|
| 338 |
+
Open **[http://localhost:7860](http://localhost:7860)** in your browser.
|
| 339 |
|
| 340 |
+
#### Option B: High-Speed FastAPI REST Server (`uvicorn`)
|
| 341 |
+
Runs the production REST API exposing `/query`, `/health`, and `/languages` endpoints:
|
| 342 |
```bash
|
| 343 |
+
uvicorn api.main:app --host 0.0.0.0 --port 7860 --reload
|
| 344 |
+
```
|
| 345 |
+
- Interactive OpenAPI / Swagger Docs: **[http://localhost:7860/docs](http://localhost:7860/docs)**
|
| 346 |
+
- Health Check Status: `GET http://localhost:7860/health`
|
| 347 |
+
- Active Languages Registry: `GET http://localhost:7860/languages`
|
| 348 |
+
|
| 349 |
+
#### Option C: Interactive Terminal CLI (`demo/cli_demo.py`)
|
| 350 |
+
Run instant terminal queries in text, audio, or interactive shell mode:
|
| 351 |
+
```bash
|
| 352 |
+
# 1. Direct text query with language hint:
|
| 353 |
+
python demo/cli_demo.py --text "हृदय के चार कक्ष कौन से हैं?" --lang hi
|
| 354 |
+
|
| 355 |
+
# 2. Audio file query:
|
| 356 |
+
python demo/cli_demo.py --audio sample.wav --lang ta
|
| 357 |
+
|
| 358 |
+
# 3. Interactive Shell Mode:
|
| 359 |
+
python demo/cli_demo.py --interactive
|
| 360 |
+
```
|
| 361 |
+
|
| 362 |
+
---
|
| 363 |
+
|
| 364 |
+
### 4. 🏎️ Running Benchmarks & Verification Suite
|
| 365 |
+
|
| 366 |
+
```bash
|
| 367 |
+
# 1. Run full 50-test unit & integration test suite (50/50 passing):
|
| 368 |
+
pytest tests/ -v
|
| 369 |
+
|
| 370 |
+
# 2. Run 50ms retrieval latency budget check (ONNX Embed + FAISS Traversal):
|
| 371 |
python -m app.benchmark 50
|
| 372 |
|
| 373 |
+
# 3. Run cold-start 15-language SLA benchmark (Cache-bypassed):
|
| 374 |
python benchmark/run_cold_start_bench.py
|
| 375 |
|
| 376 |
+
# 4. Run 750-query high-throughput speed benchmark (51.7 QPS):
|
| 377 |
python benchmark/run_speed_bench_50.py
|
| 378 |
```
|
| 379 |
|
| 380 |
+
---
|
| 381 |
+
|
| 382 |
+
### 5. 🛠️ Data Pipeline & Sample Index Builders
|
| 383 |
+
|
| 384 |
+
Re-build FAISS HNSW indexes or extract MS MARCO multilingual corpora from scratch:
|
| 385 |
```bash
|
| 386 |
+
# Build sample FAISS HNSW indexes locally
|
| 387 |
+
python build_sample_indices.py
|
| 388 |
|
| 389 |
+
# Extract and deduplicate MS MARCO corpora for active languages
|
| 390 |
+
python data/build_corpus.py
|
| 391 |
+
|
| 392 |
+
# Extract and build all 15 language corpora streams
|
| 393 |
+
python data/build_all_15_corpora.py
|
| 394 |
+
```
|
| 395 |
+
|
| 396 |
+
---
|
| 397 |
+
|
| 398 |
+
### 6. 🐳 Docker Containerization & HF Spaces Deployment
|
| 399 |
+
|
| 400 |
+
Build and run VECTOR inside a self-contained Docker container:
|
| 401 |
+
```bash
|
| 402 |
+
# Build Docker image
|
| 403 |
+
docker build -t vector-rag .
|
| 404 |
+
|
| 405 |
+
# Run container locally on port 7860
|
| 406 |
+
docker run -p 7860:7860 --env-file .env vector-rag
|
| 407 |
```
|
|
|
|
| 408 |
|
| 409 |
---
|
| 410 |
|