RAG API with FastAPI and Local Ollama
- When
- August 2026
- Kind
- Side project
Ask questions about your own documents, answered by a model running on your machine. Chunking, embedding, retrieval and generation all run on the host, with no hosted API and no per-token cost.
Problem
Asking questions about private documents means pasting them into a hosted chat tool, which sends them to someone else's server. Small local models fix that but cannot take a whole document, so something has to decide which passages they see.
Highlights
- Runs Ollama models on a laptop and customizes one with a Modelfile into a friendly coding tutor.
- Documents are split into overlapping chunks, embedded locally with nomic-embed-text and stored in ChromaDB.
- Retrieval is filtered by owner, so one person's chunks never leak into another's answer.
- Answers stream back as newline-delimited JSON, so cited chunks appear before the first token.
- Upload and ask endpoints with tests in pytest, a Swagger UI, and a small browser UI.
Locally hosted modelsNo document or question reaches a hosted API.
Stack
Architecture
Screens



