Build a RAG App with FastAPI — MiniLM Embeddings, a Chroma Store, and a Refusal That Works, Step by Step
Ask a language model about your documents — your shop's prices, your team's manual — and it will still answer. Confidently, and wrong: it is guessing from its training, not reading your page. RAG — retrieval-augmented generation — is the fix: keep your documents in a searchable store, fetch the few chunks that match the question, and let the model answer from those chunks only. An answer built that way is called grounded . In this post we build the whole thing with FastAPI: a small shop catalogue goes in, grounded answers come out — including the two moments most demos skip: the app refusing when the answer is not in the documents, and the app going stale when a document changes. Every output below is from the real run. The map — everything follows it, in two rows. Index time (runs when documents change): documents → chunks → embeddings → store. Query time (runs per question): question → retrieve → prompt → model → answer. What you need Python 3.10 or newer....