Skip to content
Sudhanshu Shukla edited this page Nov 14, 2026 · 5 revisions

Multi-Tenant RAG Service — Project Wiki

Python 3.12 · FastAPI · Sentence Transformers · Qdrant · Semantic Cache · Local-first demo

This wiki documents the actual implementation in the accompanying GitHub repository: a tenant-filtered retrieval service with extractive answering. It is a RAG-oriented demonstration; it includes calls to a generative LLM or a no-LLM RAG application.

Project at a glance

Capability Implementation
Input RAGRequest or FastAPI POST /v1/query
Authentication Per-tenant bearer keys in environment variables (API mode)
Preprocessing Prompt-injection regex checks, then regex-based PII redaction
Embeddings BAAI/bge-small-en-v1.5, normalized vectors
Retrieval Qdrant cosine similarity, tenant_id payload filter
Semantic cache In-process; tenant, session, and top_k scoped; 1-hour TTL
Output KB passage excerpts, source IDs, cache flag, latency, request ID
Observability In-process counters; optional RAM metrics, admin-only API metrics
Persistence In-memory by default, optional local Qdrant path

Read the design

Quick run

py -3.12 -m venv .venv-rag
.\.venv-rag\Scripts\python.exe -m pip install -r requirements_rag_2026.txt
.\.venv-rag\Scripts\python.exe .\RAG_Service_Corrected_2026_Diagnostics.py --doctor
.\.venv-rag\Scripts\python.exe .\RAG_Service_Corrected_2026_Diagnostics.py --self-test
.\.venv-rag\Scripts\python.exe .\RAG_Service_Corrected_2026_Diagnostics.py --demo

The --demo option loads/downloads the embedding model. The --self-test option avoids model downloads but still requires NumPy.

Scope and provenance

This wiki is derived from the Python source and notebook. The knowledge-base documents are fictional examples, the returned answer is *extractive.

Clone this wiki locally