Feature Request: Expose RAG_SYSTEM_CONTEXT Environment Variable in Open WebUI

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:

  1. The variable is not defined in the Snap’s configuration schema (snapcraft.yaml)
  2. Attempting to set it results in: error: invalid option name: "RAG_SYSTEM_CONTEXT" [3]
  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_CONTEXT is 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:

  • :white_check_mark: Enable KV cache optimisation for RAG users without requiring Docker migration
  • :white_check_mark: Maintain Snap security and confinement model
  • :white_check_mark: Follow established patterns for configurable environment variables in Snap packages [7]

I hope this helps, if all good it will be published in a few hours.

If you use AI you could just point it at this repo to create a PR if it is easier.

That would be very helpful! Proof my local AI is a potato. Haven’t figured out the coding side of things yet, so if you could push that change, I’m not ready to unleash a coding robot on my machine to delete my root directory.

1 Like

This is pushed to the store.