Skip to main content

Document Chat

Document Chat lets Libre WebUI search uploaded documents and pass relevant excerpts into chat context.

Supported Files

Current upload support:

  • PDF
  • Plain text
  • Maximum file size: 10 MB

Files are processed by the backend and stored with the rest of the application data.

Search Modes

Libre WebUI supports two retrieval modes:

ModeWhen usedNotes
Keyword searchAlways availableNo embedding model required
Semantic searchEmbeddings enabled in SettingsUses the configured embedding model and similarity threshold

If embeddings fail or are disabled, document search falls back to keyword matching.

Install an embedding model:

ollama pull nomic-embed-text

Then open Settings and enable embeddings. You can use local Ollama embedding models or embedding-capable provider plugins.

Default embedding settings:

  • Model: nomic-embed-text
  • Chunk size: 1000 characters
  • Chunk overlap: 200 characters
  • Similarity threshold: 0.3
  1. Upload a PDF or text file from the document controls.
  2. Wait for processing to finish.
  3. Ask a question in chat.
  4. Libre WebUI retrieves relevant chunks for that session and includes them as context.

Example prompts:

Summarize the uploaded document in five bullets.
What deadlines are mentioned in the PDF?
Find the section that talks about pricing.
Compare the uploaded policy with this proposed change.

API Endpoints

EndpointPurpose
POST /api/documents/uploadUpload a PDF or text file
GET /api/documentsList uploaded documents
GET /api/documents/session/:sessionIdList documents for a chat session
POST /api/documents/searchSearch documents
DELETE /api/documents/:documentIdDelete a document
GET /api/documents/embeddings/statusView embedding status
POST /api/documents/embeddings/regenerateRegenerate embeddings

Best Practices

  • Keep uploads focused on the current task.
  • Use text-based PDFs when possible; scanned PDFs may have little extractable text.
  • Regenerate embeddings after changing the embedding model.
  • Lower the similarity threshold if semantic search misses useful context.
  • Raise the threshold if results feel noisy.