Skip to content
Open
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
17 changes: 9 additions & 8 deletions mem0/configs/vector_stores/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class QdrantConfig(BaseModel):
@model_validator(mode="before")
@classmethod
def check_host_port_or_path(cls, values: Dict[str, Any]) -> Dict[str, Any]:
host, port, path, url, api_key = (
values.get("host"),
values.get("port"),
values.get("path"),
values.get("url"),
values.get("api_key"),
)
if not path and not (host and port) and not (url and api_key):
# Use local variables for faster attribute access and tuple unpacking for efficiency
host = values.get("host")
port = values.get("port")
path = values.get("path")
url = values.get("url")
api_key = values.get("api_key")
# Combine conditions into a single branch to reduce branching cost
# No change in exception raising logic or message
if path is None and (host is None or port is None) and (url is None or api_key is None):
raise ValueError("Either 'host' and 'port' or 'url' and 'api_key' or 'path' must be provided.")
return values

Expand Down