@@ -26,7 +26,7 @@ def __init__(self, collection_uuid: str, embedding_function: str):
26
26
27
27
28
28
class CollectionAddEvent (ProductTelemetryEvent ):
29
- max_batch_size : ClassVar [int ] = 100
29
+ max_batch_size : ClassVar [int ] = 1000
30
30
batch_size : int
31
31
collection_uuid : str
32
32
add_amount : int
@@ -67,6 +67,8 @@ def batch(self, other: "ProductTelemetryEvent") -> "CollectionAddEvent":
67
67
68
68
69
69
class CollectionUpdateEvent (ProductTelemetryEvent ):
70
+ max_batch_size : ClassVar [int ] = 100
71
+ batch_size : int
70
72
collection_uuid : str
71
73
update_amount : int
72
74
with_embeddings : int
@@ -80,17 +82,36 @@ def __init__(
80
82
with_embeddings : int ,
81
83
with_metadata : int ,
82
84
with_documents : int ,
85
+ batch_size : int = 1 ,
83
86
):
84
87
super ().__init__ ()
85
88
self .collection_uuid = collection_uuid
86
89
self .update_amount = update_amount
87
90
self .with_embeddings = with_embeddings
88
91
self .with_metadata = with_metadata
89
92
self .with_documents = with_documents
93
+ self .batch_size = batch_size
90
94
95
+ @property
96
+ def batch_key (self ) -> str :
97
+ return self .collection_uuid + self .name
98
+
99
+ def batch (self , other : "ProductTelemetryEvent" ) -> "CollectionUpdateEvent" :
100
+ if not self .batch_key == other .batch_key :
101
+ raise ValueError ("Cannot batch events" )
102
+ other = cast (CollectionUpdateEvent , other )
103
+ total_amount = self .update_amount + other .update_amount
104
+ return CollectionUpdateEvent (
105
+ collection_uuid = self .collection_uuid ,
106
+ update_amount = total_amount ,
107
+ with_documents = self .with_documents + other .with_documents ,
108
+ with_metadata = self .with_metadata + other .with_metadata ,
109
+ with_embeddings = self .with_embeddings + other .with_embeddings ,
110
+ batch_size = self .batch_size + other .batch_size ,
111
+ )
91
112
92
113
class CollectionQueryEvent (ProductTelemetryEvent ):
93
- max_batch_size : ClassVar [int ] = 20
114
+ max_batch_size : ClassVar [int ] = 1000
94
115
batch_size : int
95
116
collection_uuid : str
96
117
query_amount : int
@@ -147,6 +168,8 @@ def batch(self, other: "ProductTelemetryEvent") -> "CollectionQueryEvent":
147
168
148
169
149
170
class CollectionGetEvent (ProductTelemetryEvent ):
171
+ max_batch_size : ClassVar [int ] = 100
172
+ batch_size : int
150
173
collection_uuid : str
151
174
ids_count : int
152
175
limit : int
@@ -160,13 +183,33 @@ def __init__(
160
183
limit : int ,
161
184
include_metadata : int ,
162
185
include_documents : int ,
186
+ batch_size : int = 1 ,
163
187
):
164
188
super ().__init__ ()
165
189
self .collection_uuid = collection_uuid
166
190
self .ids_count = ids_count
167
191
self .limit = limit
168
192
self .include_metadata = include_metadata
169
193
self .include_documents = include_documents
194
+ self .batch_size = batch_size
195
+
196
+ @property
197
+ def batch_key (self ) -> str :
198
+ return self .collection_uuid + self .name + str (self .limit )
199
+
200
+ def batch (self , other : "ProductTelemetryEvent" ) -> "CollectionGetEvent" :
201
+ if not self .batch_key == other .batch_key :
202
+ raise ValueError ("Cannot batch events" )
203
+ other = cast (CollectionGetEvent , other )
204
+ total_amount = self .ids_count + other .ids_count
205
+ return CollectionGetEvent (
206
+ collection_uuid = self .collection_uuid ,
207
+ ids_count = total_amount ,
208
+ limit = self .limit ,
209
+ include_metadata = self .include_metadata + other .include_metadata ,
210
+ include_documents = self .include_documents + other .include_documents ,
211
+ batch_size = self .batch_size + other .batch_size ,
212
+ )
170
213
171
214
172
215
class CollectionDeleteEvent (ProductTelemetryEvent ):
0 commit comments