feat: add Valkey as a vector store backend#35337
Open
daric93 wants to merge 7 commits intolanggenius:mainfrom
Open
feat: add Valkey as a vector store backend#35337daric93 wants to merge 7 commits intolanggenius:mainfrom
daric93 wants to merge 7 commits intolanggenius:mainfrom
Conversation
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-17 03:41:53.732644455 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-17 03:41:42.198612951 +0000
@@ -552,6 +552,8 @@
--> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:33:5
ERROR Object of class `ModuleType` has no attribute `Index` [missing-attribute]
--> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:34:5
+ERROR Cannot set item in `list[list[float] | str]` [unsupported-operation]
+ --> providers/vdb/vdb-valkey/tests/integration_tests/test_valkey.py:248:9
ERROR Object of class `ModuleType` has no attribute `SimpleConnectionPool` [missing-attribute]
--> providers/vdb/vdb-vastbase/tests/unit_tests/test_vastbase_vector.py:27:5
ERROR Object of class `ModuleType` has no attribute `execute_values` [missing-attribute]
@@ -4592,7 +4594,7 @@
ERROR Argument `list[Document | SimpleNamespace]` is not assignable to parameter `texts` with type `list[Document]` in function `core.rag.datasource.vdb.vector_base.BaseVector._get_uuids` [bad-argument-type]
--> tests/unit_tests/core/rag/datasource/vdb/test_vector_base.py:87:30
ERROR Class member `_Expr.__eq__` overrides parent class `object` in an inconsistent manner [bad-override]
- --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:203:13
+ --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:204:13
ERROR Argument `list[str]` is not assignable to parameter `docs` with type `Sequence[Document]` in function `core.rag.docstore.dataset_docstore.DatasetDocumentStore.add_documents` [bad-argument-type]
--> tests/unit_tests/core/rag/docstore/test_dataset_docstore.py:307:37
ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
|
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds Valkey as a supported vector store backend for embeddings + retrieval, wiring it through configuration, packaging/entrypoints, Docker env, and CI workflows.
Changes:
- Introduces a new
ValkeyVectorbackend (factory + config), backed byvalkey-glideandvalkey-search. - Adds Valkey configuration/env examples and registers the provider in the API workspace.
- Adds unit + integration tests and includes Valkey in vdb CI workflows.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| docker/docker-compose.yaml | Adds Valkey env vars to the shared API/worker environment block. |
| docker/.env.example | Documents valkey as a vector store option and adds Valkey-specific env vars. |
| api/.env.example | Documents valkey as a vector store option and adds Valkey-specific env vars. |
| api/core/rag/datasource/vdb/vector_type.py | Adds VALKEY to the VectorType enum. |
| api/configs/middleware/vdb/valkey_config.py | Introduces Pydantic settings for Valkey connection + metric selection. |
| api/configs/middleware/init.py | Registers ValkeyConfig in the middleware config mixin. |
| api/pyproject.toml | Adds dify-vdb-valkey to workspace deps and feature groups. |
| api/tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py | Registers Valkey factory module path in vector factory tests. |
| api/providers/vdb/vdb-valkey/pyproject.toml | Defines the new provider package + entrypoint. |
| api/providers/vdb/vdb-valkey/src/dify_vdb_valkey/valkey_vector.py | Implements Valkey vector backend + helpers + factory. |
| api/providers/vdb/vdb-valkey/tests/unit_tests/test_valkey_vector.py | Adds unit tests for helper functions + config defaults. |
| api/providers/vdb/vdb-valkey/tests/integration_tests/test_valkey.py | Adds integration tests against a live Valkey+valkey-search instance. |
| .github/workflows/vdb-tests.yml | Adds Valkey to smoke vdb integration matrix and test paths. |
| .github/workflows/vdb-tests-full.yml | Adds Valkey to weekly/full vdb integration matrix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
|
Please mark those comments as resolved if you think it's ok. |
Contributor
Pyrefly Diffbase → PR--- /tmp/pyrefly_base.txt 2026-04-17 04:50:08.566547899 +0000
+++ /tmp/pyrefly_pr.txt 2026-04-17 04:49:57.595535056 +0000
@@ -552,6 +552,8 @@
--> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:33:5
ERROR Object of class `ModuleType` has no attribute `Index` [missing-attribute]
--> providers/vdb/vdb-upstash/tests/unit_tests/test_upstash_vector.py:34:5
+ERROR Cannot set item in `list[list[float] | str]` [unsupported-operation]
+ --> providers/vdb/vdb-valkey/tests/integration_tests/test_valkey.py:248:9
ERROR Object of class `ModuleType` has no attribute `SimpleConnectionPool` [missing-attribute]
--> providers/vdb/vdb-vastbase/tests/unit_tests/test_vastbase_vector.py:27:5
ERROR Object of class `ModuleType` has no attribute `execute_values` [missing-attribute]
@@ -4592,7 +4594,7 @@
ERROR Argument `list[Document | SimpleNamespace]` is not assignable to parameter `texts` with type `list[Document]` in function `core.rag.datasource.vdb.vector_base.BaseVector._get_uuids` [bad-argument-type]
--> tests/unit_tests/core/rag/datasource/vdb/test_vector_base.py:87:30
ERROR Class member `_Expr.__eq__` overrides parent class `object` in an inconsistent manner [bad-override]
- --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:203:13
+ --> tests/unit_tests/core/rag/datasource/vdb/test_vector_factory.py:204:13
ERROR Argument `list[str]` is not assignable to parameter `docs` with type `Sequence[Document]` in function `core.rag.docstore.dataset_docstore.DatasetDocumentStore.add_documents` [bad-argument-type]
--> tests/unit_tests/core/rag/docstore/test_dataset_docstore.py:307:37
ERROR Argument `None` is not assignable to parameter `orig` with type `BaseException` in function `sqlalchemy.exc.DBAPIError.__init__` [bad-argument-type]
|
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 16 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: Daria Korenieva <daric2612@gmail.com>
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.
Fixes #35229
Summary
Adds Valkey as a supported vector database backend for knowledge base embeddings and retrieval in Dify, using valkey-glide (the official Valkey Python client) and the valkey-search module for vector similarity search.
What's included:
Key design decisions:
Dependencies:
Checklist