Skip to content

Commit

Permalink
deprecate: Added deprecations for methods superseded by query_points (#…
Browse files Browse the repository at this point in the history
…843)

* deprecate: Added deprecations for methods superseded by query_points

* deprecate: Undeprecate search_matrix_offsets and search_matrix_pairs
  • Loading branch information
hh-space-invader authored and joein committed Jan 16, 2025
1 parent 8507d65 commit 7e579dc
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 6 deletions.
40 changes: 40 additions & 0 deletions qdrant_client/async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ async def search_batch(
List of search responses
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`search_batch` method is deprecated and will be removed in the future. Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.search_batch(
collection_name=collection_name,
requests=requests,
Expand Down Expand Up @@ -347,6 +352,11 @@ async def search(
List of found close points with similarity scores.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`search` method is deprecated and will be removed in the future. Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.search(
collection_name=collection_name,
query_vector=query_vector,
Expand Down Expand Up @@ -763,6 +773,11 @@ async def search_groups(
Each group also contains an id of the group, which is the value of the payload field.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`search_groups` method is deprecated and will be removed in the future. Use `query_points_groups` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.search_groups(
collection_name=collection_name,
query_vector=query_vector,
Expand Down Expand Up @@ -808,6 +823,11 @@ async def recommend_batch(
List of recommend responses
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`recommend_batch` method is deprecated and will be removed in the future. Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.recommend_batch(
collection_name=collection_name,
requests=requests,
Expand Down Expand Up @@ -910,6 +930,11 @@ async def recommend(
List of recommended points with similarity scores.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`recommend` method is deprecated and will be removed in the future. Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.recommend(
collection_name=collection_name,
positive=positive,
Expand Down Expand Up @@ -1127,6 +1152,11 @@ async def recommend_groups(
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
warnings.warn(
"`recommend_groups` method is deprecated and will be removed in the future. Use `query_points_groups` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.recommend_groups(
collection_name=collection_name,
group_by=group_by,
Expand Down Expand Up @@ -1229,6 +1259,11 @@ async def discover(
Returns:
List of discovered points with discovery or context scores, accordingly.
"""
warnings.warn(
"`discover` method is deprecated and will be removed in the future. Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.discover(
collection_name=collection_name,
target=target,
Expand All @@ -1255,6 +1290,11 @@ async def discover_batch(
timeout: Optional[int] = None,
**kwargs: Any,
) -> List[List[types.ScoredPoint]]:
warnings.warn(
"`discover_batch` method is deprecated and will be removed in the future. Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return await self._client.discover_batch(
collection_name=collection_name,
requests=requests,
Expand Down
54 changes: 48 additions & 6 deletions qdrant_client/qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,12 @@ def search_batch(
List of search responses
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`search_batch` method is deprecated and will be removed in the future."
" Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.search_batch(
collection_name=collection_name,
requests=requests,
Expand Down Expand Up @@ -393,7 +398,12 @@ def search(
List of found close points with similarity scores.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`search` method is deprecated and will be removed in the future."
" Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.search(
collection_name=collection_name,
query_vector=query_vector,
Expand Down Expand Up @@ -822,7 +832,12 @@ def search_groups(
Each group also contains an id of the group, which is the value of the payload field.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`search_groups` method is deprecated and will be removed in the future."
" Use `query_points_groups` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.search_groups(
collection_name=collection_name,
query_vector=query_vector,
Expand Down Expand Up @@ -868,7 +883,12 @@ def recommend_batch(
List of recommend responses
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`recommend_batch` method is deprecated and will be removed in the future."
" Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.recommend_batch(
collection_name=collection_name,
requests=requests,
Expand Down Expand Up @@ -971,7 +991,12 @@ def recommend(
List of recommended points with similarity scores.
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`recommend` method is deprecated and will be removed in the future."
" Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.recommend(
collection_name=collection_name,
positive=positive,
Expand Down Expand Up @@ -1193,7 +1218,12 @@ def recommend_groups(
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"

warnings.warn(
"`recommend_groups` method is deprecated and will be removed in the future."
" Use `query_points_groups` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.recommend_groups(
collection_name=collection_name,
group_by=group_by,
Expand Down Expand Up @@ -1296,6 +1326,12 @@ def discover(
Returns:
List of discovered points with discovery or context scores, accordingly.
"""
warnings.warn(
"`discover` method is deprecated and will be removed in the future."
" Use `query_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.discover(
collection_name=collection_name,
target=target,
Expand All @@ -1322,6 +1358,12 @@ def discover_batch(
timeout: Optional[int] = None,
**kwargs: Any,
) -> List[List[types.ScoredPoint]]:
warnings.warn(
"`discover_batch` method is deprecated and will be removed in the future."
" Use `query_batch_points` instead.",
DeprecationWarning,
stacklevel=2,
)
return self._client.discover_batch(
collection_name=collection_name,
requests=requests,
Expand Down

0 comments on commit 7e579dc

Please sign in to comment.