Coming soon! The Kael'Nyrin Scrolls: The Atlas Edict

Captain Walker

OpenWebUI: Disabling Default Knowledge Base Searches on Base Models

backup, code, Docker, Knowledgebase, OpenWebUI, powershell, sqlite

Estimated reading time at 200 wpm: 3 minutes

Problem

After upgrading OpenWebUI (observed from v0.11.x onwards), every chat triggers a search across all knowledge collections — even on base models with no knowledge collections attached. This occurs because the “Knowledge Base” builtin tool is enabled by default on all models. When enabled, it allows the model to autonomously search all knowledge collections as a tool call, independent of any collections explicitly attached to the model.

Whether or not you agree our Fat Disclaimer applies

There is no global admin setting to disable this across all models at once.

Objective

Disable the Knowledge Base builtin tool on all base models while leaving workspace (custom) models untouched, so that curated knowledge access on workspace models is preserved.

Solution

A targeted SQLite update via Python, executed inside the OpenWebUI Docker container.

Backup first via PowerShell

docker stop open-webui
docker run --rm -v open-webui:/data -v C:\OWUI\backup:/backup alpine tar czf /backup/openwebui-backup-before-kb-fix.tar.gz -C /data .
docker start open-webui

The script identifies base models (those with no base_model_id) and sets builtinTools.knowledge to false in each model’s JSON metadata. Models already disabled are skipped. Workspace models are excluded by the query filter.

Code

Run in PowerShell. Take a volume backup beforehand.

@"
import sqlite3, json
conn = sqlite3.connect('/app/backend/data/webui.db')
rows = conn.execute("SELECT id, meta FROM model WHERE base_model_id IS NULL OR base_model_id = ''").fetchall()
updated = 0
for model_id, meta_str in rows:
    meta = json.loads(meta_str)
    if 'builtinTools' not in meta:
        meta['builtinTools'] = {}
    if meta['builtinTools'].get('knowledge') == False:
        continue
    meta['builtinTools']['knowledge'] = False
    conn.execute("UPDATE model SET meta = ? WHERE id = ?", (json.dumps(meta), model_id))
    updated += 1
conn.commit()
conn.close()
print(f"Updated {updated} base models. Skipped models already disabled.")
"@ | docker exec -i open-webui python3

Restart the container afterwards:

docker restart open-webui

Reversibility

To re-enable the Knowledge Base tool on all base models, run the same script with True in place of False:

@"
import sqlite3, json
conn = sqlite3.connect('/app/backend/data/webui.db')
rows = conn.execute("SELECT id, meta FROM model WHERE base_model_id IS NULL OR base_model_id = ''").fetchall()
updated = 0
for model_id, meta_str in rows:
    meta = json.loads(meta_str)
    if 'builtinTools' not in meta:
        meta['builtinTools'] = {}
    if meta['builtinTools'].get('knowledge') == True:
        continue
    meta['builtinTools']['knowledge'] = True
    conn.execute("UPDATE model SET meta = ? WHERE id = ?", (json.dumps(meta), model_id))
    updated += 1
conn.commit()
conn.close()
print(f"Re-enabled {updated} base models.")
"@ | docker exec -i open-webui python3

Notes

  • Workspace models are identified by having a non-empty base_model_id and are excluded from both scripts.
  • Knowledge collections explicitly attached to a workspace model (via the model’s Knowledge section) use a separate retrieval path and are unaffected by this change.
  • The setting can also be toggled per model via the OpenWebUI UI: Workspace > Models > edit model > Builtin Tools > Knowledge Base.