Open WebUI Advanced: RAG, Pipelines, and Custom System Prompts

Go beyond basic chat with Open WebUI — set up Retrieval-Augmented Generation with local documents, configure pipeline tools, create specialized assistants with custom system prompts, and use the API for programmatic access.

The Ollama cluster post covers deploying Ollama and connecting it to Open WebUI. Once it’s running, most people stop there and use it like a basic chat interface. This post covers the features that make a self-hosted LLM setup actually more useful than just using Claude.ai or ChatGPT — specifically: RAG with your own documents, custom assistants for recurring tasks, and API access for scripted use.


What Open WebUI actually does

Open WebUI is more than a chat frontend. It’s a full LLM workflow platform:

Feature What it enables
Multi-model routing Switch models mid-conversation, compare responses
RAG (document upload) Ground the model in your own files
Custom assistants Personas with fixed system prompts, tools, and knowledge bases
Pipelines Multi-step tool chains (search → summarize → respond)
API compatibility OpenAI-compatible API for external integrations
User management Multi-user with role-based access

Task 1: Set up RAG with your homelab documentation

Retrieval-Augmented Generation (RAG) lets the model answer questions by retrieving relevant chunks from uploaded documents rather than relying solely on training data. This is the correct approach for asking questions about your specific infrastructure.

1Upload documents to Open WebUI5 min

In Open WebUI:

  1. Go to Workspace → Documents
  2. Click Upload a file
  3. Upload your runbooks, network diagrams (as text), configuration notes, or wiki exports

Supported formats: PDF, TXT, DOCX, Markdown, and more. Open WebUI automatically chunks and embeds the documents using a local embedding model.

Note

Open WebUI uses nomic-embed-text or all-minilm for embeddings by default. If you haven’t pulled one yet, go to Admin → Settings → Documents → Embedding Model and pull it. It downloads via Ollama automatically.

2Enable RAG in a chat2 min

In any chat:

  1. Click the + (attachment) button
  2. Select Add Documents from Library
  3. Choose the documents you want to include

The model now has access to the document content for this conversation. Ask questions like “What is our CT naming convention?” or “Which node runs the monitoring stack?” and the model will retrieve and cite the relevant sections.

3Configure the RAG embedding model5 min

The default embedding model is adequate but nomic-embed-text is significantly better for technical documentation:

Pull the embedding model via Ollama

# Inside the Open WebUI container (CT 103) or any Ollama node
ollama pull nomic-embed-text

Then in Open WebUI: Admin → Settings → Documents → Embedding Model: select nomic-embed-text:latest.

Re-index your existing documents: Workspace → Documents → select all → Re-index.


Task 2: Create a homelab assistant

Custom assistants are a system prompt + optional tools and document collections saved as a reusable entity. Create one for each recurring use case.

1Create a Proxmox assistant5 min

Go to Workspace → Models → Create a model (or Assistants in newer versions).

Field Value
Name Proxmox Assistant
Base model qwen2.5-coder:14b (or your preferred model)
System prompt See below

System prompt:

You are a Proxmox VE expert for the MyOfficeLab homelab cluster.

Cluster details:
- 4 nodes: pvelab01 (10.0.0.70), pvelab02 (.71), pvelab03 (.72), pvelab04 (.73)
- CT naming convention: sequential IDs starting from 100
- Storage: local-lvm for containers, local for ISOs and templates
- API token: myofficelab-app@pve!app-token (PVEAdmin)
- Monitoring: Prometheus + Grafana in CT 105

When giving commands, always specify which node to run them on. Prefer pct exec for running commands inside containers. Always confirm destructive operations before executing.

Click Save.

2Create a writing assistant for blog posts5 min

Create another assistant:

Field Value
Name Homelab Writer
Base model llama3.2 (faster for text tasks)

System prompt:

You are a technical writer for the Build a Homelab blog at buildahomelab.dev.

Style guide:
- Audience: intermediate-level homelab enthusiasts who know Linux basics
- Tone: direct and practical — no padding, no "as we can see" filler
- Structure: use Step components for task sequences, Callout for warnings/tips
- Code: always in Terminal blocks with descriptive titles
- Length: detailed enough to reproduce the result, not longer
- Links: include Amazon affiliate links for recommended hardware where natural

When asked to draft a post, follow the established format with frontmatter, imports, and component usage matching existing posts.

Task 3: Use the OpenAI-compatible API

Open WebUI exposes an OpenAI-compatible API at /api/openai. Any tool that supports a custom OpenAI endpoint can use it — including the openai Python SDK, shell scripts, and apps like Cursor or Obsidian Copilot.

1Get your API key from Open WebUI2 min

In Open WebUI: Account → API Keys → Generate new key

Copy the key — it’s only shown once.

2Test the API from the command line3 min
Test API call from pvelab04

curl http://10.0.0.69:8080/api/openai/chat/completions -H "Authorization: Bearer YOUR_API_KEY" -H "Content-Type: application/json" -d '{
  "model": "llama3.2",
  "messages": [{"role": "user", "content": "What is 2+2?"}],
  "stream": false
}'

The response matches the OpenAI API format exactly — same JSON structure as the real API.

3Use the API in a Python script5 min
Example Python script using the local API

pip install openai

python3 << 'EOF'
from openai import OpenAI

client = OpenAI(
  base_url="http://10.0.0.69:8080/api/openai",
  api_key="YOUR_API_KEY"
)

response = client.chat.completions.create(
  model="qwen2.5-coder:14b",
  messages=[
      {"role": "system", "content": "You are a helpful assistant."},
      {"role": "user", "content": "Write a one-line bash command to count running LXC containers."}
  ]
)
print(response.choices[0].message.content)
EOF

This pattern lets you use local inference anywhere you’d use the OpenAI API — for free, with no rate limits, and without sending data to external servers.


Task 4: Set up web search for the model

Open WebUI can augment model responses with live web search results using a search engine integration.

1Configure SearXNG as a search backend10 min

SearXNG is a self-hosted meta-search engine that aggregates results from Google, DuckDuckGo, and others without tracking.

Create a container for SearXNG (CT 113, Ubuntu 24.04, 512MB RAM), then:

Inside CT 113 — install SearXNG

apt-get update && apt-get install -y python3-venv git

git clone https://github.com/searxng/searxng.git /opt/searxng
cd /opt/searxng
python3 -m venv venv
venv/bin/pip install -e .

# Generate a secret key
sed -i "s/ultrasecretkey/$(openssl rand -hex 32)/" searx/settings.yml

# Start SearXNG
venv/bin/python searx/webapp.py
2Connect SearXNG to Open WebUI2 min

In Open WebUI: Admin → Settings → Web Search:

  • Enable Web Search
  • Set Search Engine URL to http://10.0.0.82:8080/search?q=<query>&format=json (your SearXNG container IP)

Now in any chat, click the search icon (globe) to enable web search for that message. The model will retrieve fresh search results and incorporate them into its response.


Task 5: Configure model parameters for your hardware

The default model parameters work, but tuning them for your CPU hardware improves quality and speed.

1Adjust parameters in Open WebUI3 min

In any chat, click the Controls panel (sliders icon):

Parameter Recommended value for CPU inference Effect
Temperature 0.3–0.5 for technical tasks, 0.7–1.0 for creative Lower = more deterministic
Context length 4096 (default) Higher uses more RAM and slows inference
Num predict 512 for quick answers, -1 for unlimited Max tokens to generate
Top P 0.9 Controls response diversity

For code generation tasks on CPU: Temperature 0.2, Top P 0.9, Context 4096 gives the best results — deterministic enough to write correct code, fast enough to be usable.


Monitoring Open WebUI performance

Check Open WebUI and Ollama resource usage

# CPU and memory for the Open WebUI process
pct exec 103 -- ps aux --sort=-%mem | head -5

# Ollama inference stats (when a model is loaded)
pct exec 100 -- curl -s http://localhost:11434/api/ps

# Real-time resource view
pct exec 103 -- top -b -n 1 | head -20

Open WebUI itself is lightweight — the resource cost is almost entirely in Ollama inference on the separate CT 100/101/102 nodes. On the 2400G CPUs in this cluster, expect 70–95% CPU utilization on one node during active inference, dropping to ~5% when idle.


Related posts: