Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate: Added deprecations for methods superseded by query_points #843

Merged
merged 2 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
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
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
Loading