Skip to content

Commit

Permalink
fix: fix sparse vector config conversion in collection params (#674)
Browse files Browse the repository at this point in the history
  • Loading branch information
joein authored Jul 3, 2024
1 parent 00d40c8 commit f594c7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions qdrant_client/conversions/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -609,6 +609,9 @@ def convert_collection_params(cls, model: grpc.CollectionParams) -> rest.Collect
if model.HasField("write_consistency_factor")
else None
),
sparse_vectors=cls.convert_sparse_vector_config(model.sparse_vectors_config)
if model.HasField("sparse_vectors_config")
else None,
)

@classmethod
Expand Down Expand Up @@ -2023,6 +2026,11 @@ def convert_collection_params(cls, model: rest.CollectionParams) -> grpc.Collect
write_consistency_factor=model.write_consistency_factor,
replication_factor=model.replication_factor,
read_fan_out_factor=model.read_fan_out_factor,
sparse_vectors_config=(
cls.convert_sparse_vector_config(model.sparse_vectors)
if model.sparse_vectors is not None
else None
),
)

@classmethod
Expand Down
4 changes: 4 additions & 0 deletions tests/conversions/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@
params_map=grpc.VectorParamsMap(map={"text_vector": vector_param})
)

sparse_vector_config = grpc.SparseVectorConfig(
map={"sparse": grpc.SparseVectorParams(index=grpc.SparseIndexConfig(full_scan_threshold=1212))}
)
collection_params = grpc.CollectionParams(
vectors_config=single_vector_config,
shard_number=10,
Expand All @@ -222,6 +225,7 @@
replication_factor=2,
write_consistency_factor=1,
read_fan_out_factor=2,
sparse_vectors_config=sparse_vector_config,
)

hnsw_config = grpc.HnswConfigDiff(
Expand Down

0 comments on commit f594c7d

Please sign in to comment.