Have a folder full of hundreds of PDFs, notes, and documents. But can never find anything inside them? With local RAG, you can ask those documents questions in a chat. RAG is how an AI answers from your own documents. It feels like asking a librarian who has read them all. And because everything runs on your own laptop, not a single file goes up to the cloud.
Prerequisite: Ollama and Open WebUI are already running on your laptop (Local AI on Linux: Ollama + Open WebUI on a Potato Laptop).
What Is RAG?
RAG (Retrieval-Augmented Generation) is how an AI can answer from your own documents. The flow: when you ask a question, the AI first searches for the relevant document chunks. Then it answers based on those chunks. It does not answer from memory. So the answer is grounded in your documents, complete with citations to the source. A citation is a note that shows where an answer came from.
Figure 1: Local RAG flow — documents, embeddings, then cited answers.
Step 1: Create a Knowledge Base
A Knowledge Base is a collection of documents the AI can answer questions about. In Open WebUI, click Workspace > Knowledge > Create. Then give it a name. For example “Private Documents” or the name of your collection.
Step 2: Upload Documents
Upload PDF, TXT, DOCX, or Markdown files to the Knowledge Base you just created. Wait for processing to finish. Open WebUI splits the documents into small chunks. Then it turns those chunks into embeddings. Embeddings are explained below.
Step 3: Ask Your Documents
Open a new chat. Type # and pick your Knowledge Base. Or click + > Attach Knowledge. Then ask anything about the contents of your documents. For example, “What are the leave application requirements in the HR document?” The AI will answer from those documents.
Alternative: attach the Knowledge Base to a model so it is always active. Go to Workspace > Models > Edit > Knowledge. Then pick your Knowledge Base.
The Local Embedding Model
An embedding is a way of turning text into numbers. The numbers let the computer find the chunks that match your question. Open WebUI uses a local embedding model. The default is nomic-embed-text (about 274 MB). Default means the built-in choice. If it is not on your laptop yet, pull it with Ollama:
ollama pull nomic-embed-text
ollama pull nomic-embed-text
then pick it under Admin > Settings > Documents > Embedding Model.
Reading Answers: Citations
RAG answers come with citations to their sources. Click a citation to open the file at the quoted page. That is what sets RAG apart from ordinary chat. You can check for yourself where the answer came from. You do not have to just trust it.
Tips
- Plain text files (text-based PDFs, TXT, Markdown) give the best results. Scanned files (images) need OCR first before they can be read. OCR is a technology that turns pictures of writing into text.
- Manage files under
Settings>Data Controls>Manage Files. Deleting a file also deletes its embeddings.
Every step — chat, embeddings, and documents — runs on your own laptop. No data leaves it.
Quick Troubleshooting
- Answers do not connect to your documents → check that the files have finished processing, then re-index. Re-index means processing the files again so they can be searched.
- Out of RAM during RAG → embeddings and the chat model share RAM, so do not run them together with heavy apps.
Comments