Skip to content

Commit

Permalink
update clients (#880)
Browse files Browse the repository at this point in the history
* update clients

* new: update conversions

* fix: update inspection cache

* update grpc

* bump fastembed to 0.5.1

* update poetry lock

* update poetry lock
  • Loading branch information
joein authored Jan 16, 2025
1 parent 349b35b commit dffab2e
Show file tree
Hide file tree
Showing 11 changed files with 651 additions and 394 deletions.
635 changes: 389 additions & 246 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ grpcio-tools = ">=1.41.0"
urllib3 = ">=1.26.14,<3"
portalocker = "^2.7.0"
fastembed = [
{ version = "0.5.0", optional = true },
{ version = "0.5.1", optional = true },
]
fastembed-gpu = [
{ version = "0.5.0", optional = true },
{ version = "0.5.1", optional = true },
]

[tool.poetry.group.dev.dependencies]
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 @@ -2056,6 +2056,12 @@ def convert_strict_mode_config(cls, model: grpc.StrictModeConfig) -> rest.Strict
max_collection_payload_size_bytes=model.max_collection_payload_size_bytes
if model.HasField("max_collection_payload_size_bytes")
else None,
filter_max_conditions=model.filter_max_conditions
if model.HasField("filter_max_conditions")
else None,
condition_max_size=model.condition_max_size
if model.HasField("condition_max_size")
else None,
)


Expand Down Expand Up @@ -3997,4 +4003,6 @@ def convert_strict_mode_config(cls, model: rest.StrictModeConfig) -> grpc.Strict
read_rate_limit=model.read_rate_limit,
write_rate_limit=model.write_rate_limit,
max_collection_payload_size_bytes=model.max_collection_payload_size_bytes,
filter_max_conditions=model.filter_max_conditions,
condition_max_size=model.condition_max_size,
)
43 changes: 43 additions & 0 deletions qdrant_client/embed/_inspection_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,9 @@
"InferenceObject": [],
"StrictModeConfig": [],
"HasVectorCondition": [],
"AbortReshardingOperation": [],
"StartResharding": [],
"StartReshardingOperation": [],
}
DEFS = {
"AbortShardTransfer": {
Expand Down Expand Up @@ -3048,6 +3051,46 @@
"title": "UpsertOperation",
"type": "object",
},
"ReshardingDirectionOneOf": {
"description": "Scale up, add a new shard",
"enum": ["up"],
"title": "ReshardingDirectionOneOf",
"type": "string",
},
"ReshardingDirectionOneOf1": {
"description": "Scale down, remove a shard",
"enum": ["down"],
"title": "ReshardingDirectionOneOf1",
"type": "string",
},
"StartResharding": {
"additionalProperties": False,
"properties": {
"direction": {
"anyOf": [
{"$ref": "#/$defs/ReshardingDirectionOneOf"},
{"$ref": "#/$defs/ReshardingDirectionOneOf1"},
],
"description": "",
"title": "Direction",
},
"peer_id": {
"anyOf": [{"type": "integer"}, {"type": "null"}],
"default": None,
"description": "",
"title": "Peer Id",
},
"shard_key": {
"anyOf": [{"type": "integer"}, {"type": "string"}, {"type": "null"}],
"default": None,
"description": "",
"title": "Shard Key",
},
},
"required": ["direction"],
"title": "StartResharding",
"type": "object",
},
}
RECURSIVE_REFS = ["Filter", "MinShould", "Nested", "NestedCondition", "Prefetch"]
INCLUDED_RECURSIVE_REFS = ["Prefetch"]
Expand Down
250 changes: 128 additions & 122 deletions qdrant_client/grpc/collections_pb2.py

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions qdrant_client/grpc/points_pb2.py

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions qdrant_client/http/api/service_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,13 +164,16 @@ def _build_for_root(
def _build_for_telemetry(
self,
anonymize: bool = None,
details_level: int = None,
):
"""
Collect telemetry data including app info, system info, collections info, cluster info, configs and statistics
"""
query_params = {}
if anonymize is not None:
query_params["anonymize"] = str(anonymize).lower()
if details_level is not None:
query_params["details_level"] = str(details_level)

headers = {}
return self.api_client.request(
Expand Down Expand Up @@ -248,12 +251,14 @@ async def root(
async def telemetry(
self,
anonymize: bool = None,
details_level: int = None,
) -> m.InlineResponse2001:
"""
Collect telemetry data including app info, system info, collections info, cluster info, configs and statistics
"""
return await self._build_for_telemetry(
anonymize=anonymize,
details_level=details_level,
)


Expand Down Expand Up @@ -323,10 +328,12 @@ def root(
def telemetry(
self,
anonymize: bool = None,
details_level: int = None,
) -> m.InlineResponse2001:
"""
Collect telemetry data including app info, system info, collections info, cluster info, configs and statistics
"""
return self._build_for_telemetry(
anonymize=anonymize,
details_level=details_level,
)
44 changes: 40 additions & 4 deletions qdrant_client/http/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
VectorsConfigDiff = Dict[str, "VectorParamsDiff"]


class AbortReshardingOperation(BaseModel, extra="forbid"):
abort_resharding: Any = Field(..., description="")


class AbortShardTransfer(BaseModel, extra="forbid"):
shard_id: int = Field(..., description="")
to_peer_id: int = Field(..., description="")
Expand Down Expand Up @@ -839,6 +843,8 @@ class HardwareUsage(BaseModel):
"""

cpu: int = Field(..., description="Usage of the hardware resources, spent to process the request")
io_read: int = Field(..., description="Usage of the hardware resources, spent to process the request")
io_write: int = Field(..., description="Usage of the hardware resources, spent to process the request")


class HasIdCondition(BaseModel, extra="forbid"):
Expand Down Expand Up @@ -2001,6 +2007,8 @@ def __str__(self) -> str:
LISTENER = "Listener"
PARTIALSNAPSHOT = "PartialSnapshot"
RECOVERY = "Recovery"
RESHARDING = "Resharding"
RESHARDINGSCALEDOWN = "ReshardingScaleDown"


class ReplicateShard(BaseModel, extra="forbid"):
Expand Down Expand Up @@ -2048,10 +2056,6 @@ class ReshardingInfo(BaseModel):
shard_id: int = Field(..., description="")
peer_id: int = Field(..., description="")
shard_key: Optional["ShardKey"] = Field(default=None, description="")
comment: Optional[str] = Field(
default=None,
description="A human-readable report of the operation progress. Available only on the source peer.",
)


class RestartTransfer(BaseModel, extra="forbid"):
Expand Down Expand Up @@ -2400,6 +2404,10 @@ def __str__(self) -> str:

class ShardTransferInfo(BaseModel):
shard_id: int = Field(..., description="")
to_shard_id: Optional[int] = Field(
default=None,
description="Target shard ID if different than source shard ID Used exclusively with `ReshardStreamRecords` transfer method.",
)
from_: int = Field(..., description="Source peer id", alias="from")
to: int = Field(..., description="Destination peer id")
sync: bool = Field(
Expand Down Expand Up @@ -2445,6 +2453,17 @@ def __str__(self) -> str:
WAL_DELTA = "wal_delta"


class ShardTransferMethodOneOf3(str, Enum):
"""
Shard transfer for resharding: stream all records in batches until all points are transferred.
"""

def __str__(self) -> str:
return str(self.value)

RESHARDING_STREAM_RECORDS = "resharding_stream_records"


class ShardingMethod(str, Enum):
AUTO = "auto"
CUSTOM = "custom"
Expand Down Expand Up @@ -2609,6 +2628,16 @@ def __str__(self) -> str:
MMAP = "mmap"


class StartResharding(BaseModel, extra="forbid"):
direction: "ReshardingDirection" = Field(..., description="")
peer_id: Optional[int] = Field(default=None, description="")
shard_key: Optional["ShardKey"] = Field(default=None, description="")


class StartReshardingOperation(BaseModel, extra="forbid"):
start_resharding: "StartResharding" = Field(..., description="")


class StateRole(str, Enum):
"""
Role of the peer in the consensus
Expand Down Expand Up @@ -2653,6 +2682,10 @@ class StrictModeConfig(BaseModel, extra="forbid"):
max_collection_payload_size_bytes: Optional[int] = Field(
default=None, description="Max size of a collections payload storage in bytes"
)
filter_max_conditions: Optional[int] = Field(default=None, description="Max conditions a filter can have.")
condition_max_size: Optional[int] = Field(
default=None, description="Max size of a condition, eg. items in `MatchAny`."
)


class TelemetryData(BaseModel):
Expand Down Expand Up @@ -2993,6 +3026,8 @@ def __str__(self) -> str:
CreateShardingKeyOperation,
DropShardingKeyOperation,
RestartTransferOperation,
StartReshardingOperation,
AbortReshardingOperation,
]
ClusterStatus = Union[
ClusterStatusOneOf,
Expand Down Expand Up @@ -3139,6 +3174,7 @@ def __str__(self) -> str:
ShardTransferMethodOneOf,
ShardTransferMethodOneOf1,
ShardTransferMethodOneOf2,
ShardTransferMethodOneOf3,
]
SparseIndexType = Union[
SparseIndexTypeOneOf,
Expand Down
14 changes: 12 additions & 2 deletions qdrant_client/proto/collections.proto
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,8 @@ message StrictModeConfig {
optional uint32 read_rate_limit = 11; // Max number of read operations per minute per replica
optional uint32 write_rate_limit = 12; // Max number of write operations per minute per replica
optional uint64 max_collection_payload_size_bytes = 13;
optional uint64 filter_max_conditions = 14;
optional uint64 condition_max_size = 15;
}

message CreateCollection {
Expand Down Expand Up @@ -589,6 +591,15 @@ message ReshardingInfo {
uint32 shard_id = 1;
uint64 peer_id = 2;
optional ShardKey shard_key = 3;
ReshardingDirection direction = 4;
}

/*
Resharding direction, scale up or down in number of shards
*/
enum ReshardingDirection {
Up = 0; // Scale up, add a new shard
Down = 1; // Scale down, remove a shard
}

message CollectionClusterInfoResponse {
Expand All @@ -597,8 +608,7 @@ message CollectionClusterInfoResponse {
repeated LocalShardInfo local_shards = 3; // Local shards
repeated RemoteShardInfo remote_shards = 4; // Remote shards
repeated ShardTransferInfo shard_transfers = 5; // Shard transfers
// TODO(resharding): enable on release:
// repeated ReshardingInfo resharding_operations = 6; // Resharding operations
repeated ReshardingInfo resharding_operations = 6; // Resharding operations
}

message MoveShard {
Expand Down
2 changes: 2 additions & 0 deletions qdrant_client/proto/points.proto
Original file line number Diff line number Diff line change
Expand Up @@ -1098,4 +1098,6 @@ message GeoPoint {

message HardwareUsage {
uint64 cpu = 1;
uint64 io_read = 2;
uint64 io_write = 3;
}
2 changes: 2 additions & 0 deletions tests/conversions/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@
# read_rate_limit=model.read_rate_limit, test empty field
write_rate_limit=2000,
max_collection_payload_size_bytes=10 * 1024 * 1024 * 1024,
filter_max_conditions=100,
condition_max_size=5,
)

collection_config = grpc.CollectionConfig(
Expand Down

0 comments on commit dffab2e

Please sign in to comment.