A high-performance Retrieval-Augmented Generation (RAG) chatbot designed for processing enterprise documents with role-based access control. Accelerated by NVIDIA GPUs (RTX A5000).
- Multi-Format Ingestion: Supports PDF (text & scanned/OCR), DOCX, XLSX, XLS, CSV, TXT, and PPTX.
- Role-Based Access: Restrict document visibility to specific user roles (e.g., Retail, All Access).
- GPU Acceleration: Utilizes CUDA-enabled embeddings for rapid document indexing and retrieval.
- Admin Dashboard: Comprehensive management interface to monitor ingestion status, manage documents, and view system health.
- Enterprise-Grade Security: Integrated SSL/TLS support with FastAPI and production-ready architecture.
- Hybrid Retrieval: Combines semantic vector search (ChromaDB) with keyword search for pinpoint accuracy.
- Backend: FastAPI (Python)
- Frontend: Vanilla JS, HTML5, CSS3 (Modern Glassmorphic UI)
- Vector Database: ChromaDB
- Embeddings: Sentence-Transformers (BGE-Small/v1.5)
- AI Models: Groq Cloud API for Chat, Local GPU for Embeddings & OCR.
/rag: Core RAG logic, loaders, and configurations./data: Source documents organized by role folders./chroma_db: Persistent vector database (excluded from Git).server.py: Main API server and secure endpoint handling.admin.html: Project administration panel.frontend.html: Chatbot user interface.
- Detailed installation and server setup instructions can be found in SETUP.md.
Internal Use Only - IIFL Samasta
The repository now includes an eval/ package for retrieval-quality measurement, PDF-level ranking, and LLM-as-judge scoring.
eval/logger.py: logs top-k retrievals for each query into the shared SQLite database tableretrieval_logs.eval/metrics.py: pure functions forrecall@k,precision@k, andMRR.eval/pdf_ranker.py: aggregates chunk rankings into PDF rankings with configurable strategies.eval/llm_judge.py: scores faithfulness, groundedness, and relevance with the existing LM Studio client.eval/run_eval.py: CLI entrypoint that runs retrieval metrics, PDF ranking, and judge scoring, then writes JSON and CSV reports.eval/build_dataset.py: scaffolds a labelable dataset from recent retrieval logs.eval/dataset.json: starter dataset file for labeled evaluation queries.
Production chat queries now log their retrieval candidates automatically. Each log record stores:
query_idquery_texttimestampuser_roleklatency_ms- normalized retrieved chunk metadata (
chunk_id,source_pdf,page_number,rank,similarity_score)
Use recent retrieval logs to scaffold examples for manual labeling:
python -m eval.build_dataset --limit 50That writes eval/dataset_from_logs.json. Fill in relevant_chunk_ids and/or relevant_pdfs for each query.
Run the full evaluation pipeline with:
python -m eval.run_evalUseful flags:
--skip-judgeto run only retrieval and PDF ranking metrics.--top-k 5to change how many chunks are used for answer generation during evaluation.--pdf-strategy max_scoreto switch PDF aggregation.--log-retrievalsto also persist eval-run retrievals intoretrieval_logs.
Reports are written to eval/results/ as timestamped JSON and CSV files.