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

fix: add missing strict mode config usage and conversion #877

Merged
merged 3 commits into from
Jan 6, 2025
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
1 change: 1 addition & 0 deletions qdrant_client/async_qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2242,6 +2242,7 @@ async def create_collection(
init_from=init_from,
timeout=timeout,
sparse_vectors_config=sparse_vectors_config,
strict_mode_config=strict_mode_config,
**kwargs,
)

Expand Down
3 changes: 3 additions & 0 deletions qdrant_client/async_qdrant_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2391,6 +2391,7 @@ async def update_collection(
hnsw_config=hnsw_config,
quantization_config=quantization_config,
sparse_vectors=sparse_vectors_config,
strict_mode_config=strict_mode_config,
),
timeout=timeout,
)
Expand Down Expand Up @@ -2527,6 +2528,7 @@ async def recreate_collection(
timeout: Optional[int] = None,
sparse_vectors_config: Optional[Mapping[str, types.SparseVectorParams]] = None,
sharding_method: Optional[types.ShardingMethod] = None,
strict_mode_config: Optional[types.StrictModeConfig] = None,
**kwargs: Any,
) -> bool:
await self.delete_collection(collection_name, timeout=timeout)
Expand All @@ -2545,6 +2547,7 @@ async def recreate_collection(
timeout=timeout,
sparse_vectors_config=sparse_vectors_config,
sharding_method=sharding_method,
strict_mode_config=strict_mode_config,
)

@property
Expand Down
8 changes: 8 additions & 0 deletions qdrant_client/conversions/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,9 @@ def convert_collection_config(cls, model: grpc.CollectionConfig) -> rest.Collect
if model.HasField("quantization_config")
else None
),
strict_mode_config=cls.convert_strict_mode_config(model.strict_mode_config)
if model.HasField("strict_mode_config")
else None,
)

@classmethod
Expand Down Expand Up @@ -2412,6 +2415,11 @@ def convert_collection_config(cls, model: rest.CollectionConfig) -> grpc.Collect
if model.quantization_config is not None
else None
),
strict_mode_config=(
cls.convert_strict_mode_config(model.strict_mode_config)
if model.strict_mode_config is not None
else None
),
)

@classmethod
Expand Down
1 change: 1 addition & 0 deletions qdrant_client/qdrant_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2321,6 +2321,7 @@ def create_collection(
init_from=init_from,
timeout=timeout,
sparse_vectors_config=sparse_vectors_config,
strict_mode_config=strict_mode_config,
**kwargs,
)

Expand Down
3 changes: 3 additions & 0 deletions qdrant_client/qdrant_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,7 @@ def update_collection(
hnsw_config=hnsw_config,
quantization_config=quantization_config,
sparse_vectors=sparse_vectors_config,
strict_mode_config=strict_mode_config,
),
timeout=timeout,
).result
Expand Down Expand Up @@ -2797,6 +2798,7 @@ def recreate_collection(
timeout: Optional[int] = None,
sparse_vectors_config: Optional[Mapping[str, types.SparseVectorParams]] = None,
sharding_method: Optional[types.ShardingMethod] = None,
strict_mode_config: Optional[types.StrictModeConfig] = None,
**kwargs: Any,
) -> bool:
self.delete_collection(collection_name, timeout=timeout)
Expand All @@ -2816,6 +2818,7 @@ def recreate_collection(
timeout=timeout,
sparse_vectors_config=sparse_vectors_config,
sharding_method=sharding_method,
strict_mode_config=strict_mode_config,
)

@property
Expand Down
32 changes: 16 additions & 16 deletions tests/conversions/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,28 @@
)

wal_config = grpc.WalConfigDiff(wal_capacity_mb=32, wal_segments_ahead=2)
strict_mode_config = grpc.StrictModeConfig(
enabled=True,
max_query_limit=100,
max_timeout=10,
unindexed_filtering_retrieve=False,
unindexed_filtering_update=False,
search_max_hnsw_ef=256,
search_allow_exact=False,
search_max_oversampling=10,
upsert_max_batchsize=64,
max_collection_vector_size_bytes=1024 * 1024 * 1024,
# read_rate_limit=model.read_rate_limit, test empty field
write_rate_limit=2000,
max_collection_payload_size_bytes=10 * 1024 * 1024 * 1024,
)

collection_config = grpc.CollectionConfig(
params=collection_params,
hnsw_config=hnsw_config,
optimizer_config=optimizer_config,
wal_config=wal_config,
strict_mode_config=strict_mode_config,
)

payload_value = {
Expand Down Expand Up @@ -1362,22 +1378,6 @@
ids=[point_id_1, point_id_2],
)

strict_mode_config = grpc.StrictModeConfig(
enabled=True,
max_query_limit=100,
max_timeout=10,
unindexed_filtering_retrieve=False,
unindexed_filtering_update=False,
search_max_hnsw_ef=256,
search_allow_exact=False,
search_max_oversampling=10,
upsert_max_batchsize=64,
max_collection_vector_size_bytes=1024 * 1024 * 1024,
# read_rate_limit=model.read_rate_limit, test empty field
write_rate_limit=2000,
max_collection_payload_size_bytes=10 * 1024 * 1024 * 1024,
)


fixtures = {
"CollectionParams": [collection_params, collection_params_2],
Expand Down
Loading