Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/vdb-tests-full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,14 @@ jobs:
# tidb
# tiflash


# - name: Check VDB Ready (TiDB)
# run: uv run --project api python api/providers/vdb/tidb-vector/tests/integration_tests/check_tiflash_ready.py

- name: Test Vector Stores
run: |
uv run --project api pytest \
--start-vdb \
--vdb-services "weaviate,qdrant,couchbase-server,etcd,minio,milvus-standalone,pgvecto-rs,pgvector,chroma,elasticsearch,oceanbase" \
--vdb-services "weaviate,qdrant,couchbase-server,etcd,minio,milvus-standalone,pgvecto-rs,pgvector,chroma,elasticsearch,oceanbase,valkey" \
--timeout "${PYTEST_TIMEOUT:-180}" \
api/providers/vdb/*/tests/integration_tests
2 changes: 2 additions & 0 deletions .github/workflows/vdb-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
# tidb
# tiflash


# - name: Check VDB Ready (TiDB)
# run: uv run --project api python api/providers/vdb/tidb-vector/tests/integration_tests/check_tiflash_ready.py

Expand All @@ -64,4 +65,5 @@ jobs:
api/providers/vdb/vdb-chroma/tests/integration_tests \
api/providers/vdb/vdb-pgvector/tests/integration_tests \
api/providers/vdb/vdb-qdrant/tests/integration_tests \
api/providers/vdb/vdb-valkey/tests/integration_tests \
api/providers/vdb/vdb-weaviate/tests/integration_tests
10 changes: 9 additions & 1 deletion api/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ CONSOLE_CORS_ALLOW_ORIGINS=http://localhost:3000,*
COOKIE_DOMAIN=

# Vector database configuration
# Supported values are `weaviate`, `oceanbase`, `qdrant`, `milvus`, `myscale`, `relyt`, `pgvector`, `pgvecto-rs`, `chroma`, `opensearch`, `oracle`, `tencent`, `elasticsearch`, `elasticsearch-ja`, `analyticdb`, `couchbase`, `vikingdb`, `opengauss`, `tablestore`,`vastbase`,`tidb`,`tidb_on_qdrant`,`baidu`,`lindorm`,`huawei_cloud`,`upstash`, `matrixone`, `hologres`.
# Supported values are `weaviate`, `oceanbase`, `qdrant`, `milvus`, `myscale`, `relyt`, `pgvector`, `pgvecto-rs`, `chroma`, `opensearch`, `oracle`, `tencent`, `elasticsearch`, `elasticsearch-ja`, `analyticdb`, `couchbase`, `vikingdb`, `opengauss`, `tablestore`,`vastbase`,`tidb`,`tidb_on_qdrant`,`baidu`,`lindorm`,`huawei_cloud`,`upstash`, `matrixone`, `hologres`, `valkey`.
VECTOR_STORE=weaviate
# Prefix used to create collection name in vector database
VECTOR_INDEX_NAME_PREFIX=Vector_index
Expand Down Expand Up @@ -231,6 +231,14 @@ QDRANT_GRPC_ENABLED=false
QDRANT_GRPC_PORT=6334
QDRANT_REPLICATION_FACTOR=1

# Valkey configuration, only available when VECTOR_STORE is `valkey`
VALKEY_HOST=localhost
VALKEY_PORT=6379
VALKEY_PASSWORD=
VALKEY_DB=0
VALKEY_USE_SSL=false
VALKEY_DISTANCE_METRIC=COSINE

#Couchbase configuration
COUCHBASE_CONNECTION_STRING=127.0.0.1
COUCHBASE_USER=Administrator
Expand Down
2 changes: 2 additions & 0 deletions api/configs/middleware/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
from .vdb.tidb_on_qdrant_config import TidbOnQdrantConfig
from .vdb.tidb_vector_config import TiDBVectorConfig
from .vdb.upstash_config import UpstashConfig
from .vdb.valkey_config import ValkeyConfig
from .vdb.vastbase_vector_config import VastbaseVectorConfig
from .vdb.vikingdb_config import VikingDBConfig
from .vdb.weaviate_config import WeaviateConfig
Expand Down Expand Up @@ -407,5 +408,6 @@ class MiddlewareConfig(
TableStoreConfig,
DatasetQueueMonitorConfig,
MatrixoneConfig,
ValkeyConfig,
):
pass
38 changes: 38 additions & 0 deletions api/configs/middleware/vdb/valkey_config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from typing import Literal

from pydantic import Field, NonNegativeInt, PositiveInt
from pydantic_settings import BaseSettings


class ValkeyConfig(BaseSettings):
"""Configuration settings for Valkey vector database (valkey-search module)."""

VALKEY_HOST: str = Field(
description="Hostname or IP address of the Valkey server.",
default="localhost",
)

VALKEY_PORT: PositiveInt = Field(
description="Port number for the Valkey server (default is 6379).",
default=6379,
)

VALKEY_PASSWORD: str = Field(
description="Password for authenticating with the Valkey server.",
default="",
)

VALKEY_DB: NonNegativeInt = Field(
description="Valkey database number to use (default is 0).",
default=0,
)

VALKEY_USE_SSL: bool = Field(
description="Whether to use SSL/TLS for the Valkey connection.",
default=False,
)

VALKEY_DISTANCE_METRIC: Literal["COSINE", "L2", "IP"] = Field(
description="Distance metric for vector similarity search. Options: COSINE, L2, IP.",
default="COSINE",
)
1 change: 1 addition & 0 deletions api/core/rag/datasource/vdb/vector_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@ class VectorType(StrEnum):
HUAWEI_CLOUD = "huawei_cloud"
MATRIXONE = "matrixone"
CLICKZETTA = "clickzetta"
VALKEY = "valkey"
IRIS = "iris"
HOLOGRES = "hologres"
14 changes: 14 additions & 0 deletions api/providers/vdb/vdb-valkey/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[project]
name = "dify-vdb-valkey"
version = "0.0.1"

dependencies = [
"valkey-glide>=1.3.0",
]
description = "Dify vector store backend (dify-vdb-valkey)."

[project.entry-points."dify.vector_backends"]
valkey = "dify_vdb_valkey.valkey_vector:ValkeyVectorFactory"

[tool.setuptools.packages.find]
where = ["src"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading