Case Study · Multi-tenant RAG system
Verba
Chat with your own documents, with answers grounded in the source
Verba lets you upload your own documents and ask questions about them in plain language. It reads and indexes your files, then answers only from what they actually say, streaming the response as it writes and citing the exact passages it used. If the answer is not in your documents, it says so instead of guessing. It is multi-tenant and self-hostable, so each person only ever sees their own files, and you can run the whole thing on your own infrastructure.
The problem
A general chatbot is confidently wrong about your own documents. It has never read your contract, your policy manual, or your research notes, so when you ask about them it either guesses from general knowledge or invents an answer that sounds right. For anything you actually need to rely on, that is worse than no answer at all.
What you want instead is an assistant that reads your files, answers only from what they say, shows you where each answer came from, and admits when the answer simply is not there.
How it works
When you upload a file, Verba parses it, splits it into passages, and turns each passage into a vector (a numeric fingerprint of its meaning) stored in a search index. This happens on a background worker, so a large upload never freezes the app while it processes.
When you ask a question, Verba finds the passages most relevant to it, hands only those passages to the language model, and instructs the model to answer strictly from them and to cite each one it uses. Your original files stay the source of truth in the database; the search index is just a fast, rebuildable copy.
Getting retrieval right
The quality of a RAG answer is decided almost entirely by which passages it retrieves, so most of the work went there. Verba runs two searches for every question and merges them: a meaning-based vector search that catches paraphrased ideas, and a keyword search that nails exact terms like a product code or a clause number. Merging them (with a technique called reciprocal rank fusion) means a passage that ranks well in either search rises to the top, so neither fuzzy nor exact questions fall through.
Two more steps sharpen the results. Follow-up questions like "summarise that" are first rewritten into a standalone question using the recent conversation, so the search has something meaningful to match. And the top passages are re-ranked to remove near-duplicates, so the answer draws on several distinct parts of your documents rather than three copies of the same paragraph.
Grounding and trust
The model is given strict instructions: use only the supplied passages, never outside knowledge, cite each source actually used, and refuse anything the passages do not cover. A relevance threshold backs this up, so an off-topic question returns an honest "I couldn't find that in your documents" rather than a plausible-sounding guess.
Because every claim is tied to a cited passage you can open and read, you are never asked to simply trust the model. To keep the retrieval honest as the system changes, there is an evaluation harness that scores retrieval quality (how often the right document is found, how high it ranks, and how varied the results are) across the plain, re-ranked, and hybrid strategies.
Engineering
The backend is FastAPI in a strict route -> service -> crud -> model layering, with Postgres as the source of truth and Qdrant as the vector index. Document ingestion runs asynchronously on a Celery worker backed by Redis, raw files live in S3-compatible object storage, and Google Gemini provides both the embeddings and the generation. Answers stream to the browser over Server-Sent Events.
Multi-tenancy is enforced on every query so no user can ever reach another's files, with a dedicated isolation test guarding it. The frontend is a React and TypeScript single-page app, the whole stack runs locally with one Docker Compose command, and CI runs linting and tests on every change.
How it fits together
Ask a question
A follow-up is first rewritten into a standalone question, then answered only from the passages retrieved below.
Grounding check constrains the model to the retrieved passages and refuses when the answer is not in your documents.
Stack