mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-11 10:03:05 -05:00
[PR #24769] feat: add support for Valkey vector database #115140
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24769
Author: @rileydes-improving
Created: 5/15/2026
Status: 🔄 Open
Base:
dev← Head:feat/add-valkey-vector-database📝 Commits (1)
20252b5feat: add support for Valkey vector database📊 Changes
7 files changed (+744 additions, -1 deletions)
View changed files
📝
.env.example(+10 -1)📝
backend/open_webui/config.py(+9 -0)➕
backend/open_webui/retrieval/vector/dbs/valkey.py(+718 -0)📝
backend/open_webui/retrieval/vector/factory.py(+4 -0)📝
backend/open_webui/retrieval/vector/type.py(+1 -0)📝
backend/requirements.txt(+1 -0)📝
pyproject.toml(+1 -0)📄 Description
Pull Request Checklist
Note to first-time contributors: Please open a discussion post in Discussions to discuss your idea/fix with the community before creating a pull request, and describe your changes before submitting a pull request.
This is to ensure large feature PRs are discussed with the community first, before starting work on it. If the community does not want this feature or it is not relevant for Open WebUI as a project, it can be identified in the discussion before working on the feature and submitting the PR.
Issue -> https://github.com/open-webui/open-webui/issues/24623
Discussion -> https://github.com/open-webui/open-webui/discussions/24624
Pull Request Checklist
Before submitting, make sure you've checked the following:
dev.open-webui/docscoveringVECTOR_DB=valkey, the newVALKEY_*environment variables, and module/version requirements.valkey-glide-sync==2.3.1(the official Valkey GLIDE synchronous Python client). Added to bothbackend/requirements.txtandpyproject.toml. The client is only imported lazily from the factory whenVECTOR_DB=valkey, so existing deployments are unaffected. The code paths that use the client have been exercised end-to-end againstvalkey-bundle:9.1.0-rc2.valkey-bundle:9.1.0-rc2(Valkey core 9.1.0 + valkey-search 1.2.0) and a custom image with (Valkey core 9.0.1 + valkey-search 1.2.0). Manually verified document ingestion, KNN search, filtered KNN, metadata queries, collection reset, and deletion by id/filter.backend/open_webui/retrieval/vector/dbs/.VECTOR_DB=valkeyandVALKEY_URL. Defaults mirror the other vector backends.dev.feat:Changelog Entry
Description
Adds Valkey as a vector database backend for RAG, selectable via
VECTOR_DB=valkey. The implementation uses the valkey-search module's nativeFT.CREATE/FT.SEARCHprimitives for HNSW/FLAT vector indexing, KNN queries, and tag-filtered metadata queries, no client-side vector math. Requires valkey-search 1.2.0+ running on Valkey core 9.0.1+ (either a stable core withlibsearch.soloaded via--loadmoduleor thevalkey-bundle:9.1.0-rc2+image).Motivation: Valkey is the BSD-3-licensed, community-governed fork of Redis after the Redis 7.4 license change. Valkey's search module is now feature-complete enough to back Open WebUI's RAG layer.
Added
valkeyinbackend/open_webui/retrieval/vector/dbs/valkey.pyimplementing theVectorDBBaseinterface (insert,upsert,search,query,get,delete,reset,has_collection,delete_collection).VectorType.VALKEYenum entry and factory wiring inbackend/open_webui/retrieval/vector/{type,factory}.py.backend/open_webui/config.pyand.env.example:VALKEY_URLVALKEY_COLLECTION_PREFIX(defaultopen_webui)VALKEY_INDEX_TYPE(HNSW|FLAT, defaultHNSW)VALKEY_DISTANCE_METRIC(COSINE|L2|IP, defaultCOSINE)VALKEY_HNSW_M(default16)VALKEY_HNSW_EF_CONSTRUCTION(default200)VALKEY_HNSW_EF_RUNTIME(default10)MODULE LISTand fails fast ifsearchis missing or older than 1.2.0.valkey-glide-sync==2.3.1(added tobackend/requirements.txtandpyproject.toml). This is the official Valkey GLIDE synchronous Python client, which provides native support for valkey-search module commands (ft.create,ft.search,ft.info, etc.) with proper response parsing.Changed
Deprecated
Removed
Fixed
Security
valkey://host:port/db). No credentials are logged.Breaking Changes
VECTOR_DBvalues and behavior are unchanged. Valkey is purely opt-in.Additional Information
Module version requirement. valkey-search 1.2.0 is the binding dependency. It's what adds TEXT fields, TAG expressions, and filter-only
FT.SEARCH. Operators have two supported deployment paths:--loadmodule libsearch.so.valkey/valkey-bundle:9.1.0-rc2or later (single image).The runtime check validates either path at startup.
Known workarounds (both upstream-tracked, negligible runtime impact):
FT.SEARCH idx "*"wildcard is not yet in a tagged valkey-search release,get()falls back toSCAN+HGETALL. Tracked in valkey-search#957, fix merged in PR #960, expected in 1.2.1/1.3.0.get()is not on the hot search path.__vector_scorefield isn't returned when aRETURNclause is used, and can't be used inSORTBY. Thesearch()method omitsRETURNand sorts client-side. Tracked as an enhancement in valkey-search#989. Extra payload is ~1.5KB per result; client-side sort of ≤10 items is microseconds.Both workarounds are one-line changes once upstream ships the fixes.
Testing (not committed, local to my working tree):
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.