From 2cd8214deba9afbda7fe3efdd9ba003e010945d4 Mon Sep 17 00:00:00 2001 From: Andrey Vasnetsov Date: Mon, 7 Oct 2024 23:35:55 +0200 Subject: [PATCH] make api names consistent with grpc + fix a BUG (#805) --- qdrant_client/async_client_base.py | 4 +- qdrant_client/async_qdrant_client.py | 8 +- qdrant_client/async_qdrant_remote.py | 12 +- qdrant_client/client_base.py | 8 +- qdrant_client/http/api/points_api.py | 144 +++++++++--------- qdrant_client/local/async_qdrant_local.py | 8 +- qdrant_client/local/local_collection.py | 14 +- qdrant_client/local/qdrant_local.py | 18 ++- qdrant_client/qdrant_client.py | 8 +- qdrant_client/qdrant_remote.py | 12 +- .../test_search_distance_matrix.py | 40 +++-- 11 files changed, 146 insertions(+), 130 deletions(-) diff --git a/qdrant_client/async_client_base.py b/qdrant_client/async_client_base.py index 1d254245..a4405bc4 100644 --- a/qdrant_client/async_client_base.py +++ b/qdrant_client/async_client_base.py @@ -67,7 +67,7 @@ async def search_groups( ) -> types.GroupsResult: raise NotImplementedError() - async def search_distance_matrix_offsets( + async def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -78,7 +78,7 @@ async def search_distance_matrix_offsets( ) -> types.SearchMatrixOffsetsResponse: raise NotImplementedError() - async def search_distance_matrix_pairs( + async def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, diff --git a/qdrant_client/async_qdrant_client.py b/qdrant_client/async_qdrant_client.py index caf2e8f7..de91e143 100644 --- a/qdrant_client/async_qdrant_client.py +++ b/qdrant_client/async_qdrant_client.py @@ -912,7 +912,7 @@ async def recommend( **kwargs, ) - async def search_distance_matrix_pairs( + async def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -946,7 +946,7 @@ async def search_distance_matrix_pairs( Return distance matrix using a pair-based encoding. """ assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}" - return await self._client.search_distance_matrix_pairs( + return await self._client.search_matrix_pairs( collection_name=collection_name, query_filter=query_filter, limit=limit, @@ -958,7 +958,7 @@ async def search_distance_matrix_pairs( **kwargs, ) - async def search_distance_matrix_offsets( + async def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -992,7 +992,7 @@ async def search_distance_matrix_offsets( Return distance matrix using an offset-based encoding. """ assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}" - return await self._client.search_distance_matrix_offsets( + return await self._client.search_matrix_offsets( collection_name=collection_name, query_filter=query_filter, limit=limit, diff --git a/qdrant_client/async_qdrant_remote.py b/qdrant_client/async_qdrant_remote.py index 394ddf8c..891e52d0 100644 --- a/qdrant_client/async_qdrant_remote.py +++ b/qdrant_client/async_qdrant_remote.py @@ -829,7 +829,7 @@ async def search_groups( ) ).result - async def search_distance_matrix_pairs( + async def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -863,9 +863,9 @@ async def search_distance_matrix_pairs( ) return GrpcToRest.convert_search_matrix_pairs(response.result) if isinstance(query_filter, grpc.Filter): - search_filter = GrpcToRest.convert_filter(model=query_filter) + query_filter = GrpcToRest.convert_filter(model=query_filter) search_matrix_result = ( - await self.openapi_client.points_api.search_points_matrix_pairs( + await self.openapi_client.points_api.search_matrix_pairs( collection_name=collection_name, consistency=consistency, timeout=timeout, @@ -881,7 +881,7 @@ async def search_distance_matrix_pairs( assert search_matrix_result is not None, "Search matrix pairs returned None result" return search_matrix_result - async def search_distance_matrix_offsets( + async def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -915,9 +915,9 @@ async def search_distance_matrix_offsets( ) return GrpcToRest.convert_search_matrix_offsets(response.result) if isinstance(query_filter, grpc.Filter): - search_filter = GrpcToRest.convert_filter(model=query_filter) + query_filter = GrpcToRest.convert_filter(model=query_filter) search_matrix_result = ( - await self.openapi_client.points_api.search_points_matrix_offsets( + await self.openapi_client.points_api.search_matrix_offsets( collection_name=collection_name, consistency=consistency, timeout=timeout, diff --git a/qdrant_client/client_base.py b/qdrant_client/client_base.py index d0ee9ca2..a2af5430 100644 --- a/qdrant_client/client_base.py +++ b/qdrant_client/client_base.py @@ -60,7 +60,7 @@ def search_groups( ) -> types.GroupsResult: raise NotImplementedError() - def search_distance_matrix_offsets( + def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -69,9 +69,9 @@ def search_distance_matrix_offsets( using: Optional[str] = None, **kwargs: Any, ) -> types.SearchMatrixOffsetsResponse: - raise NotImplementedError() + raise NotImplementedError() - def search_distance_matrix_pairs( + def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -80,7 +80,7 @@ def search_distance_matrix_pairs( using: Optional[str] = None, **kwargs: Any, ) -> types.SearchMatrixPairsResponse: - raise NotImplementedError() + raise NotImplementedError() def query_batch_points( self, diff --git a/qdrant_client/http/api/points_api.py b/qdrant_client/http/api/points_api.py index 4b5a8625..415ffcdb 100644 --- a/qdrant_client/http/api/points_api.py +++ b/qdrant_client/http/api/points_api.py @@ -723,15 +723,15 @@ def _build_for_search_batch_points( content=body, ) - def _build_for_search_point_groups( + def _build_for_search_matrix_offsets( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_groups_request: m.SearchGroupsRequest = None, + search_matrix_request: m.SearchMatrixRequest = None, ): """ - Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field + Compute distance matrix for sampled points with an offset based output format """ path_params = { "collection_name": str(collection_name), @@ -744,28 +744,28 @@ def _build_for_search_point_groups( query_params["timeout"] = str(timeout) headers = {} - body = jsonable_encoder(search_groups_request) + body = jsonable_encoder(search_matrix_request) if "Content-Type" not in headers: headers["Content-Type"] = "application/json" return self.api_client.request( - type_=m.InlineResponse20018, + type_=m.InlineResponse20024, method="POST", - url="/collections/{collection_name}/points/search/groups", + url="/collections/{collection_name}/points/search/matrix/offsets", headers=headers if headers else None, path_params=path_params, params=query_params, content=body, ) - def _build_for_search_points( + def _build_for_search_matrix_pairs( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_request: m.SearchRequest = None, + search_matrix_request: m.SearchMatrixRequest = None, ): """ - Retrieve closest points based on vector similarity and given filtering conditions + Compute distance matrix for sampled points with a pair based output format """ path_params = { "collection_name": str(collection_name), @@ -778,28 +778,28 @@ def _build_for_search_points( query_params["timeout"] = str(timeout) headers = {} - body = jsonable_encoder(search_request) + body = jsonable_encoder(search_matrix_request) if "Content-Type" not in headers: headers["Content-Type"] = "application/json" return self.api_client.request( - type_=m.InlineResponse20016, + type_=m.InlineResponse20023, method="POST", - url="/collections/{collection_name}/points/search", + url="/collections/{collection_name}/points/search/matrix/pairs", headers=headers if headers else None, path_params=path_params, params=query_params, content=body, ) - def _build_for_search_points_matrix_offsets( + def _build_for_search_point_groups( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, + search_groups_request: m.SearchGroupsRequest = None, ): """ - Compute distance matrix for sampled points with an offset based output format + Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field """ path_params = { "collection_name": str(collection_name), @@ -812,28 +812,28 @@ def _build_for_search_points_matrix_offsets( query_params["timeout"] = str(timeout) headers = {} - body = jsonable_encoder(search_matrix_request) + body = jsonable_encoder(search_groups_request) if "Content-Type" not in headers: headers["Content-Type"] = "application/json" return self.api_client.request( - type_=m.InlineResponse20024, + type_=m.InlineResponse20018, method="POST", - url="/collections/{collection_name}/points/search/matrix/offsets", + url="/collections/{collection_name}/points/search/groups", headers=headers if headers else None, path_params=path_params, params=query_params, content=body, ) - def _build_for_search_points_matrix_pairs( + def _build_for_search_points( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, + search_request: m.SearchRequest = None, ): """ - Compute distance matrix for sampled points with a pair based output format + Retrieve closest points based on vector similarity and given filtering conditions """ path_params = { "collection_name": str(collection_name), @@ -846,13 +846,13 @@ def _build_for_search_points_matrix_pairs( query_params["timeout"] = str(timeout) headers = {} - body = jsonable_encoder(search_matrix_request) + body = jsonable_encoder(search_request) if "Content-Type" not in headers: headers["Content-Type"] = "application/json" return self.api_client.request( - type_=m.InlineResponse20023, + type_=m.InlineResponse20016, method="POST", - url="/collections/{collection_name}/points/search/matrix/pairs", + url="/collections/{collection_name}/points/search", headers=headers if headers else None, path_params=path_params, params=query_params, @@ -1299,72 +1299,72 @@ async def search_batch_points( search_request_batch=search_request_batch, ) - async def search_point_groups( + async def search_matrix_offsets( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_groups_request: m.SearchGroupsRequest = None, - ) -> m.InlineResponse20018: + search_matrix_request: m.SearchMatrixRequest = None, + ) -> m.InlineResponse20024: """ - Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field + Compute distance matrix for sampled points with an offset based output format """ - return await self._build_for_search_point_groups( + return await self._build_for_search_matrix_offsets( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_groups_request=search_groups_request, + search_matrix_request=search_matrix_request, ) - async def search_points( + async def search_matrix_pairs( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_request: m.SearchRequest = None, - ) -> m.InlineResponse20016: + search_matrix_request: m.SearchMatrixRequest = None, + ) -> m.InlineResponse20023: """ - Retrieve closest points based on vector similarity and given filtering conditions + Compute distance matrix for sampled points with a pair based output format """ - return await self._build_for_search_points( + return await self._build_for_search_matrix_pairs( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_request=search_request, + search_matrix_request=search_matrix_request, ) - async def search_points_matrix_offsets( + async def search_point_groups( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, - ) -> m.InlineResponse20024: + search_groups_request: m.SearchGroupsRequest = None, + ) -> m.InlineResponse20018: """ - Compute distance matrix for sampled points with an offset based output format + Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field """ - return await self._build_for_search_points_matrix_offsets( + return await self._build_for_search_point_groups( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_matrix_request=search_matrix_request, + search_groups_request=search_groups_request, ) - async def search_points_matrix_pairs( + async def search_points( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, - ) -> m.InlineResponse20023: + search_request: m.SearchRequest = None, + ) -> m.InlineResponse20016: """ - Compute distance matrix for sampled points with a pair based output format + Retrieve closest points based on vector similarity and given filtering conditions """ - return await self._build_for_search_points_matrix_pairs( + return await self._build_for_search_points( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_matrix_request=search_matrix_request, + search_request=search_request, ) async def set_payload( @@ -1756,72 +1756,72 @@ def search_batch_points( search_request_batch=search_request_batch, ) - def search_point_groups( + def search_matrix_offsets( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_groups_request: m.SearchGroupsRequest = None, - ) -> m.InlineResponse20018: + search_matrix_request: m.SearchMatrixRequest = None, + ) -> m.InlineResponse20024: """ - Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field + Compute distance matrix for sampled points with an offset based output format """ - return self._build_for_search_point_groups( + return self._build_for_search_matrix_offsets( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_groups_request=search_groups_request, + search_matrix_request=search_matrix_request, ) - def search_points( + def search_matrix_pairs( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_request: m.SearchRequest = None, - ) -> m.InlineResponse20016: + search_matrix_request: m.SearchMatrixRequest = None, + ) -> m.InlineResponse20023: """ - Retrieve closest points based on vector similarity and given filtering conditions + Compute distance matrix for sampled points with a pair based output format """ - return self._build_for_search_points( + return self._build_for_search_matrix_pairs( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_request=search_request, + search_matrix_request=search_matrix_request, ) - def search_points_matrix_offsets( + def search_point_groups( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, - ) -> m.InlineResponse20024: + search_groups_request: m.SearchGroupsRequest = None, + ) -> m.InlineResponse20018: """ - Compute distance matrix for sampled points with an offset based output format + Retrieve closest points based on vector similarity and given filtering conditions, grouped by a given payload field """ - return self._build_for_search_points_matrix_offsets( + return self._build_for_search_point_groups( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_matrix_request=search_matrix_request, + search_groups_request=search_groups_request, ) - def search_points_matrix_pairs( + def search_points( self, collection_name: str, consistency: m.ReadConsistency = None, timeout: int = None, - search_matrix_request: m.SearchMatrixRequest = None, - ) -> m.InlineResponse20023: + search_request: m.SearchRequest = None, + ) -> m.InlineResponse20016: """ - Compute distance matrix for sampled points with a pair based output format + Retrieve closest points based on vector similarity and given filtering conditions """ - return self._build_for_search_points_matrix_pairs( + return self._build_for_search_points( collection_name=collection_name, consistency=consistency, timeout=timeout, - search_matrix_request=search_matrix_request, + search_request=search_request, ) def set_payload( diff --git a/qdrant_client/local/async_qdrant_local.py b/qdrant_client/local/async_qdrant_local.py index 3dfc2ab1..d6186712 100644 --- a/qdrant_client/local/async_qdrant_local.py +++ b/qdrant_client/local/async_qdrant_local.py @@ -208,7 +208,7 @@ async def search( score_threshold=score_threshold, ) - async def search_distance_matrix_offsets( + async def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -218,11 +218,11 @@ async def search_distance_matrix_offsets( **kwargs: Any, ) -> types.SearchMatrixOffsetsResponse: collection = self._get_collection(collection_name) - return collection.search_distance_matrix_offsets( + return collection.search_matrix_offsets( query_filter=query_filter, limit=limit, sample=sample, using=using ) - async def search_distance_matrix_pairs( + async def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -232,7 +232,7 @@ async def search_distance_matrix_pairs( **kwargs: Any, ) -> types.SearchMatrixPairsResponse: collection = self._get_collection(collection_name) - return collection.search_distance_matrix_pairs( + return collection.search_matrix_pairs( query_filter=query_filter, limit=limit, sample=sample, using=using ) diff --git a/qdrant_client/local/local_collection.py b/qdrant_client/local/local_collection.py index 9666c1b9..bef5bbee 100644 --- a/qdrant_client/local/local_collection.py +++ b/qdrant_client/local/local_collection.py @@ -1455,7 +1455,7 @@ def recommend_groups( with_lookup_collection=with_lookup_collection, ) - def search_distance_matrix_offsets( + def search_matrix_offsets( self, query_filter: Optional[types.Filter] = None, limit: int = 3, @@ -1489,7 +1489,7 @@ def search_distance_matrix_offsets( ids=ids, ) - def search_distance_matrix_pairs( + def search_matrix_pairs( self, query_filter: Optional[types.Filter] = None, limit: int = 3, @@ -1503,10 +1503,8 @@ def search_distance_matrix_pairs( for sample_id, sample_scores in list(zip(ids, all_scores)): for sample_score in sample_scores: pairs.append( - types.SearchMatrixPair( - a=sample_id, - b=sample_score.id, - score=sample_score.score + types.SearchMatrixPair( + a=sample_id, b=sample_score.id, score=sample_score.score ) ) @@ -1525,7 +1523,9 @@ def _search_distance_matrix( search_in_vector_name = using if using is not None else DEFAULT_VECTOR_NAME # Sample random points from the whole collection to filter out the ones without vectors # TODO: use search_filter once with have an HasVector like condition - candidates = self._sample_randomly(len(self.ids), query_filter, False, search_in_vector_name) + candidates = self._sample_randomly( + len(self.ids), query_filter, False, search_in_vector_name + ) for candidate in candidates: # check if enough samples are collected if len(samples) == sample: diff --git a/qdrant_client/local/qdrant_local.py b/qdrant_client/local/qdrant_local.py index d6a93015..2cc86395 100644 --- a/qdrant_client/local/qdrant_local.py +++ b/qdrant_client/local/qdrant_local.py @@ -211,7 +211,7 @@ def search( score_threshold=score_threshold, ) - def search_distance_matrix_offsets( + def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -221,9 +221,11 @@ def search_distance_matrix_offsets( **kwargs: Any, ) -> types.SearchMatrixOffsetsResponse: collection = self._get_collection(collection_name) - return collection.search_distance_matrix_offsets(query_filter=query_filter, limit=limit, sample=sample, using=using) + return collection.search_matrix_offsets( + query_filter=query_filter, limit=limit, sample=sample, using=using + ) - def search_distance_matrix_pairs( + def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -233,7 +235,9 @@ def search_distance_matrix_pairs( **kwargs: Any, ) -> types.SearchMatrixPairsResponse: collection = self._get_collection(collection_name) - return collection.search_distance_matrix_pairs(query_filter=query_filter, limit=limit, sample=sample, using=using) + return collection.search_matrix_pairs( + query_filter=query_filter, limit=limit, sample=sample, using=using + ) def search_groups( self, @@ -394,7 +398,11 @@ def _resolve_prefetches_input( elif isinstance(prefetch, Sequence): prefetches = list(prefetch) - return [self._resolve_prefetch_input(prefetch, collection_name) for prefetch in prefetches if prefetch is not None] + return [ + self._resolve_prefetch_input(prefetch, collection_name) + for prefetch in prefetches + if prefetch is not None + ] def _resolve_prefetch_input( self, prefetch: types.Prefetch, collection_name: str diff --git a/qdrant_client/qdrant_client.py b/qdrant_client/qdrant_client.py index f2b60c28..75568350 100644 --- a/qdrant_client/qdrant_client.py +++ b/qdrant_client/qdrant_client.py @@ -971,7 +971,7 @@ def recommend( **kwargs, ) - def search_distance_matrix_pairs( + def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -1006,7 +1006,7 @@ def search_distance_matrix_pairs( """ assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}" - return self._client.search_distance_matrix_pairs( + return self._client.search_matrix_pairs( collection_name=collection_name, query_filter=query_filter, limit=limit, @@ -1018,7 +1018,7 @@ def search_distance_matrix_pairs( **kwargs, ) - def search_distance_matrix_offsets( + def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -1053,7 +1053,7 @@ def search_distance_matrix_offsets( """ assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}" - return self._client.search_distance_matrix_offsets( + return self._client.search_matrix_offsets( collection_name=collection_name, query_filter=query_filter, limit=limit, diff --git a/qdrant_client/qdrant_remote.py b/qdrant_client/qdrant_remote.py index 837e5f44..ebf4cb50 100644 --- a/qdrant_client/qdrant_remote.py +++ b/qdrant_client/qdrant_remote.py @@ -1045,7 +1045,7 @@ def search_groups( timeout=timeout, ).result - def search_distance_matrix_pairs( + def search_matrix_pairs( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -1083,9 +1083,9 @@ def search_distance_matrix_pairs( return GrpcToRest.convert_search_matrix_pairs(response.result) if isinstance(query_filter, grpc.Filter): - search_filter = GrpcToRest.convert_filter(model=query_filter) + query_filter = GrpcToRest.convert_filter(model=query_filter) - search_matrix_result = self.openapi_client.points_api.search_points_matrix_pairs( + search_matrix_result = self.openapi_client.points_api.search_matrix_pairs( collection_name=collection_name, consistency=consistency, timeout=timeout, @@ -1101,7 +1101,7 @@ def search_distance_matrix_pairs( return search_matrix_result - def search_distance_matrix_offsets( + def search_matrix_offsets( self, collection_name: str, query_filter: Optional[types.Filter] = None, @@ -1139,9 +1139,9 @@ def search_distance_matrix_offsets( return GrpcToRest.convert_search_matrix_offsets(response.result) if isinstance(query_filter, grpc.Filter): - search_filter = GrpcToRest.convert_filter(model=query_filter) + query_filter = GrpcToRest.convert_filter(model=query_filter) - search_matrix_result = self.openapi_client.points_api.search_points_matrix_offsets( + search_matrix_result = self.openapi_client.points_api.search_matrix_offsets( collection_name=collection_name, consistency=consistency, timeout=timeout, diff --git a/tests/congruence_tests/test_search_distance_matrix.py b/tests/congruence_tests/test_search_distance_matrix.py index 1bbbf731..7a2a2e79 100644 --- a/tests/congruence_tests/test_search_distance_matrix.py +++ b/tests/congruence_tests/test_search_distance_matrix.py @@ -17,6 +17,7 @@ # to keep the test deterministic we sample all the points available TEST_NUM_POINTS = 100 + @pytest.fixture(scope="module") def fixture_points() -> List[models.PointStruct]: return generate_fixtures(num=TEST_NUM_POINTS) @@ -52,13 +53,14 @@ def compare_all_clients_results( compare_client_results(local_client, http_client, foo, **kwargs) compare_client_results(http_client, grpc_client, foo, **kwargs) + def test_search_offsets_no_filter( local_client, http_client, grpc_client, ): def search_offsets_no_filter(client: QdrantBase) -> models.SearchMatrixOffsetsResponse: - return client.search_distance_matrix_offsets( + return client.search_matrix_offsets( collection_name=COLLECTION_NAME, sample=TEST_NUM_POINTS, limit=3, @@ -69,12 +71,12 @@ def search_offsets_no_filter(client: QdrantBase) -> models.SearchMatrixOffsetsRe def test_search_pairs_no_filter( - local_client, - http_client, - grpc_client, + local_client, + http_client, + grpc_client, ): def search_pairs_no_filter(client: QdrantBase) -> models.SearchMatrixPairsResponse: - return client.search_distance_matrix_pairs( + return client.search_matrix_pairs( collection_name=COLLECTION_NAME, sample=TEST_NUM_POINTS, limit=3, @@ -83,13 +85,16 @@ def search_pairs_no_filter(client: QdrantBase) -> models.SearchMatrixPairsRespon compare_all_clients_results(local_client, http_client, grpc_client, search_pairs_no_filter) + def test_search_offsets_filter( - local_client, - http_client, - grpc_client, + local_client, + http_client, + grpc_client, ): - def search_offsets_filter(client: QdrantBase, query_filter: models.Filter) -> models.SearchMatrixOffsetsResponse: - return client.search_distance_matrix_offsets( + def search_offsets_filter( + client: QdrantBase, query_filter: models.Filter + ) -> models.SearchMatrixOffsetsResponse: + return client.search_matrix_offsets( collection_name=COLLECTION_NAME, sample=TEST_NUM_POINTS, limit=3, @@ -111,13 +116,16 @@ def search_offsets_filter(client: QdrantBase, query_filter: models.Filter) -> mo print(f"\nAttempt {i} failed with filter {query_filter}") raise e + def test_search_pairs_filter( - local_client, - http_client, - grpc_client, + local_client, + http_client, + grpc_client, ): - def search_pairs_filter(client: QdrantBase, query_filter: models.Filter) -> models.SearchMatrixPairsResponse: - return client.search_distance_matrix_pairs( + def search_pairs_filter( + client: QdrantBase, query_filter: models.Filter + ) -> models.SearchMatrixPairsResponse: + return client.search_matrix_pairs( collection_name=COLLECTION_NAME, sample=TEST_NUM_POINTS, limit=3, @@ -137,4 +145,4 @@ def search_pairs_filter(client: QdrantBase, query_filter: models.Filter) -> mode ) except AssertionError as e: print(f"\nAttempt {i} failed with filter {query_filter}") - raise e \ No newline at end of file + raise e