Skip to content

Commit

Permalink
address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffchuber committed Feb 20, 2023
1 parent 73801e8 commit 2678df8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions chromadb/db/clickhouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,15 +446,15 @@ def get_nearest_neighbors(
collection_uuid=None,
) -> Tuple[List[List[uuid.UUID]], List[List[float]]]:

# Either the collection name or the collection uuid must be provided
if collection_name == None and collection_uuid == None:
raise TypeError("Arguments collection_name and collection_uuid cannot both be None")

if collection_name is not None:
collection_uuid = self.get_collection_uuid_from_name(collection_name)

self._idx.load_if_not_loaded(collection_uuid)

# Either the collection name or the collection uuid must be provided
if collection_name == None and collection_uuid == None:
raise TypeError("Arguments collection_name and collection_uuid cannot both be None")

idx_metadata = self._idx.get_metadata()
# Check query embeddings dimensionality
if idx_metadata["dimensionality"] != len(embeddings[0]):
Expand Down
6 changes: 5 additions & 1 deletion chromadb/test/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def local_persist_api():
)
)

# https://docs.pytest.org/en/6.2.x/fixture.html#fixtures-can-be-requested-more-than-once-per-test-return-values-are-cached
@pytest.fixture
def local_persist_api_cache_bust():
return chromadb.Client(
Expand Down Expand Up @@ -115,7 +116,10 @@ def test_persist_index_loading(api_fixture, request):

api2 = request.getfixturevalue("local_persist_api_cache_bust")
collection = api2.get_collection('test')
collection.query(query_texts="hello", n_results=1)

nn = collection.query(query_texts="hello", n_results=1)
for key in nn.keys():
assert len(nn[key]) == 1


@pytest.mark.parametrize("api_fixture", [local_persist_api])
Expand Down

0 comments on commit 2678df8

Please sign in to comment.