diff --git a/mem0/configs/vector_stores/elasticsearch.py b/mem0/configs/vector_stores/elasticsearch.py index ed12d8625d..03bddcb8c4 100644 --- a/mem0/configs/vector_stores/elasticsearch.py +++ b/mem0/configs/vector_stores/elasticsearch.py @@ -29,7 +29,7 @@ def validate_auth(cls, values: Dict[str, Any]) -> Dict[str, Any]: raise ValueError("Either cloud_id or host must be provided") # Check if authentication is provided - if not any([values.get("api_key"), (values.get("user") and values.get("password"))]): + if not (values.get("api_key") or (values.get("user") and values.get("password"))): raise ValueError("Either api_key or user/password must be provided") return values @@ -43,12 +43,12 @@ def validate_headers(cls, values: Dict[str, Any]) -> Dict[str, Any]: # Check if headers is a dictionary if not isinstance(headers, dict): raise ValueError("headers must be a dictionary") - + # Check if all keys and values are strings for key, value in headers.items(): if not isinstance(key, str) or not isinstance(value, str): raise ValueError("All header keys and values must be strings") - + return values @model_validator(mode="before")