Open WebUI HQ
Isometric 3D scene of a document feeder linked through a glowing cube data processor to a blank chat bubble on a dark blue base.
guides

Open WebUI RAG Document Upload: From File to Answer

Follow an Open WebUI document from upload through extraction, embeddings and retrieval, then configure Knowledge and diagnose missing answers.

By Open WebUI HQ Editorial · ·Updated · 8 min read

When Open WebUI indexes a document upload for RAG, it extracts the text, splits it into chunks and stores embeddings so the model can find relevant passages when you ask a question. Native function calling is the default, with Preload files off. When the model calls query_knowledge_files, the tool ranks chunks across all attached knowledge together and uses its own count argument, which defaults to five results. Open WebUI Essentials · RAG guide · Knowledge guide

The admin Top K setting (RAG_TOP_K) defaults to 10 chunks per attached file or knowledge base for preloaded RAG, the default in Legacy mode. Configuration for chunking, embeddings and preloaded retrieval lives in Settings > Documents in the admin section. Environment variable reference · RAG guide

A PDF upload can succeed while its contents are still unavailable for search. By default, an API upload returns a file ID immediately while text extraction and embedding continue in the background. API endpoints

Related reading includes Open WebUI and Local Models: How the Pieces Fit Together.

The Open WebUI documentation and release notes through v0.13.4 were checked on 2026-11-21. The steps were documented without running them.

What happens after document upload

The standard image uses pypdf for PDF extraction by default. Open WebUI splits the extracted text with its character splitter into chunks of up to 1,024 characters with 100 characters of overlap. It then embeds the chunks locally with sentence-transformers/all-MiniLM-L6-v2 and stores them in Chroma. Open WebUI Essentials · Environment variable reference

For multi-user setups, Essentials suggests an external embeddings API such as OpenAI or Ollama with nomic-embed-text. For image-based documents, the extraction guide covers OCR and engines such as Apache Tika, Docling, Mistral OCR and an external loader. Open WebUI Essentials · Document extraction guide

Upload a file or build reusable Knowledge

For an isolated question, drag the document into the chat input and ask about it in that conversation. Open WebUI Essentials

Follow these steps to make documents available across chats. Knowledge setup

  1. Open Workspace > Knowledge, select Create, and name the collection.
  2. Upload the documents and wait for processing to finish.
  3. Select the collection with # in chat, or open the Knowledge field in the model editor under Workspace > Models.
  4. Ask a question with a known answer and compare the supporting passage with the original document.

Focused Retrieval is the default and suits large document sets where only a few passages matter. For a short reference file attached in chat, enable Preload files and choose Using Entire Document to include the full text with each message. Model-attached Knowledge is injected upfront in Legacy mode with Preload files enabled. Knowledge guide · RAG guide

Set the starting mode for new attachments with Default Upload Mode in Settings > Interface > File. Admins can use Full Text Threshold (Characters) to include short file and text attachments in full, or Always Use Full Text to include complete documents. RAG guide · Knowledge guide

Preload files controls whether Open WebUI retrieves and injects passages from chat attachments upfront. Builtin Tools lets models with Native function calling search on demand. For focused retrieval from attached Knowledge in Native mode, enable Builtin Tools and the Knowledge Base tool category. RAG guide · Knowledge guide

Hybrid search combines BM25 keyword matching and vector search, with optional reranking. For preloaded retrieval, RAG_TOP_K sets the candidate count and RAG_TOP_K_RERANKER defaults to keeping up to 10 after reranking. RAG_RELEVANCE_THRESHOLD defaults to 0.0, which disables the cutoff. Environment variable reference

Open WebUI RAG default settings

These are the documented defaults before any saved settings take effect. Environment variable reference

SettingVariableDefault
Embedding engineRAG_EMBEDDING_ENGINEEmpty (SentenceTransformers)
Embedding modelRAG_EMBEDDING_MODELsentence-transformers/all-MiniLM-L6-v2
Vector databaseVECTOR_DBchroma (pgvector on the slim image)
Text splitterRAG_TEXT_SPLITTERcharacter
Chunk size / overlapCHUNK_SIZE / CHUNK_OVERLAP1024 / 100
Top K for preloaded RAGRAG_TOP_K10
Hybrid searchENABLE_RAG_HYBRID_SEARCHFalse
Extraction engineCONTENT_EXTRACTION_ENGINEEmpty (default engine)
Always Use Full TextRAG_FULL_CONTEXTFalse
Bypass embedding and retrievalBYPASS_EMBEDDING_AND_RETRIEVALFalse

The supported external embedding engines are ollama, openai and azure_openai. Environment variable reference

CHUNK_SIZE, RAG_TOP_K, RAG_TEXT_SPLITTER and RAG_EMBEDDING_MODEL are ConfigVar settings. A value saved in the database can override an environment variable after a restart. Change the saved value in the admin panel, or set ENABLE_PERSISTENT_CONFIG=False to use environment variables. With persistence disabled, changes made in the admin UI are lost at restart. Reindex existing documents after changing CHUNK_SIZE. Environment variable reference

For saved Ollama connection settings, see the Ollama connection guide.

What Bypass Embedding and Retrieval does

BYPASS_EMBEDDING_AND_RETRIEVAL skips embedding and retrieval when enabled. It defaults to False and is a persistent ConfigVar. Environment variable reference

Slim image rejects PDF uploads

The slim image requirements documented for v0.11.4 include an external document extractor for PDFs, Word files and presentations. It reads text, Markdown, CSV, HTML and XML directly. It also requires OpenAI, Ollama or Azure OpenAI for embeddings and PostgreSQL with pgvector for Knowledge search. v0.11.4 release notes

To configure an external extractor for the slim image, use these settings. External extraction guide

  1. Open Settings > Documents in the admin section.
  2. Set Content Extraction Engine to External.
  3. Enter your service’s base URL in Document Loader URL. Open WebUI appends /process.
  4. Fill in the required API Key field. Open WebUI sends the key as a bearer token.

The equivalent environment settings are CONTENT_EXTRACTION_ENGINE=external, EXTERNAL_DOCUMENT_LOADER_URL and EXTERNAL_DOCUMENT_LOADER_API_KEY. The reference also lists tika and docling as engine options. Environment variable reference

Check which image tag you use against the Docker install guide. The update guide covers pinning an image tag.

Match chunk size and Top K to the model’s context

Retrieved chunks share the model’s context window with the system prompt and conversation history. Use these starting points when Preload files is enabled. Each profile uses the token splitter and enables Markdown Header Text Splitter. RAG troubleshooting guide

DeploymentChunk size (tokens)Overlap (tokens)Top K
Local models, 8K context or less10001003 to 5
Mixed local and cloud150020010
Cloud models, 32K+ context200020015 to 25

For one attachment, five full 1,000-token chunks add up to 5,000 tokens, already beyond a 4,096-token context window. Ollama selects its default context by VRAM. The troubleshooting guide lists 4,096 tokens below 24 GiB, 32,768 from 24 GiB to under 48 GiB, and 262,144 at 48 GiB and above. If hybrid search uses a reranker, budget for the chunks kept after reranking. On an Ollama model that supports a larger context, open Settings > Models in the admin section, edit the model and change the context length under Advanced Params. RAG troubleshooting guide

Uploaded document not appearing in answers

Check these points in order when the model answers as if the document were missing.

  1. Processing finished. The status endpoint can report pending, processing, completed or failed. Adding a file to Knowledge too early can return a 400 error with the message The content provided is empty. RAG troubleshooting guide
  2. The document has searchable text. For scanned PDFs, enable PDF Extract Images (OCR) in Settings > Documents. This setting is PDF_EXTRACT_IMAGES and defaults to False. Try Apache Tika or Docling if the default extractor still misses text. Other engine options include mistral_ocr and paddleocr_vl. RAG troubleshooting guide · Environment variable reference
  3. The embedding model loads. The error 400: 'NoneType' object has no attribute 'encode' can indicate a missing or misconfigured embedding model. Check the engine and model in Settings > Documents. RAG troubleshooting guide
  4. The model can search attached Knowledge. In Native mode, use a model that supports function calling and enable Builtin Tools and the Knowledge Base tool category. The tool that searches file contents is query_knowledge_files. Knowledge guide
  5. The context has room for the results. If passages are cut off, raise the context length if your model supports it. For preloaded retrieval, you can also lower Top K. RAG troubleshooting guide
  6. The file’s own index exists. If results appear for a knowledge base and disappear when you attach the file by itself, run Reindex Knowledge and Memory Vectors in Settings > Documents. This rebuilds the knowledge base indexes, the indexes for individual files in those bases and user memories. RAG troubleshooting guide

If embedding fails with CUDA out of memory after you raised RAG_EMBEDDING_BATCH_SIZE, lower the batch size. RAG troubleshooting guide

Check processing from the API

Use your Open WebUI API key in the Authorization: Bearer YOUR_API_KEY header. Follow this order when uploading a file and adding it to a knowledge base in separate requests. API endpoints

  1. Send POST /api/v1/files/ with the document in the multipart file field. Keep the returned file ID.
  2. Poll GET /api/v1/files/{id}/process/status with that file ID until the status is completed. If the status is failed, read the error field.
  3. Send POST /api/v1/knowledge/{id}/file/add with the knowledge base ID in the path and the JSON body {"file_id": "your-file-id-here"}. Use the file ID from the upload in the body.

To let the server link the file during upload, include knowledge_id and optionally directory_id in the upload metadata. Knowledge API guide

Prompt injection in retrieved documents

Documents can contain instructions that redirect a model away from the user’s request. Enforce authorization and least privilege outside the model, including for tools it can call. OWASP prompt injection prevention cheat sheet

FAQ

Which vector database does Open WebUI use?

Open WebUI uses Chroma by default, or pgvector on the slim image. Embedded Chroma stores vectors in local SQLite files that only one process can write to. For multiple replicas, use a client-server vector database or point Open WebUI at a standalone Chroma server with CHROMA_HTTP_HOST and CHROMA_HTTP_PORT. Environment variable reference

The documented VECTOR_DB options are chroma, elasticsearch, mariadb-vector, milvus, opengauss, opensearch, pgvector, qdrant, pinecone, s3vector, oracle23ai, weaviate and valkey. Environment variable reference

Is there a file size limit for Open WebUI uploads?

The document upload size limit (RAG_FILE_MAX_SIZE, in MB) and the number of files allowed per chat upload (RAG_FILE_MAX_COUNT) are unset by default. KNOWLEDGE_MAX_UPLOAD_COUNT and FOLDER_MAX_FILE_COUNT also default to unlimited. If you set a file size limit, Open WebUI checks the expanded contents of Office and EPUB archives as well. Environment variable reference

For Knowledge uploads, use Knowledge Batch Upload Limit, Knowledge File Size Limit (MB) and Knowledge File Count Limit in Settings > Documents. A blank field leaves that limit unset. When both global and per-knowledge-base limits apply, Open WebUI uses the lower one. Knowledge guide

Sources

  1. Open WebUI: API Endpoints
  2. Open WebUI: Essentials
  3. Open WebUI: Document Extraction
  4. Open WebUI: External Document Extraction
  5. Open WebUI: Knowledge
  6. Open WebUI: Retrieval Augmented Generation
  7. Open WebUI: RAG Troubleshooting
  8. OWASP: LLM Prompt Injection Prevention Cheat Sheet
  9. Open WebUI: Environment Variable Configuration
  10. Open WebUI releases (GitHub)
  11. Open WebUI v0.11.4 release notes (GitHub)

Related