From f5fb4364fa59f8b84f2161c853be29373402e26f Mon Sep 17 00:00:00 2001 From: Sergio Wilson Date: Thu, 15 Aug 2024 20:23:34 -0500 Subject: [PATCH 1/2] Introduce path member in pgvector.py to account for pydantic validation --- mem0/configs/vector_stores/pgvector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mem0/configs/vector_stores/pgvector.py b/mem0/configs/vector_stores/pgvector.py index 839e707faf..172dc1bbf3 100644 --- a/mem0/configs/vector_stores/pgvector.py +++ b/mem0/configs/vector_stores/pgvector.py @@ -14,6 +14,9 @@ class PGVectorConfig(BaseModel): password: Optional[str] = Field(None, description="Database password") host: Optional[str] = Field(None, description="Database host. Default is localhost") port: Optional[int] = Field(None, description="Database port. Default is 1536") + path: Optional[str] = Field( + "/tmp/pgvector", description="Path for local Qdrant database" + ) @model_validator(mode="before") def check_auth_and_connection(cls, values): From 4e0a4fd3661247abdc0d42f7f4f696cc52499911 Mon Sep 17 00:00:00 2001 From: Sergio Wilson Date: Tue, 10 Dec 2024 15:56:12 -0600 Subject: [PATCH 2/2] Rectify pgvector.py --- mem0/configs/vector_stores/pgvector.py | 7 ------- 1 file changed, 7 deletions(-) diff --git a/mem0/configs/vector_stores/pgvector.py b/mem0/configs/vector_stores/pgvector.py index 172dc1bbf3..58e51335df 100644 --- a/mem0/configs/vector_stores/pgvector.py +++ b/mem0/configs/vector_stores/pgvector.py @@ -14,9 +14,6 @@ class PGVectorConfig(BaseModel): password: Optional[str] = Field(None, description="Database password") host: Optional[str] = Field(None, description="Database host. Default is localhost") port: Optional[int] = Field(None, description="Database port. Default is 1536") - path: Optional[str] = Field( - "/tmp/pgvector", description="Path for local Qdrant database" - ) @model_validator(mode="before") def check_auth_and_connection(cls, values): @@ -34,8 +31,4 @@ 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)}. Please input only the following fields: {', '.join(allowed_fields)}" - ) return values