mem0ai--mem0
555e282cc4
pi-agent-plugin checks / lint (push) Has been cancelled
pi-agent-plugin checks / test (20) (push) Has been cancelled
pi-agent-plugin checks / test (22) (push) Has been cancelled
pi-agent-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / check_changes (push) Has been cancelled
TypeScript SDK CI / changelog_check (push) Has been cancelled
ci / changelog_check (push) Has been cancelled
ci / check_changes (push) Has been cancelled
ci / build_mem0 (3.10) (push) Has been cancelled
ci / build_mem0 (3.11) (push) Has been cancelled
ci / build_mem0 (3.12) (push) Has been cancelled
CLI Node CI / lint (push) Has been cancelled
CLI Node CI / test (20) (push) Has been cancelled
CLI Node CI / test (22) (push) Has been cancelled
CLI Node CI / build (push) Has been cancelled
CLI Python CI / lint (push) Has been cancelled
CLI Python CI / test (3.10) (push) Has been cancelled
CLI Python CI / test (3.11) (push) Has been cancelled
CLI Python CI / test (3.12) (push) Has been cancelled
CLI Python CI / build (push) Has been cancelled
openclaw checks / lint (push) Has been cancelled
openclaw checks / test (20) (push) Has been cancelled
openclaw checks / test (22) (push) Has been cancelled
openclaw checks / build (push) Has been cancelled
opencode-plugin checks / build (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / build_ts_sdk (22) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (20) (push) Has been cancelled
TypeScript SDK CI / integration_ts_sdk (22) (push) Has been cancelled
33 行
1.6 KiB
Python
33 行
1.6 KiB
Python
from typing import Any, Dict
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field, model_validator
|
|
|
|
|
|
class ValkeyConfig(BaseModel):
|
|
"""Configuration for Valkey vector store."""
|
|
|
|
valkey_url: str = Field(..., description="Valkey server URL (e.g., redis://localhost:6379)")
|
|
collection_name: str = Field(..., description="Name of the index / collection")
|
|
embedding_model_dims: int = Field(..., description="Dimensions of the embedding model")
|
|
timezone: str = Field("UTC", description="Timezone for timestamp handling")
|
|
index_type: str = Field("hnsw", description="Index type: 'hnsw' (default) or 'flat'")
|
|
hnsw_m: int = Field(16, description="HNSW: number of connections per layer")
|
|
hnsw_ef_construction: int = Field(200, description="HNSW: search width during index construction")
|
|
hnsw_ef_runtime: int = Field(10, description="HNSW: search width during queries")
|
|
cluster_mode: bool = Field(False, description="Enable cluster mode for Valkey cluster (CME) deployments")
|
|
|
|
@model_validator(mode="before")
|
|
@classmethod
|
|
def validate_extra_fields(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
|
allowed_fields = set(cls.model_fields.keys())
|
|
input_fields = set(values.keys())
|
|
extra_fields = input_fields - allowed_fields
|
|
if extra_fields:
|
|
raise ValueError(
|
|
f"Extra fields not allowed: {', '.join(extra_fields)}. "
|
|
f"Please input only the following fields: {', '.join(allowed_fields)}"
|
|
)
|
|
return values
|
|
|
|
model_config = ConfigDict(arbitrary_types_allowed=False)
|