I don’t fully understand how snap works but I think my locally running AI has the right idea:
Feature Request: Expose RAG_SYSTEM_CONTEXT Environment Variable in Open WebUI Snap
Summary
Requesting the addition of RAG_SYSTEM_CONTEXT as an exposed configuration option in the Open WebUI Snap package to enable KV cache optimization for RAG (Retrieval-Augmented Generation) workloads.
Background & Value Proposition
The RAG_SYSTEM_CONTEXT=True environment variable is a documented feature in Open WebUI that significantly improves performance for follow-up questions when using large knowledge bases [1]. It works by injecting RAG context into the system message rather than user messages, allowing LLM engines like Ollama and llama.cpp to utilize KV prefix caching. This results in near-instant follow-up responses instead of re-processing large contexts every turn [2].
Current Limitation
The Open WebUI Snap package currently does not expose this environment variable via snap set. Users cannot configure it because:
- The variable is not defined in the Snap’s configuration schema (
snapcraft.yaml) - Attempting to set it results in:
error: invalid option name: "RAG_SYSTEM_CONTEXT"[3] - Snaps isolate applications and only allow explicitly exposed configuration options
Proposed Implementation
Add a new configuration option in the Snap’s snapcraft.yaml file using the standard Snap configuration mechanism:
config:
type: map
schema:
rag_system_context:
type: boolean
description: "Inject RAG context into system message for KV cache optimization"
default: false
Then expose it via snap set openwebui rag_system_context=true [4].
Technical Justification
- Valid Variable:
RAG_SYSTEM_CONTEXTis officially documented and supported by Open WebUI v0.8.10+ [5] - User Impact: Enables critical performance optimisation for users running RAG-heavy workloads with Ollama on local systems
- Precedent: Many other environment variables (like
ENABLE_SIGNUP,WEBUI_URL) are already exposed in similar configurations, though not all have been ported to Snap [6]
Impact Scope
This change would:
Enable KV cache optimisation for RAG users without requiring Docker migration
Maintain Snap security and confinement model
Follow established patterns for configurable environment variables in Snap packages [7]