feat: add Valkey as a vector database provider - #5929
Open
daric93 wants to merge 6 commits into
Open
Conversation
Add Valkey (with the valkey-search module) as a first-class vector
database provider, selectable via VECTOR_DB=valkey. The change is purely
additive: default behavior is unchanged and the provider is only used
when explicitly configured.
- New Valkey provider extending VectorDatabase, registered in
getVectorDbClass(); mirrors the PGVector/Qdrant providers.
- Uses the official @valkey/valkey-glide client (server only, pinned)
and valkey-search (FT.CREATE/FT.SEARCH, HNSW, COSINE) with one index
per namespace (allm_idx_{ns}) over allm:{ns}: hash keys.
- Full parity: add/delete document, delete-namespace, reset, similarity
search with threshold + topN, filterIdentifiers exclusion, vector
cache path, namespace stats, optional TLS/auth, configurable timeout.
- Settings plumbing (updateENV, systemSettings with password masked),
env examples, commented opt-in docker-compose service, admin UI option.
- Unit tests (mocked client) and gated live integration tests against
valkey/valkey-bundle.
- Rebuild cached client on connection setting changes (postUpdate disconnect) - Normalize keyPrefix to match indexName (prevent prefix/index divergence) - Guard getOrCreateIndex against dimension mismatch; reset valkey on embedder change - Wire validateConnection via preUpdate so bad config is rejected at save time - namespaceExists: only treat unknown-index as missing; propagate real outages - await client.close() in disconnect/validateConnection (no unhandled rejection) - Authenticate username-only ACL connections - Infer TLS from rediss:// endpoint scheme - Sort KNN results by similarity descending (valkey-search rejects SORTBY on KNN) - Collapse redundant FT.INFO round-trips; drop per-query existence pre-check
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Author
|
@timothycarambat could you please review this pr when you have time |
Author
|
@timothycarambat could you please review this pr when you have time. It adds Valkey as a vector database provider. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Type
Relevant Issues
resolves #
Description
Adds Valkey (with the
valkey-searchmodule) as a first-class vector database provider, selectable viaVECTOR_DB=valkey. The change is purely additive: default behavior is unchanged and the provider is only exercised when explicitly configured.Valkeyprovider extending theVectorDatabasebase contract, registered ingetVectorDbClass()exactly like the PGVector/Qdrant providers.@valkey/valkey-glideclient (server-only, pinned exact2.4.1) andvalkey-search(FT.CREATE/FT.SEARCH, HNSW, COSINE) with one index per namespace (allm_idx_{ns}) overallm:{ns}:hash keys. Vectors stored as FLOAT32 little-endian; KNN query vector bound viaPARAMS(no string interpolation).updateENVKEY_MAPPING,systemSettingswith the password surfaced as a boolean only),.env.exampleentries, a commented opt-invalkeyservice indocker-compose.yml, and an admin UI config option + provider-privacy entry.Capability parity — full parity (or greater) with the existing reference providers, nothing stubbed or deferred:
delete-namespace,reset, namespace stats / existence checkssimilarityThreshold+topN,filterIdentifiers(pinned-source) exclusionskipCacheembed path, with partial-failure surfacingrerankedSimilarityResponseis correctly out of scope (not part of the base contract)Configuration / opt-in — disabled by default; activate by setting
VECTOR_DB=valkeyplus connection config:Requires a Valkey server with the
valkey-searchmodule (valkey/valkey-bundle:8.1). A commented opt-in service is included indocker/docker-compose.yml.Visuals (if applicable)
Additional Information
What was tested
filterIdentifiersfiltering, orphan cleanup, and selector registration.valkey/valkey-bundle:8.1(real Valkey ops; only the embedder, on-disk vector cache, and PrismaDocumentVectorsstubbed). Poll-based index waits, no blind sleeps — heartbeat, index create + ingest, KNN retrieval,filterIdentifiersexclusion, document delete, namespace ops,totalVectorsacross namespaces,delete-namespace(no orphan keys),reset.eslintclean on all changed server source files.docker build -f docker/Dockerfile .succeeds locally (arm64); confirmed@valkey/valkey-glideand the Valkey provider are bundled and the provider loads inside the image.Documentation
README.md.server/utils/vectorDbProviders/valkey/SETUP.md(mirrors the other providers' setup docs).pages/features/vector-databases.mdxon Mintplex-Labs/anythingllm-docs.How to run the integration suite manually:
Developer Validations
yarn lintfrom the root of the repo & committed changes