Skip to content

Commit

Permalink
Change upload points async (#730)
Browse files Browse the repository at this point in the history
* made upload_points sync

* updated base_client_generator

* fix: remove excess file

* refactoring: fix timeout type, remove redundant import

---------

Co-authored-by: George Panchuk <george.panchuk@qdrant.tech>
  • Loading branch information
hh-space-invader and joein committed Aug 12, 2024
1 parent 42eb0a6 commit 00bcc68
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion qdrant_client/async_client_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def upload_records(
) -> None:
raise NotImplementedError()

async def upload_points(
def upload_points(
self, collection_name: str, points: Iterable[types.PointStruct], **kwargs: Any
) -> None:
raise NotImplementedError()
Expand Down
4 changes: 2 additions & 2 deletions qdrant_client/async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ def upload_records(
shard_key_selector=shard_key_selector,
)

async def upload_points(
def upload_points(
self,
collection_name: str,
points: Iterable[types.PointStruct],
Expand Down Expand Up @@ -2198,7 +2198,7 @@ async def upload_points(
"""
assert len(kwargs) == 0, f"Unknown arguments: {list(kwargs.keys())}"
return await self._client.upload_points(
return self._client.upload_points(
collection_name=collection_name,
points=points,
batch_size=batch_size,
Expand Down
2 changes: 1 addition & 1 deletion qdrant_client/async_qdrant_fastembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ async def add(
ids_accumulator=inserted_ids,
sparse_vectors=encoded_sparse_docs,
)
await self.upload_points(
self.upload_points(
collection_name=collection_name,
points=points,
wait=True,
Expand Down
2 changes: 1 addition & 1 deletion qdrant_client/async_qdrant_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2414,7 +2414,7 @@ def upload_records(
wait=wait,
)

async def upload_points(
def upload_points(
self,
collection_name: str,
points: Iterable[types.PointStruct],
Expand Down
2 changes: 1 addition & 1 deletion qdrant_client/local/async_qdrant_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ async def recreate_collection(
collection_name, vectors_config, init_from, sparse_vectors_config
)

async def upload_points(
def upload_points(
self, collection_name: str, points: Iterable[types.PointStruct], **kwargs: Any
) -> None:
self._upload_points(collection_name, points)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_async_qdrant_client.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import asyncio
import os
import random
import time

Expand Down Expand Up @@ -35,7 +34,7 @@ async def test_async_grpc():
for idx in range(NUM_VECTORS)
)

client = QdrantClient(prefer_grpc=True, timeout=3.0)
client = QdrantClient(prefer_grpc=True, timeout=3)

grpc_collections = client.async_grpc_collections

Expand Down
2 changes: 1 addition & 1 deletion tools/async_client_generator/base_client_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(

# Parse the code into an AST
base_client_generator = BaseClientGenerator(
keep_sync=["__init__", "upload_records", "upload_collection", "migrate"],
keep_sync=["__init__", "upload_records", "upload_collection", "upload_points", "migrate"],
class_replace_map={"QdrantBase": "AsyncQdrantBase"},
constant_replace_map={"QdrantBase": "AsyncQdrantBase"},
)
Expand Down

0 comments on commit 00bcc68

Please sign in to comment.