Skip to content

Commit

Permalink
Update to handle empty filter dict
Browse files Browse the repository at this point in the history
  • Loading branch information
Georgehe4 committed Nov 1, 2024
1 parent 13cc213 commit 0494e93
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chromadb/api/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,8 +594,8 @@ def validate_where(where: Where) -> None:
"""
if not isinstance(where, dict):
raise ValueError(f"Expected where to be a dict, got {where}")
if len(where) != 1:
raise ValueError(f"Expected where to have exactly one operator, got {where}")
if len(where) > 1:
raise ValueError(f"Expected where to have at most one operator, got {where}")
for key, value in where.items():
if not isinstance(key, str):
raise ValueError(f"Expected where key to be a str, got {key}")
Expand Down
4 changes: 2 additions & 2 deletions chromadb/segment/impl/metadata/grpc_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,9 @@ def _where_to_proto(self, where: Optional[Where]) -> pb.Where:
response = pb.Where()
if where is None:
return response
if len(where) != 1:
if len(where) > 1:
raise ValueError(
f"Expected where to have exactly one operator, got {where}"
f"Expected where to have at most one operator, got {where}"
)

for key, value in where.items():
Expand Down

0 comments on commit 0494e93

Please sign in to comment.