databricks-sdk 0.44.1__py3-none-any.whl → 0.45.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of databricks-sdk might be problematic. Click here for more details.
- databricks/sdk/__init__.py +123 -115
- databricks/sdk/_base_client.py +112 -88
- databricks/sdk/_property.py +12 -7
- databricks/sdk/_widgets/__init__.py +13 -2
- databricks/sdk/_widgets/default_widgets_utils.py +21 -15
- databricks/sdk/_widgets/ipywidgets_utils.py +47 -24
- databricks/sdk/azure.py +8 -6
- databricks/sdk/casing.py +5 -5
- databricks/sdk/config.py +152 -99
- databricks/sdk/core.py +57 -47
- databricks/sdk/credentials_provider.py +300 -205
- databricks/sdk/data_plane.py +86 -3
- databricks/sdk/dbutils.py +123 -87
- databricks/sdk/environments.py +52 -35
- databricks/sdk/errors/base.py +61 -35
- databricks/sdk/errors/customizer.py +3 -3
- databricks/sdk/errors/deserializer.py +38 -25
- databricks/sdk/errors/details.py +417 -0
- databricks/sdk/errors/mapper.py +1 -1
- databricks/sdk/errors/overrides.py +27 -24
- databricks/sdk/errors/parser.py +26 -14
- databricks/sdk/errors/platform.py +10 -10
- databricks/sdk/errors/private_link.py +24 -24
- databricks/sdk/logger/round_trip_logger.py +28 -20
- databricks/sdk/mixins/compute.py +90 -60
- databricks/sdk/mixins/files.py +815 -145
- databricks/sdk/mixins/jobs.py +191 -16
- databricks/sdk/mixins/open_ai_client.py +26 -20
- databricks/sdk/mixins/workspace.py +45 -34
- databricks/sdk/oauth.py +372 -196
- databricks/sdk/retries.py +14 -12
- databricks/sdk/runtime/__init__.py +34 -17
- databricks/sdk/runtime/dbutils_stub.py +52 -39
- databricks/sdk/service/_internal.py +12 -7
- databricks/sdk/service/apps.py +618 -418
- databricks/sdk/service/billing.py +827 -604
- databricks/sdk/service/catalog.py +6552 -4474
- databricks/sdk/service/cleanrooms.py +550 -388
- databricks/sdk/service/compute.py +5241 -3531
- databricks/sdk/service/dashboards.py +1313 -923
- databricks/sdk/service/files.py +442 -309
- databricks/sdk/service/iam.py +2115 -1483
- databricks/sdk/service/jobs.py +4151 -2588
- databricks/sdk/service/marketplace.py +2210 -1517
- databricks/sdk/service/ml.py +3364 -2255
- databricks/sdk/service/oauth2.py +922 -584
- databricks/sdk/service/pipelines.py +1865 -1203
- databricks/sdk/service/provisioning.py +1435 -1029
- databricks/sdk/service/serving.py +2040 -1278
- databricks/sdk/service/settings.py +2846 -1929
- databricks/sdk/service/sharing.py +2201 -877
- databricks/sdk/service/sql.py +4650 -3103
- databricks/sdk/service/vectorsearch.py +816 -550
- databricks/sdk/service/workspace.py +1330 -906
- databricks/sdk/useragent.py +36 -22
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/METADATA +31 -31
- databricks_sdk-0.45.0.dist-info/RECORD +70 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/WHEEL +1 -1
- databricks_sdk-0.44.1.dist-info/RECORD +0 -69
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.44.1.dist-info → databricks_sdk-0.45.0.dist-info}/top_level.txt +0 -0
|
@@ -8,12 +8,13 @@ import time
|
|
|
8
8
|
from dataclasses import dataclass
|
|
9
9
|
from datetime import timedelta
|
|
10
10
|
from enum import Enum
|
|
11
|
-
from typing import Callable, Dict, Iterator, List, Optional
|
|
11
|
+
from typing import Any, Callable, Dict, Iterator, List, Optional
|
|
12
12
|
|
|
13
13
|
from ..errors import OperationFailed
|
|
14
14
|
from ._internal import Wait, _enum, _from_dict, _repeated_dict
|
|
15
15
|
|
|
16
|
-
_LOG = logging.getLogger(
|
|
16
|
+
_LOG = logging.getLogger("databricks.sdk")
|
|
17
|
+
|
|
17
18
|
|
|
18
19
|
# all definitions in this file are in alphabetical order
|
|
19
20
|
|
|
@@ -26,19 +27,21 @@ class ColumnInfo:
|
|
|
26
27
|
def as_dict(self) -> dict:
|
|
27
28
|
"""Serializes the ColumnInfo into a dictionary suitable for use as a JSON request body."""
|
|
28
29
|
body = {}
|
|
29
|
-
if self.name is not None:
|
|
30
|
+
if self.name is not None:
|
|
31
|
+
body["name"] = self.name
|
|
30
32
|
return body
|
|
31
33
|
|
|
32
34
|
def as_shallow_dict(self) -> dict:
|
|
33
35
|
"""Serializes the ColumnInfo into a shallow dictionary of its immediate attributes."""
|
|
34
36
|
body = {}
|
|
35
|
-
if self.name is not None:
|
|
37
|
+
if self.name is not None:
|
|
38
|
+
body["name"] = self.name
|
|
36
39
|
return body
|
|
37
40
|
|
|
38
41
|
@classmethod
|
|
39
|
-
def from_dict(cls, d: Dict[str,
|
|
42
|
+
def from_dict(cls, d: Dict[str, Any]) -> ColumnInfo:
|
|
40
43
|
"""Deserializes the ColumnInfo from a dictionary."""
|
|
41
|
-
return cls(name=d.get(
|
|
44
|
+
return cls(name=d.get("name", None))
|
|
42
45
|
|
|
43
46
|
|
|
44
47
|
@dataclass
|
|
@@ -52,21 +55,25 @@ class CreateEndpoint:
|
|
|
52
55
|
def as_dict(self) -> dict:
|
|
53
56
|
"""Serializes the CreateEndpoint into a dictionary suitable for use as a JSON request body."""
|
|
54
57
|
body = {}
|
|
55
|
-
if self.endpoint_type is not None:
|
|
56
|
-
|
|
58
|
+
if self.endpoint_type is not None:
|
|
59
|
+
body["endpoint_type"] = self.endpoint_type.value
|
|
60
|
+
if self.name is not None:
|
|
61
|
+
body["name"] = self.name
|
|
57
62
|
return body
|
|
58
63
|
|
|
59
64
|
def as_shallow_dict(self) -> dict:
|
|
60
65
|
"""Serializes the CreateEndpoint into a shallow dictionary of its immediate attributes."""
|
|
61
66
|
body = {}
|
|
62
|
-
if self.endpoint_type is not None:
|
|
63
|
-
|
|
67
|
+
if self.endpoint_type is not None:
|
|
68
|
+
body["endpoint_type"] = self.endpoint_type
|
|
69
|
+
if self.name is not None:
|
|
70
|
+
body["name"] = self.name
|
|
64
71
|
return body
|
|
65
72
|
|
|
66
73
|
@classmethod
|
|
67
|
-
def from_dict(cls, d: Dict[str,
|
|
74
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateEndpoint:
|
|
68
75
|
"""Deserializes the CreateEndpoint from a dictionary."""
|
|
69
|
-
return cls(endpoint_type=_enum(d,
|
|
76
|
+
return cls(endpoint_type=_enum(d, "endpoint_type", EndpointType), name=d.get("name", None))
|
|
70
77
|
|
|
71
78
|
|
|
72
79
|
@dataclass
|
|
@@ -97,37 +104,48 @@ class CreateVectorIndexRequest:
|
|
|
97
104
|
def as_dict(self) -> dict:
|
|
98
105
|
"""Serializes the CreateVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
99
106
|
body = {}
|
|
100
|
-
if self.delta_sync_index_spec:
|
|
107
|
+
if self.delta_sync_index_spec:
|
|
108
|
+
body["delta_sync_index_spec"] = self.delta_sync_index_spec.as_dict()
|
|
101
109
|
if self.direct_access_index_spec:
|
|
102
|
-
body[
|
|
103
|
-
if self.endpoint_name is not None:
|
|
104
|
-
|
|
105
|
-
if self.
|
|
106
|
-
|
|
110
|
+
body["direct_access_index_spec"] = self.direct_access_index_spec.as_dict()
|
|
111
|
+
if self.endpoint_name is not None:
|
|
112
|
+
body["endpoint_name"] = self.endpoint_name
|
|
113
|
+
if self.index_type is not None:
|
|
114
|
+
body["index_type"] = self.index_type.value
|
|
115
|
+
if self.name is not None:
|
|
116
|
+
body["name"] = self.name
|
|
117
|
+
if self.primary_key is not None:
|
|
118
|
+
body["primary_key"] = self.primary_key
|
|
107
119
|
return body
|
|
108
120
|
|
|
109
121
|
def as_shallow_dict(self) -> dict:
|
|
110
122
|
"""Serializes the CreateVectorIndexRequest into a shallow dictionary of its immediate attributes."""
|
|
111
123
|
body = {}
|
|
112
|
-
if self.delta_sync_index_spec:
|
|
113
|
-
|
|
114
|
-
if self.
|
|
115
|
-
|
|
116
|
-
if self.
|
|
117
|
-
|
|
124
|
+
if self.delta_sync_index_spec:
|
|
125
|
+
body["delta_sync_index_spec"] = self.delta_sync_index_spec
|
|
126
|
+
if self.direct_access_index_spec:
|
|
127
|
+
body["direct_access_index_spec"] = self.direct_access_index_spec
|
|
128
|
+
if self.endpoint_name is not None:
|
|
129
|
+
body["endpoint_name"] = self.endpoint_name
|
|
130
|
+
if self.index_type is not None:
|
|
131
|
+
body["index_type"] = self.index_type
|
|
132
|
+
if self.name is not None:
|
|
133
|
+
body["name"] = self.name
|
|
134
|
+
if self.primary_key is not None:
|
|
135
|
+
body["primary_key"] = self.primary_key
|
|
118
136
|
return body
|
|
119
137
|
|
|
120
138
|
@classmethod
|
|
121
|
-
def from_dict(cls, d: Dict[str,
|
|
139
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateVectorIndexRequest:
|
|
122
140
|
"""Deserializes the CreateVectorIndexRequest from a dictionary."""
|
|
123
|
-
return cls(
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
141
|
+
return cls(
|
|
142
|
+
delta_sync_index_spec=_from_dict(d, "delta_sync_index_spec", DeltaSyncVectorIndexSpecRequest),
|
|
143
|
+
direct_access_index_spec=_from_dict(d, "direct_access_index_spec", DirectAccessVectorIndexSpec),
|
|
144
|
+
endpoint_name=d.get("endpoint_name", None),
|
|
145
|
+
index_type=_enum(d, "index_type", VectorIndexType),
|
|
146
|
+
name=d.get("name", None),
|
|
147
|
+
primary_key=d.get("primary_key", None),
|
|
148
|
+
)
|
|
131
149
|
|
|
132
150
|
|
|
133
151
|
@dataclass
|
|
@@ -137,19 +155,21 @@ class CreateVectorIndexResponse:
|
|
|
137
155
|
def as_dict(self) -> dict:
|
|
138
156
|
"""Serializes the CreateVectorIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
139
157
|
body = {}
|
|
140
|
-
if self.vector_index:
|
|
158
|
+
if self.vector_index:
|
|
159
|
+
body["vector_index"] = self.vector_index.as_dict()
|
|
141
160
|
return body
|
|
142
161
|
|
|
143
162
|
def as_shallow_dict(self) -> dict:
|
|
144
163
|
"""Serializes the CreateVectorIndexResponse into a shallow dictionary of its immediate attributes."""
|
|
145
164
|
body = {}
|
|
146
|
-
if self.vector_index:
|
|
165
|
+
if self.vector_index:
|
|
166
|
+
body["vector_index"] = self.vector_index
|
|
147
167
|
return body
|
|
148
168
|
|
|
149
169
|
@classmethod
|
|
150
|
-
def from_dict(cls, d: Dict[str,
|
|
170
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateVectorIndexResponse:
|
|
151
171
|
"""Deserializes the CreateVectorIndexResponse from a dictionary."""
|
|
152
|
-
return cls(vector_index=_from_dict(d,
|
|
172
|
+
return cls(vector_index=_from_dict(d, "vector_index", VectorIndex))
|
|
153
173
|
|
|
154
174
|
|
|
155
175
|
@dataclass
|
|
@@ -165,30 +185,35 @@ class DeleteDataResult:
|
|
|
165
185
|
def as_dict(self) -> dict:
|
|
166
186
|
"""Serializes the DeleteDataResult into a dictionary suitable for use as a JSON request body."""
|
|
167
187
|
body = {}
|
|
168
|
-
if self.failed_primary_keys:
|
|
169
|
-
|
|
188
|
+
if self.failed_primary_keys:
|
|
189
|
+
body["failed_primary_keys"] = [v for v in self.failed_primary_keys]
|
|
190
|
+
if self.success_row_count is not None:
|
|
191
|
+
body["success_row_count"] = self.success_row_count
|
|
170
192
|
return body
|
|
171
193
|
|
|
172
194
|
def as_shallow_dict(self) -> dict:
|
|
173
195
|
"""Serializes the DeleteDataResult into a shallow dictionary of its immediate attributes."""
|
|
174
196
|
body = {}
|
|
175
|
-
if self.failed_primary_keys:
|
|
176
|
-
|
|
197
|
+
if self.failed_primary_keys:
|
|
198
|
+
body["failed_primary_keys"] = self.failed_primary_keys
|
|
199
|
+
if self.success_row_count is not None:
|
|
200
|
+
body["success_row_count"] = self.success_row_count
|
|
177
201
|
return body
|
|
178
202
|
|
|
179
203
|
@classmethod
|
|
180
|
-
def from_dict(cls, d: Dict[str,
|
|
204
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteDataResult:
|
|
181
205
|
"""Deserializes the DeleteDataResult from a dictionary."""
|
|
182
|
-
return cls(
|
|
183
|
-
|
|
206
|
+
return cls(
|
|
207
|
+
failed_primary_keys=d.get("failed_primary_keys", None), success_row_count=d.get("success_row_count", None)
|
|
208
|
+
)
|
|
184
209
|
|
|
185
210
|
|
|
186
211
|
class DeleteDataStatus(Enum):
|
|
187
212
|
"""Status of the delete operation."""
|
|
188
213
|
|
|
189
|
-
FAILURE =
|
|
190
|
-
PARTIAL_SUCCESS =
|
|
191
|
-
SUCCESS =
|
|
214
|
+
FAILURE = "FAILURE"
|
|
215
|
+
PARTIAL_SUCCESS = "PARTIAL_SUCCESS"
|
|
216
|
+
SUCCESS = "SUCCESS"
|
|
192
217
|
|
|
193
218
|
|
|
194
219
|
@dataclass
|
|
@@ -204,21 +229,25 @@ class DeleteDataVectorIndexRequest:
|
|
|
204
229
|
def as_dict(self) -> dict:
|
|
205
230
|
"""Serializes the DeleteDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
206
231
|
body = {}
|
|
207
|
-
if self.index_name is not None:
|
|
208
|
-
|
|
232
|
+
if self.index_name is not None:
|
|
233
|
+
body["index_name"] = self.index_name
|
|
234
|
+
if self.primary_keys:
|
|
235
|
+
body["primary_keys"] = [v for v in self.primary_keys]
|
|
209
236
|
return body
|
|
210
237
|
|
|
211
238
|
def as_shallow_dict(self) -> dict:
|
|
212
239
|
"""Serializes the DeleteDataVectorIndexRequest into a shallow dictionary of its immediate attributes."""
|
|
213
240
|
body = {}
|
|
214
|
-
if self.index_name is not None:
|
|
215
|
-
|
|
241
|
+
if self.index_name is not None:
|
|
242
|
+
body["index_name"] = self.index_name
|
|
243
|
+
if self.primary_keys:
|
|
244
|
+
body["primary_keys"] = self.primary_keys
|
|
216
245
|
return body
|
|
217
246
|
|
|
218
247
|
@classmethod
|
|
219
|
-
def from_dict(cls, d: Dict[str,
|
|
248
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteDataVectorIndexRequest:
|
|
220
249
|
"""Deserializes the DeleteDataVectorIndexRequest from a dictionary."""
|
|
221
|
-
return cls(index_name=d.get(
|
|
250
|
+
return cls(index_name=d.get("index_name", None), primary_keys=d.get("primary_keys", None))
|
|
222
251
|
|
|
223
252
|
|
|
224
253
|
@dataclass
|
|
@@ -234,27 +263,29 @@ class DeleteDataVectorIndexResponse:
|
|
|
234
263
|
def as_dict(self) -> dict:
|
|
235
264
|
"""Serializes the DeleteDataVectorIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
236
265
|
body = {}
|
|
237
|
-
if self.result:
|
|
238
|
-
|
|
266
|
+
if self.result:
|
|
267
|
+
body["result"] = self.result.as_dict()
|
|
268
|
+
if self.status is not None:
|
|
269
|
+
body["status"] = self.status.value
|
|
239
270
|
return body
|
|
240
271
|
|
|
241
272
|
def as_shallow_dict(self) -> dict:
|
|
242
273
|
"""Serializes the DeleteDataVectorIndexResponse into a shallow dictionary of its immediate attributes."""
|
|
243
274
|
body = {}
|
|
244
|
-
if self.result:
|
|
245
|
-
|
|
275
|
+
if self.result:
|
|
276
|
+
body["result"] = self.result
|
|
277
|
+
if self.status is not None:
|
|
278
|
+
body["status"] = self.status
|
|
246
279
|
return body
|
|
247
280
|
|
|
248
281
|
@classmethod
|
|
249
|
-
def from_dict(cls, d: Dict[str,
|
|
282
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteDataVectorIndexResponse:
|
|
250
283
|
"""Deserializes the DeleteDataVectorIndexResponse from a dictionary."""
|
|
251
|
-
return cls(result=_from_dict(d,
|
|
252
|
-
status=_enum(d, 'status', DeleteDataStatus))
|
|
284
|
+
return cls(result=_from_dict(d, "result", DeleteDataResult), status=_enum(d, "status", DeleteDataStatus))
|
|
253
285
|
|
|
254
286
|
|
|
255
287
|
@dataclass
|
|
256
288
|
class DeleteEndpointResponse:
|
|
257
|
-
|
|
258
289
|
def as_dict(self) -> dict:
|
|
259
290
|
"""Serializes the DeleteEndpointResponse into a dictionary suitable for use as a JSON request body."""
|
|
260
291
|
body = {}
|
|
@@ -266,14 +297,13 @@ class DeleteEndpointResponse:
|
|
|
266
297
|
return body
|
|
267
298
|
|
|
268
299
|
@classmethod
|
|
269
|
-
def from_dict(cls, d: Dict[str,
|
|
300
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteEndpointResponse:
|
|
270
301
|
"""Deserializes the DeleteEndpointResponse from a dictionary."""
|
|
271
302
|
return cls()
|
|
272
303
|
|
|
273
304
|
|
|
274
305
|
@dataclass
|
|
275
306
|
class DeleteIndexResponse:
|
|
276
|
-
|
|
277
307
|
def as_dict(self) -> dict:
|
|
278
308
|
"""Serializes the DeleteIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
279
309
|
body = {}
|
|
@@ -285,7 +315,7 @@ class DeleteIndexResponse:
|
|
|
285
315
|
return body
|
|
286
316
|
|
|
287
317
|
@classmethod
|
|
288
|
-
def from_dict(cls, d: Dict[str,
|
|
318
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteIndexResponse:
|
|
289
319
|
"""Deserializes the DeleteIndexResponse from a dictionary."""
|
|
290
320
|
return cls()
|
|
291
321
|
|
|
@@ -322,40 +352,48 @@ class DeltaSyncVectorIndexSpecRequest:
|
|
|
322
352
|
def as_dict(self) -> dict:
|
|
323
353
|
"""Serializes the DeltaSyncVectorIndexSpecRequest into a dictionary suitable for use as a JSON request body."""
|
|
324
354
|
body = {}
|
|
325
|
-
if self.columns_to_sync:
|
|
355
|
+
if self.columns_to_sync:
|
|
356
|
+
body["columns_to_sync"] = [v for v in self.columns_to_sync]
|
|
326
357
|
if self.embedding_source_columns:
|
|
327
|
-
body[
|
|
358
|
+
body["embedding_source_columns"] = [v.as_dict() for v in self.embedding_source_columns]
|
|
328
359
|
if self.embedding_vector_columns:
|
|
329
|
-
body[
|
|
360
|
+
body["embedding_vector_columns"] = [v.as_dict() for v in self.embedding_vector_columns]
|
|
330
361
|
if self.embedding_writeback_table is not None:
|
|
331
|
-
body[
|
|
332
|
-
if self.pipeline_type is not None:
|
|
333
|
-
|
|
362
|
+
body["embedding_writeback_table"] = self.embedding_writeback_table
|
|
363
|
+
if self.pipeline_type is not None:
|
|
364
|
+
body["pipeline_type"] = self.pipeline_type.value
|
|
365
|
+
if self.source_table is not None:
|
|
366
|
+
body["source_table"] = self.source_table
|
|
334
367
|
return body
|
|
335
368
|
|
|
336
369
|
def as_shallow_dict(self) -> dict:
|
|
337
370
|
"""Serializes the DeltaSyncVectorIndexSpecRequest into a shallow dictionary of its immediate attributes."""
|
|
338
371
|
body = {}
|
|
339
|
-
if self.columns_to_sync:
|
|
340
|
-
|
|
341
|
-
if self.
|
|
372
|
+
if self.columns_to_sync:
|
|
373
|
+
body["columns_to_sync"] = self.columns_to_sync
|
|
374
|
+
if self.embedding_source_columns:
|
|
375
|
+
body["embedding_source_columns"] = self.embedding_source_columns
|
|
376
|
+
if self.embedding_vector_columns:
|
|
377
|
+
body["embedding_vector_columns"] = self.embedding_vector_columns
|
|
342
378
|
if self.embedding_writeback_table is not None:
|
|
343
|
-
body[
|
|
344
|
-
if self.pipeline_type is not None:
|
|
345
|
-
|
|
379
|
+
body["embedding_writeback_table"] = self.embedding_writeback_table
|
|
380
|
+
if self.pipeline_type is not None:
|
|
381
|
+
body["pipeline_type"] = self.pipeline_type
|
|
382
|
+
if self.source_table is not None:
|
|
383
|
+
body["source_table"] = self.source_table
|
|
346
384
|
return body
|
|
347
385
|
|
|
348
386
|
@classmethod
|
|
349
|
-
def from_dict(cls, d: Dict[str,
|
|
387
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeltaSyncVectorIndexSpecRequest:
|
|
350
388
|
"""Deserializes the DeltaSyncVectorIndexSpecRequest from a dictionary."""
|
|
351
|
-
return cls(
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
389
|
+
return cls(
|
|
390
|
+
columns_to_sync=d.get("columns_to_sync", None),
|
|
391
|
+
embedding_source_columns=_repeated_dict(d, "embedding_source_columns", EmbeddingSourceColumn),
|
|
392
|
+
embedding_vector_columns=_repeated_dict(d, "embedding_vector_columns", EmbeddingVectorColumn),
|
|
393
|
+
embedding_writeback_table=d.get("embedding_writeback_table", None),
|
|
394
|
+
pipeline_type=_enum(d, "pipeline_type", PipelineType),
|
|
395
|
+
source_table=d.get("source_table", None),
|
|
396
|
+
)
|
|
359
397
|
|
|
360
398
|
|
|
361
399
|
@dataclass
|
|
@@ -388,39 +426,47 @@ class DeltaSyncVectorIndexSpecResponse:
|
|
|
388
426
|
"""Serializes the DeltaSyncVectorIndexSpecResponse into a dictionary suitable for use as a JSON request body."""
|
|
389
427
|
body = {}
|
|
390
428
|
if self.embedding_source_columns:
|
|
391
|
-
body[
|
|
429
|
+
body["embedding_source_columns"] = [v.as_dict() for v in self.embedding_source_columns]
|
|
392
430
|
if self.embedding_vector_columns:
|
|
393
|
-
body[
|
|
431
|
+
body["embedding_vector_columns"] = [v.as_dict() for v in self.embedding_vector_columns]
|
|
394
432
|
if self.embedding_writeback_table is not None:
|
|
395
|
-
body[
|
|
396
|
-
if self.pipeline_id is not None:
|
|
397
|
-
|
|
398
|
-
if self.
|
|
433
|
+
body["embedding_writeback_table"] = self.embedding_writeback_table
|
|
434
|
+
if self.pipeline_id is not None:
|
|
435
|
+
body["pipeline_id"] = self.pipeline_id
|
|
436
|
+
if self.pipeline_type is not None:
|
|
437
|
+
body["pipeline_type"] = self.pipeline_type.value
|
|
438
|
+
if self.source_table is not None:
|
|
439
|
+
body["source_table"] = self.source_table
|
|
399
440
|
return body
|
|
400
441
|
|
|
401
442
|
def as_shallow_dict(self) -> dict:
|
|
402
443
|
"""Serializes the DeltaSyncVectorIndexSpecResponse into a shallow dictionary of its immediate attributes."""
|
|
403
444
|
body = {}
|
|
404
|
-
if self.embedding_source_columns:
|
|
405
|
-
|
|
445
|
+
if self.embedding_source_columns:
|
|
446
|
+
body["embedding_source_columns"] = self.embedding_source_columns
|
|
447
|
+
if self.embedding_vector_columns:
|
|
448
|
+
body["embedding_vector_columns"] = self.embedding_vector_columns
|
|
406
449
|
if self.embedding_writeback_table is not None:
|
|
407
|
-
body[
|
|
408
|
-
if self.pipeline_id is not None:
|
|
409
|
-
|
|
410
|
-
if self.
|
|
450
|
+
body["embedding_writeback_table"] = self.embedding_writeback_table
|
|
451
|
+
if self.pipeline_id is not None:
|
|
452
|
+
body["pipeline_id"] = self.pipeline_id
|
|
453
|
+
if self.pipeline_type is not None:
|
|
454
|
+
body["pipeline_type"] = self.pipeline_type
|
|
455
|
+
if self.source_table is not None:
|
|
456
|
+
body["source_table"] = self.source_table
|
|
411
457
|
return body
|
|
412
458
|
|
|
413
459
|
@classmethod
|
|
414
|
-
def from_dict(cls, d: Dict[str,
|
|
460
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeltaSyncVectorIndexSpecResponse:
|
|
415
461
|
"""Deserializes the DeltaSyncVectorIndexSpecResponse from a dictionary."""
|
|
416
|
-
return cls(
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
462
|
+
return cls(
|
|
463
|
+
embedding_source_columns=_repeated_dict(d, "embedding_source_columns", EmbeddingSourceColumn),
|
|
464
|
+
embedding_vector_columns=_repeated_dict(d, "embedding_vector_columns", EmbeddingVectorColumn),
|
|
465
|
+
embedding_writeback_table=d.get("embedding_writeback_table", None),
|
|
466
|
+
pipeline_id=d.get("pipeline_id", None),
|
|
467
|
+
pipeline_type=_enum(d, "pipeline_type", PipelineType),
|
|
468
|
+
source_table=d.get("source_table", None),
|
|
469
|
+
)
|
|
424
470
|
|
|
425
471
|
|
|
426
472
|
@dataclass
|
|
@@ -442,28 +488,32 @@ class DirectAccessVectorIndexSpec:
|
|
|
442
488
|
"""Serializes the DirectAccessVectorIndexSpec into a dictionary suitable for use as a JSON request body."""
|
|
443
489
|
body = {}
|
|
444
490
|
if self.embedding_source_columns:
|
|
445
|
-
body[
|
|
491
|
+
body["embedding_source_columns"] = [v.as_dict() for v in self.embedding_source_columns]
|
|
446
492
|
if self.embedding_vector_columns:
|
|
447
|
-
body[
|
|
448
|
-
if self.schema_json is not None:
|
|
493
|
+
body["embedding_vector_columns"] = [v.as_dict() for v in self.embedding_vector_columns]
|
|
494
|
+
if self.schema_json is not None:
|
|
495
|
+
body["schema_json"] = self.schema_json
|
|
449
496
|
return body
|
|
450
497
|
|
|
451
498
|
def as_shallow_dict(self) -> dict:
|
|
452
499
|
"""Serializes the DirectAccessVectorIndexSpec into a shallow dictionary of its immediate attributes."""
|
|
453
500
|
body = {}
|
|
454
|
-
if self.embedding_source_columns:
|
|
455
|
-
|
|
456
|
-
if self.
|
|
501
|
+
if self.embedding_source_columns:
|
|
502
|
+
body["embedding_source_columns"] = self.embedding_source_columns
|
|
503
|
+
if self.embedding_vector_columns:
|
|
504
|
+
body["embedding_vector_columns"] = self.embedding_vector_columns
|
|
505
|
+
if self.schema_json is not None:
|
|
506
|
+
body["schema_json"] = self.schema_json
|
|
457
507
|
return body
|
|
458
508
|
|
|
459
509
|
@classmethod
|
|
460
|
-
def from_dict(cls, d: Dict[str,
|
|
510
|
+
def from_dict(cls, d: Dict[str, Any]) -> DirectAccessVectorIndexSpec:
|
|
461
511
|
"""Deserializes the DirectAccessVectorIndexSpec from a dictionary."""
|
|
462
|
-
return cls(
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
512
|
+
return cls(
|
|
513
|
+
embedding_source_columns=_repeated_dict(d, "embedding_source_columns", EmbeddingSourceColumn),
|
|
514
|
+
embedding_vector_columns=_repeated_dict(d, "embedding_vector_columns", EmbeddingVectorColumn),
|
|
515
|
+
schema_json=d.get("schema_json", None),
|
|
516
|
+
)
|
|
467
517
|
|
|
468
518
|
|
|
469
519
|
@dataclass
|
|
@@ -478,23 +528,24 @@ class EmbeddingSourceColumn:
|
|
|
478
528
|
"""Serializes the EmbeddingSourceColumn into a dictionary suitable for use as a JSON request body."""
|
|
479
529
|
body = {}
|
|
480
530
|
if self.embedding_model_endpoint_name is not None:
|
|
481
|
-
body[
|
|
482
|
-
if self.name is not None:
|
|
531
|
+
body["embedding_model_endpoint_name"] = self.embedding_model_endpoint_name
|
|
532
|
+
if self.name is not None:
|
|
533
|
+
body["name"] = self.name
|
|
483
534
|
return body
|
|
484
535
|
|
|
485
536
|
def as_shallow_dict(self) -> dict:
|
|
486
537
|
"""Serializes the EmbeddingSourceColumn into a shallow dictionary of its immediate attributes."""
|
|
487
538
|
body = {}
|
|
488
539
|
if self.embedding_model_endpoint_name is not None:
|
|
489
|
-
body[
|
|
490
|
-
if self.name is not None:
|
|
540
|
+
body["embedding_model_endpoint_name"] = self.embedding_model_endpoint_name
|
|
541
|
+
if self.name is not None:
|
|
542
|
+
body["name"] = self.name
|
|
491
543
|
return body
|
|
492
544
|
|
|
493
545
|
@classmethod
|
|
494
|
-
def from_dict(cls, d: Dict[str,
|
|
546
|
+
def from_dict(cls, d: Dict[str, Any]) -> EmbeddingSourceColumn:
|
|
495
547
|
"""Deserializes the EmbeddingSourceColumn from a dictionary."""
|
|
496
|
-
return cls(embedding_model_endpoint_name=d.get(
|
|
497
|
-
name=d.get('name', None))
|
|
548
|
+
return cls(embedding_model_endpoint_name=d.get("embedding_model_endpoint_name", None), name=d.get("name", None))
|
|
498
549
|
|
|
499
550
|
|
|
500
551
|
@dataclass
|
|
@@ -508,21 +559,25 @@ class EmbeddingVectorColumn:
|
|
|
508
559
|
def as_dict(self) -> dict:
|
|
509
560
|
"""Serializes the EmbeddingVectorColumn into a dictionary suitable for use as a JSON request body."""
|
|
510
561
|
body = {}
|
|
511
|
-
if self.embedding_dimension is not None:
|
|
512
|
-
|
|
562
|
+
if self.embedding_dimension is not None:
|
|
563
|
+
body["embedding_dimension"] = self.embedding_dimension
|
|
564
|
+
if self.name is not None:
|
|
565
|
+
body["name"] = self.name
|
|
513
566
|
return body
|
|
514
567
|
|
|
515
568
|
def as_shallow_dict(self) -> dict:
|
|
516
569
|
"""Serializes the EmbeddingVectorColumn into a shallow dictionary of its immediate attributes."""
|
|
517
570
|
body = {}
|
|
518
|
-
if self.embedding_dimension is not None:
|
|
519
|
-
|
|
571
|
+
if self.embedding_dimension is not None:
|
|
572
|
+
body["embedding_dimension"] = self.embedding_dimension
|
|
573
|
+
if self.name is not None:
|
|
574
|
+
body["name"] = self.name
|
|
520
575
|
return body
|
|
521
576
|
|
|
522
577
|
@classmethod
|
|
523
|
-
def from_dict(cls, d: Dict[str,
|
|
578
|
+
def from_dict(cls, d: Dict[str, Any]) -> EmbeddingVectorColumn:
|
|
524
579
|
"""Deserializes the EmbeddingVectorColumn from a dictionary."""
|
|
525
|
-
return cls(embedding_dimension=d.get(
|
|
580
|
+
return cls(embedding_dimension=d.get("embedding_dimension", None), name=d.get("name", None))
|
|
526
581
|
|
|
527
582
|
|
|
528
583
|
@dataclass
|
|
@@ -557,45 +612,63 @@ class EndpointInfo:
|
|
|
557
612
|
def as_dict(self) -> dict:
|
|
558
613
|
"""Serializes the EndpointInfo into a dictionary suitable for use as a JSON request body."""
|
|
559
614
|
body = {}
|
|
560
|
-
if self.creation_timestamp is not None:
|
|
561
|
-
|
|
562
|
-
if self.
|
|
563
|
-
|
|
564
|
-
if self.
|
|
615
|
+
if self.creation_timestamp is not None:
|
|
616
|
+
body["creation_timestamp"] = self.creation_timestamp
|
|
617
|
+
if self.creator is not None:
|
|
618
|
+
body["creator"] = self.creator
|
|
619
|
+
if self.endpoint_status:
|
|
620
|
+
body["endpoint_status"] = self.endpoint_status.as_dict()
|
|
621
|
+
if self.endpoint_type is not None:
|
|
622
|
+
body["endpoint_type"] = self.endpoint_type.value
|
|
623
|
+
if self.id is not None:
|
|
624
|
+
body["id"] = self.id
|
|
565
625
|
if self.last_updated_timestamp is not None:
|
|
566
|
-
body[
|
|
567
|
-
if self.last_updated_user is not None:
|
|
568
|
-
|
|
569
|
-
if self.
|
|
626
|
+
body["last_updated_timestamp"] = self.last_updated_timestamp
|
|
627
|
+
if self.last_updated_user is not None:
|
|
628
|
+
body["last_updated_user"] = self.last_updated_user
|
|
629
|
+
if self.name is not None:
|
|
630
|
+
body["name"] = self.name
|
|
631
|
+
if self.num_indexes is not None:
|
|
632
|
+
body["num_indexes"] = self.num_indexes
|
|
570
633
|
return body
|
|
571
634
|
|
|
572
635
|
def as_shallow_dict(self) -> dict:
|
|
573
636
|
"""Serializes the EndpointInfo into a shallow dictionary of its immediate attributes."""
|
|
574
637
|
body = {}
|
|
575
|
-
if self.creation_timestamp is not None:
|
|
576
|
-
|
|
577
|
-
if self.
|
|
578
|
-
|
|
579
|
-
if self.
|
|
638
|
+
if self.creation_timestamp is not None:
|
|
639
|
+
body["creation_timestamp"] = self.creation_timestamp
|
|
640
|
+
if self.creator is not None:
|
|
641
|
+
body["creator"] = self.creator
|
|
642
|
+
if self.endpoint_status:
|
|
643
|
+
body["endpoint_status"] = self.endpoint_status
|
|
644
|
+
if self.endpoint_type is not None:
|
|
645
|
+
body["endpoint_type"] = self.endpoint_type
|
|
646
|
+
if self.id is not None:
|
|
647
|
+
body["id"] = self.id
|
|
580
648
|
if self.last_updated_timestamp is not None:
|
|
581
|
-
body[
|
|
582
|
-
if self.last_updated_user is not None:
|
|
583
|
-
|
|
584
|
-
if self.
|
|
649
|
+
body["last_updated_timestamp"] = self.last_updated_timestamp
|
|
650
|
+
if self.last_updated_user is not None:
|
|
651
|
+
body["last_updated_user"] = self.last_updated_user
|
|
652
|
+
if self.name is not None:
|
|
653
|
+
body["name"] = self.name
|
|
654
|
+
if self.num_indexes is not None:
|
|
655
|
+
body["num_indexes"] = self.num_indexes
|
|
585
656
|
return body
|
|
586
657
|
|
|
587
658
|
@classmethod
|
|
588
|
-
def from_dict(cls, d: Dict[str,
|
|
659
|
+
def from_dict(cls, d: Dict[str, Any]) -> EndpointInfo:
|
|
589
660
|
"""Deserializes the EndpointInfo from a dictionary."""
|
|
590
|
-
return cls(
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
661
|
+
return cls(
|
|
662
|
+
creation_timestamp=d.get("creation_timestamp", None),
|
|
663
|
+
creator=d.get("creator", None),
|
|
664
|
+
endpoint_status=_from_dict(d, "endpoint_status", EndpointStatus),
|
|
665
|
+
endpoint_type=_enum(d, "endpoint_type", EndpointType),
|
|
666
|
+
id=d.get("id", None),
|
|
667
|
+
last_updated_timestamp=d.get("last_updated_timestamp", None),
|
|
668
|
+
last_updated_user=d.get("last_updated_user", None),
|
|
669
|
+
name=d.get("name", None),
|
|
670
|
+
num_indexes=d.get("num_indexes", None),
|
|
671
|
+
)
|
|
599
672
|
|
|
600
673
|
|
|
601
674
|
@dataclass
|
|
@@ -611,35 +684,39 @@ class EndpointStatus:
|
|
|
611
684
|
def as_dict(self) -> dict:
|
|
612
685
|
"""Serializes the EndpointStatus into a dictionary suitable for use as a JSON request body."""
|
|
613
686
|
body = {}
|
|
614
|
-
if self.message is not None:
|
|
615
|
-
|
|
687
|
+
if self.message is not None:
|
|
688
|
+
body["message"] = self.message
|
|
689
|
+
if self.state is not None:
|
|
690
|
+
body["state"] = self.state.value
|
|
616
691
|
return body
|
|
617
692
|
|
|
618
693
|
def as_shallow_dict(self) -> dict:
|
|
619
694
|
"""Serializes the EndpointStatus into a shallow dictionary of its immediate attributes."""
|
|
620
695
|
body = {}
|
|
621
|
-
if self.message is not None:
|
|
622
|
-
|
|
696
|
+
if self.message is not None:
|
|
697
|
+
body["message"] = self.message
|
|
698
|
+
if self.state is not None:
|
|
699
|
+
body["state"] = self.state
|
|
623
700
|
return body
|
|
624
701
|
|
|
625
702
|
@classmethod
|
|
626
|
-
def from_dict(cls, d: Dict[str,
|
|
703
|
+
def from_dict(cls, d: Dict[str, Any]) -> EndpointStatus:
|
|
627
704
|
"""Deserializes the EndpointStatus from a dictionary."""
|
|
628
|
-
return cls(message=d.get(
|
|
705
|
+
return cls(message=d.get("message", None), state=_enum(d, "state", EndpointStatusState))
|
|
629
706
|
|
|
630
707
|
|
|
631
708
|
class EndpointStatusState(Enum):
|
|
632
709
|
"""Current state of the endpoint"""
|
|
633
710
|
|
|
634
|
-
OFFLINE =
|
|
635
|
-
ONLINE =
|
|
636
|
-
PROVISIONING =
|
|
711
|
+
OFFLINE = "OFFLINE"
|
|
712
|
+
ONLINE = "ONLINE"
|
|
713
|
+
PROVISIONING = "PROVISIONING"
|
|
637
714
|
|
|
638
715
|
|
|
639
716
|
class EndpointType(Enum):
|
|
640
717
|
"""Type of endpoint."""
|
|
641
718
|
|
|
642
|
-
STANDARD =
|
|
719
|
+
STANDARD = "STANDARD"
|
|
643
720
|
|
|
644
721
|
|
|
645
722
|
@dataclass
|
|
@@ -654,22 +731,27 @@ class ListEndpointResponse:
|
|
|
654
731
|
def as_dict(self) -> dict:
|
|
655
732
|
"""Serializes the ListEndpointResponse into a dictionary suitable for use as a JSON request body."""
|
|
656
733
|
body = {}
|
|
657
|
-
if self.endpoints:
|
|
658
|
-
|
|
734
|
+
if self.endpoints:
|
|
735
|
+
body["endpoints"] = [v.as_dict() for v in self.endpoints]
|
|
736
|
+
if self.next_page_token is not None:
|
|
737
|
+
body["next_page_token"] = self.next_page_token
|
|
659
738
|
return body
|
|
660
739
|
|
|
661
740
|
def as_shallow_dict(self) -> dict:
|
|
662
741
|
"""Serializes the ListEndpointResponse into a shallow dictionary of its immediate attributes."""
|
|
663
742
|
body = {}
|
|
664
|
-
if self.endpoints:
|
|
665
|
-
|
|
743
|
+
if self.endpoints:
|
|
744
|
+
body["endpoints"] = self.endpoints
|
|
745
|
+
if self.next_page_token is not None:
|
|
746
|
+
body["next_page_token"] = self.next_page_token
|
|
666
747
|
return body
|
|
667
748
|
|
|
668
749
|
@classmethod
|
|
669
|
-
def from_dict(cls, d: Dict[str,
|
|
750
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListEndpointResponse:
|
|
670
751
|
"""Deserializes the ListEndpointResponse from a dictionary."""
|
|
671
|
-
return cls(
|
|
672
|
-
|
|
752
|
+
return cls(
|
|
753
|
+
endpoints=_repeated_dict(d, "endpoints", EndpointInfo), next_page_token=d.get("next_page_token", None)
|
|
754
|
+
)
|
|
673
755
|
|
|
674
756
|
|
|
675
757
|
@dataclass
|
|
@@ -679,19 +761,21 @@ class ListValue:
|
|
|
679
761
|
def as_dict(self) -> dict:
|
|
680
762
|
"""Serializes the ListValue into a dictionary suitable for use as a JSON request body."""
|
|
681
763
|
body = {}
|
|
682
|
-
if self.values:
|
|
764
|
+
if self.values:
|
|
765
|
+
body["values"] = [v.as_dict() for v in self.values]
|
|
683
766
|
return body
|
|
684
767
|
|
|
685
768
|
def as_shallow_dict(self) -> dict:
|
|
686
769
|
"""Serializes the ListValue into a shallow dictionary of its immediate attributes."""
|
|
687
770
|
body = {}
|
|
688
|
-
if self.values:
|
|
771
|
+
if self.values:
|
|
772
|
+
body["values"] = self.values
|
|
689
773
|
return body
|
|
690
774
|
|
|
691
775
|
@classmethod
|
|
692
|
-
def from_dict(cls, d: Dict[str,
|
|
776
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListValue:
|
|
693
777
|
"""Deserializes the ListValue from a dictionary."""
|
|
694
|
-
return cls(values=_repeated_dict(d,
|
|
778
|
+
return cls(values=_repeated_dict(d, "values", Value))
|
|
695
779
|
|
|
696
780
|
|
|
697
781
|
@dataclass
|
|
@@ -705,22 +789,28 @@ class ListVectorIndexesResponse:
|
|
|
705
789
|
def as_dict(self) -> dict:
|
|
706
790
|
"""Serializes the ListVectorIndexesResponse into a dictionary suitable for use as a JSON request body."""
|
|
707
791
|
body = {}
|
|
708
|
-
if self.next_page_token is not None:
|
|
709
|
-
|
|
792
|
+
if self.next_page_token is not None:
|
|
793
|
+
body["next_page_token"] = self.next_page_token
|
|
794
|
+
if self.vector_indexes:
|
|
795
|
+
body["vector_indexes"] = [v.as_dict() for v in self.vector_indexes]
|
|
710
796
|
return body
|
|
711
797
|
|
|
712
798
|
def as_shallow_dict(self) -> dict:
|
|
713
799
|
"""Serializes the ListVectorIndexesResponse into a shallow dictionary of its immediate attributes."""
|
|
714
800
|
body = {}
|
|
715
|
-
if self.next_page_token is not None:
|
|
716
|
-
|
|
801
|
+
if self.next_page_token is not None:
|
|
802
|
+
body["next_page_token"] = self.next_page_token
|
|
803
|
+
if self.vector_indexes:
|
|
804
|
+
body["vector_indexes"] = self.vector_indexes
|
|
717
805
|
return body
|
|
718
806
|
|
|
719
807
|
@classmethod
|
|
720
|
-
def from_dict(cls, d: Dict[str,
|
|
808
|
+
def from_dict(cls, d: Dict[str, Any]) -> ListVectorIndexesResponse:
|
|
721
809
|
"""Deserializes the ListVectorIndexesResponse from a dictionary."""
|
|
722
|
-
return cls(
|
|
723
|
-
|
|
810
|
+
return cls(
|
|
811
|
+
next_page_token=d.get("next_page_token", None),
|
|
812
|
+
vector_indexes=_repeated_dict(d, "vector_indexes", MiniVectorIndex),
|
|
813
|
+
)
|
|
724
814
|
|
|
725
815
|
|
|
726
816
|
@dataclass
|
|
@@ -736,21 +826,25 @@ class MapStringValueEntry:
|
|
|
736
826
|
def as_dict(self) -> dict:
|
|
737
827
|
"""Serializes the MapStringValueEntry into a dictionary suitable for use as a JSON request body."""
|
|
738
828
|
body = {}
|
|
739
|
-
if self.key is not None:
|
|
740
|
-
|
|
829
|
+
if self.key is not None:
|
|
830
|
+
body["key"] = self.key
|
|
831
|
+
if self.value:
|
|
832
|
+
body["value"] = self.value.as_dict()
|
|
741
833
|
return body
|
|
742
834
|
|
|
743
835
|
def as_shallow_dict(self) -> dict:
|
|
744
836
|
"""Serializes the MapStringValueEntry into a shallow dictionary of its immediate attributes."""
|
|
745
837
|
body = {}
|
|
746
|
-
if self.key is not None:
|
|
747
|
-
|
|
838
|
+
if self.key is not None:
|
|
839
|
+
body["key"] = self.key
|
|
840
|
+
if self.value:
|
|
841
|
+
body["value"] = self.value
|
|
748
842
|
return body
|
|
749
843
|
|
|
750
844
|
@classmethod
|
|
751
|
-
def from_dict(cls, d: Dict[str,
|
|
845
|
+
def from_dict(cls, d: Dict[str, Any]) -> MapStringValueEntry:
|
|
752
846
|
"""Deserializes the MapStringValueEntry from a dictionary."""
|
|
753
|
-
return cls(key=d.get(
|
|
847
|
+
return cls(key=d.get("key", None), value=_from_dict(d, "value", Value))
|
|
754
848
|
|
|
755
849
|
|
|
756
850
|
@dataclass
|
|
@@ -778,44 +872,56 @@ class MiniVectorIndex:
|
|
|
778
872
|
def as_dict(self) -> dict:
|
|
779
873
|
"""Serializes the MiniVectorIndex into a dictionary suitable for use as a JSON request body."""
|
|
780
874
|
body = {}
|
|
781
|
-
if self.creator is not None:
|
|
782
|
-
|
|
783
|
-
if self.
|
|
784
|
-
|
|
785
|
-
if self.
|
|
875
|
+
if self.creator is not None:
|
|
876
|
+
body["creator"] = self.creator
|
|
877
|
+
if self.endpoint_name is not None:
|
|
878
|
+
body["endpoint_name"] = self.endpoint_name
|
|
879
|
+
if self.index_type is not None:
|
|
880
|
+
body["index_type"] = self.index_type.value
|
|
881
|
+
if self.name is not None:
|
|
882
|
+
body["name"] = self.name
|
|
883
|
+
if self.primary_key is not None:
|
|
884
|
+
body["primary_key"] = self.primary_key
|
|
786
885
|
return body
|
|
787
886
|
|
|
788
887
|
def as_shallow_dict(self) -> dict:
|
|
789
888
|
"""Serializes the MiniVectorIndex into a shallow dictionary of its immediate attributes."""
|
|
790
889
|
body = {}
|
|
791
|
-
if self.creator is not None:
|
|
792
|
-
|
|
793
|
-
if self.
|
|
794
|
-
|
|
795
|
-
if self.
|
|
890
|
+
if self.creator is not None:
|
|
891
|
+
body["creator"] = self.creator
|
|
892
|
+
if self.endpoint_name is not None:
|
|
893
|
+
body["endpoint_name"] = self.endpoint_name
|
|
894
|
+
if self.index_type is not None:
|
|
895
|
+
body["index_type"] = self.index_type
|
|
896
|
+
if self.name is not None:
|
|
897
|
+
body["name"] = self.name
|
|
898
|
+
if self.primary_key is not None:
|
|
899
|
+
body["primary_key"] = self.primary_key
|
|
796
900
|
return body
|
|
797
901
|
|
|
798
902
|
@classmethod
|
|
799
|
-
def from_dict(cls, d: Dict[str,
|
|
903
|
+
def from_dict(cls, d: Dict[str, Any]) -> MiniVectorIndex:
|
|
800
904
|
"""Deserializes the MiniVectorIndex from a dictionary."""
|
|
801
|
-
return cls(
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
905
|
+
return cls(
|
|
906
|
+
creator=d.get("creator", None),
|
|
907
|
+
endpoint_name=d.get("endpoint_name", None),
|
|
908
|
+
index_type=_enum(d, "index_type", VectorIndexType),
|
|
909
|
+
name=d.get("name", None),
|
|
910
|
+
primary_key=d.get("primary_key", None),
|
|
911
|
+
)
|
|
806
912
|
|
|
807
913
|
|
|
808
914
|
class PipelineType(Enum):
|
|
809
915
|
"""Pipeline execution mode.
|
|
810
|
-
|
|
916
|
+
|
|
811
917
|
- `TRIGGERED`: If the pipeline uses the triggered execution mode, the system stops processing
|
|
812
918
|
after successfully refreshing the source table in the pipeline once, ensuring the table is
|
|
813
919
|
updated based on the data available when the update started. - `CONTINUOUS`: If the pipeline
|
|
814
920
|
uses continuous execution, the pipeline processes new data as it arrives in the source table to
|
|
815
921
|
keep vector index fresh."""
|
|
816
922
|
|
|
817
|
-
CONTINUOUS =
|
|
818
|
-
TRIGGERED =
|
|
923
|
+
CONTINUOUS = "CONTINUOUS"
|
|
924
|
+
TRIGGERED = "TRIGGERED"
|
|
819
925
|
|
|
820
926
|
|
|
821
927
|
@dataclass
|
|
@@ -834,25 +940,33 @@ class QueryVectorIndexNextPageRequest:
|
|
|
834
940
|
def as_dict(self) -> dict:
|
|
835
941
|
"""Serializes the QueryVectorIndexNextPageRequest into a dictionary suitable for use as a JSON request body."""
|
|
836
942
|
body = {}
|
|
837
|
-
if self.endpoint_name is not None:
|
|
838
|
-
|
|
839
|
-
if self.
|
|
943
|
+
if self.endpoint_name is not None:
|
|
944
|
+
body["endpoint_name"] = self.endpoint_name
|
|
945
|
+
if self.index_name is not None:
|
|
946
|
+
body["index_name"] = self.index_name
|
|
947
|
+
if self.page_token is not None:
|
|
948
|
+
body["page_token"] = self.page_token
|
|
840
949
|
return body
|
|
841
950
|
|
|
842
951
|
def as_shallow_dict(self) -> dict:
|
|
843
952
|
"""Serializes the QueryVectorIndexNextPageRequest into a shallow dictionary of its immediate attributes."""
|
|
844
953
|
body = {}
|
|
845
|
-
if self.endpoint_name is not None:
|
|
846
|
-
|
|
847
|
-
if self.
|
|
954
|
+
if self.endpoint_name is not None:
|
|
955
|
+
body["endpoint_name"] = self.endpoint_name
|
|
956
|
+
if self.index_name is not None:
|
|
957
|
+
body["index_name"] = self.index_name
|
|
958
|
+
if self.page_token is not None:
|
|
959
|
+
body["page_token"] = self.page_token
|
|
848
960
|
return body
|
|
849
961
|
|
|
850
962
|
@classmethod
|
|
851
|
-
def from_dict(cls, d: Dict[str,
|
|
963
|
+
def from_dict(cls, d: Dict[str, Any]) -> QueryVectorIndexNextPageRequest:
|
|
852
964
|
"""Deserializes the QueryVectorIndexNextPageRequest from a dictionary."""
|
|
853
|
-
return cls(
|
|
854
|
-
|
|
855
|
-
|
|
965
|
+
return cls(
|
|
966
|
+
endpoint_name=d.get("endpoint_name", None),
|
|
967
|
+
index_name=d.get("index_name", None),
|
|
968
|
+
page_token=d.get("page_token", None),
|
|
969
|
+
)
|
|
856
970
|
|
|
857
971
|
|
|
858
972
|
@dataclass
|
|
@@ -860,6 +974,9 @@ class QueryVectorIndexRequest:
|
|
|
860
974
|
columns: List[str]
|
|
861
975
|
"""List of column names to include in the response."""
|
|
862
976
|
|
|
977
|
+
columns_to_rerank: Optional[List[str]] = None
|
|
978
|
+
"""Column names used to retrieve data to send to the reranker."""
|
|
979
|
+
|
|
863
980
|
filters_json: Optional[str] = None
|
|
864
981
|
"""JSON string representing query filters.
|
|
865
982
|
|
|
@@ -889,40 +1006,63 @@ class QueryVectorIndexRequest:
|
|
|
889
1006
|
def as_dict(self) -> dict:
|
|
890
1007
|
"""Serializes the QueryVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
891
1008
|
body = {}
|
|
892
|
-
if self.columns:
|
|
893
|
-
|
|
894
|
-
if self.
|
|
895
|
-
|
|
896
|
-
if self.
|
|
897
|
-
|
|
898
|
-
if self.
|
|
899
|
-
|
|
1009
|
+
if self.columns:
|
|
1010
|
+
body["columns"] = [v for v in self.columns]
|
|
1011
|
+
if self.columns_to_rerank:
|
|
1012
|
+
body["columns_to_rerank"] = [v for v in self.columns_to_rerank]
|
|
1013
|
+
if self.filters_json is not None:
|
|
1014
|
+
body["filters_json"] = self.filters_json
|
|
1015
|
+
if self.index_name is not None:
|
|
1016
|
+
body["index_name"] = self.index_name
|
|
1017
|
+
if self.num_results is not None:
|
|
1018
|
+
body["num_results"] = self.num_results
|
|
1019
|
+
if self.query_text is not None:
|
|
1020
|
+
body["query_text"] = self.query_text
|
|
1021
|
+
if self.query_type is not None:
|
|
1022
|
+
body["query_type"] = self.query_type
|
|
1023
|
+
if self.query_vector:
|
|
1024
|
+
body["query_vector"] = [v for v in self.query_vector]
|
|
1025
|
+
if self.score_threshold is not None:
|
|
1026
|
+
body["score_threshold"] = self.score_threshold
|
|
900
1027
|
return body
|
|
901
1028
|
|
|
902
1029
|
def as_shallow_dict(self) -> dict:
|
|
903
1030
|
"""Serializes the QueryVectorIndexRequest into a shallow dictionary of its immediate attributes."""
|
|
904
1031
|
body = {}
|
|
905
|
-
if self.columns:
|
|
906
|
-
|
|
907
|
-
if self.
|
|
908
|
-
|
|
909
|
-
if self.
|
|
910
|
-
|
|
911
|
-
if self.
|
|
912
|
-
|
|
1032
|
+
if self.columns:
|
|
1033
|
+
body["columns"] = self.columns
|
|
1034
|
+
if self.columns_to_rerank:
|
|
1035
|
+
body["columns_to_rerank"] = self.columns_to_rerank
|
|
1036
|
+
if self.filters_json is not None:
|
|
1037
|
+
body["filters_json"] = self.filters_json
|
|
1038
|
+
if self.index_name is not None:
|
|
1039
|
+
body["index_name"] = self.index_name
|
|
1040
|
+
if self.num_results is not None:
|
|
1041
|
+
body["num_results"] = self.num_results
|
|
1042
|
+
if self.query_text is not None:
|
|
1043
|
+
body["query_text"] = self.query_text
|
|
1044
|
+
if self.query_type is not None:
|
|
1045
|
+
body["query_type"] = self.query_type
|
|
1046
|
+
if self.query_vector:
|
|
1047
|
+
body["query_vector"] = self.query_vector
|
|
1048
|
+
if self.score_threshold is not None:
|
|
1049
|
+
body["score_threshold"] = self.score_threshold
|
|
913
1050
|
return body
|
|
914
1051
|
|
|
915
1052
|
@classmethod
|
|
916
|
-
def from_dict(cls, d: Dict[str,
|
|
1053
|
+
def from_dict(cls, d: Dict[str, Any]) -> QueryVectorIndexRequest:
|
|
917
1054
|
"""Deserializes the QueryVectorIndexRequest from a dictionary."""
|
|
918
|
-
return cls(
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
1055
|
+
return cls(
|
|
1056
|
+
columns=d.get("columns", None),
|
|
1057
|
+
columns_to_rerank=d.get("columns_to_rerank", None),
|
|
1058
|
+
filters_json=d.get("filters_json", None),
|
|
1059
|
+
index_name=d.get("index_name", None),
|
|
1060
|
+
num_results=d.get("num_results", None),
|
|
1061
|
+
query_text=d.get("query_text", None),
|
|
1062
|
+
query_type=d.get("query_type", None),
|
|
1063
|
+
query_vector=d.get("query_vector", None),
|
|
1064
|
+
score_threshold=d.get("score_threshold", None),
|
|
1065
|
+
)
|
|
926
1066
|
|
|
927
1067
|
|
|
928
1068
|
@dataclass
|
|
@@ -933,7 +1073,7 @@ class QueryVectorIndexResponse:
|
|
|
933
1073
|
next_page_token: Optional[str] = None
|
|
934
1074
|
"""[Optional] Token that can be used in `QueryVectorIndexNextPage` API to get next page of results.
|
|
935
1075
|
If more than 1000 results satisfy the query, they are returned in groups of 1000. Empty value
|
|
936
|
-
means no more results."""
|
|
1076
|
+
means no more results. The maximum number of results that can be returned is 10,000."""
|
|
937
1077
|
|
|
938
1078
|
result: Optional[ResultData] = None
|
|
939
1079
|
"""Data returned in the query result."""
|
|
@@ -941,25 +1081,33 @@ class QueryVectorIndexResponse:
|
|
|
941
1081
|
def as_dict(self) -> dict:
|
|
942
1082
|
"""Serializes the QueryVectorIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
943
1083
|
body = {}
|
|
944
|
-
if self.manifest:
|
|
945
|
-
|
|
946
|
-
if self.
|
|
1084
|
+
if self.manifest:
|
|
1085
|
+
body["manifest"] = self.manifest.as_dict()
|
|
1086
|
+
if self.next_page_token is not None:
|
|
1087
|
+
body["next_page_token"] = self.next_page_token
|
|
1088
|
+
if self.result:
|
|
1089
|
+
body["result"] = self.result.as_dict()
|
|
947
1090
|
return body
|
|
948
1091
|
|
|
949
1092
|
def as_shallow_dict(self) -> dict:
|
|
950
1093
|
"""Serializes the QueryVectorIndexResponse into a shallow dictionary of its immediate attributes."""
|
|
951
1094
|
body = {}
|
|
952
|
-
if self.manifest:
|
|
953
|
-
|
|
954
|
-
if self.
|
|
1095
|
+
if self.manifest:
|
|
1096
|
+
body["manifest"] = self.manifest
|
|
1097
|
+
if self.next_page_token is not None:
|
|
1098
|
+
body["next_page_token"] = self.next_page_token
|
|
1099
|
+
if self.result:
|
|
1100
|
+
body["result"] = self.result
|
|
955
1101
|
return body
|
|
956
1102
|
|
|
957
1103
|
@classmethod
|
|
958
|
-
def from_dict(cls, d: Dict[str,
|
|
1104
|
+
def from_dict(cls, d: Dict[str, Any]) -> QueryVectorIndexResponse:
|
|
959
1105
|
"""Deserializes the QueryVectorIndexResponse from a dictionary."""
|
|
960
|
-
return cls(
|
|
961
|
-
|
|
962
|
-
|
|
1106
|
+
return cls(
|
|
1107
|
+
manifest=_from_dict(d, "manifest", ResultManifest),
|
|
1108
|
+
next_page_token=d.get("next_page_token", None),
|
|
1109
|
+
result=_from_dict(d, "result", ResultData),
|
|
1110
|
+
)
|
|
963
1111
|
|
|
964
1112
|
|
|
965
1113
|
@dataclass
|
|
@@ -975,21 +1123,25 @@ class ResultData:
|
|
|
975
1123
|
def as_dict(self) -> dict:
|
|
976
1124
|
"""Serializes the ResultData into a dictionary suitable for use as a JSON request body."""
|
|
977
1125
|
body = {}
|
|
978
|
-
if self.data_array:
|
|
979
|
-
|
|
1126
|
+
if self.data_array:
|
|
1127
|
+
body["data_array"] = [v for v in self.data_array]
|
|
1128
|
+
if self.row_count is not None:
|
|
1129
|
+
body["row_count"] = self.row_count
|
|
980
1130
|
return body
|
|
981
1131
|
|
|
982
1132
|
def as_shallow_dict(self) -> dict:
|
|
983
1133
|
"""Serializes the ResultData into a shallow dictionary of its immediate attributes."""
|
|
984
1134
|
body = {}
|
|
985
|
-
if self.data_array:
|
|
986
|
-
|
|
1135
|
+
if self.data_array:
|
|
1136
|
+
body["data_array"] = self.data_array
|
|
1137
|
+
if self.row_count is not None:
|
|
1138
|
+
body["row_count"] = self.row_count
|
|
987
1139
|
return body
|
|
988
1140
|
|
|
989
1141
|
@classmethod
|
|
990
|
-
def from_dict(cls, d: Dict[str,
|
|
1142
|
+
def from_dict(cls, d: Dict[str, Any]) -> ResultData:
|
|
991
1143
|
"""Deserializes the ResultData from a dictionary."""
|
|
992
|
-
return cls(data_array=d.get(
|
|
1144
|
+
return cls(data_array=d.get("data_array", None), row_count=d.get("row_count", None))
|
|
993
1145
|
|
|
994
1146
|
|
|
995
1147
|
@dataclass
|
|
@@ -1005,21 +1157,25 @@ class ResultManifest:
|
|
|
1005
1157
|
def as_dict(self) -> dict:
|
|
1006
1158
|
"""Serializes the ResultManifest into a dictionary suitable for use as a JSON request body."""
|
|
1007
1159
|
body = {}
|
|
1008
|
-
if self.column_count is not None:
|
|
1009
|
-
|
|
1160
|
+
if self.column_count is not None:
|
|
1161
|
+
body["column_count"] = self.column_count
|
|
1162
|
+
if self.columns:
|
|
1163
|
+
body["columns"] = [v.as_dict() for v in self.columns]
|
|
1010
1164
|
return body
|
|
1011
1165
|
|
|
1012
1166
|
def as_shallow_dict(self) -> dict:
|
|
1013
1167
|
"""Serializes the ResultManifest into a shallow dictionary of its immediate attributes."""
|
|
1014
1168
|
body = {}
|
|
1015
|
-
if self.column_count is not None:
|
|
1016
|
-
|
|
1169
|
+
if self.column_count is not None:
|
|
1170
|
+
body["column_count"] = self.column_count
|
|
1171
|
+
if self.columns:
|
|
1172
|
+
body["columns"] = self.columns
|
|
1017
1173
|
return body
|
|
1018
1174
|
|
|
1019
1175
|
@classmethod
|
|
1020
|
-
def from_dict(cls, d: Dict[str,
|
|
1176
|
+
def from_dict(cls, d: Dict[str, Any]) -> ResultManifest:
|
|
1021
1177
|
"""Deserializes the ResultManifest from a dictionary."""
|
|
1022
|
-
return cls(column_count=d.get(
|
|
1178
|
+
return cls(column_count=d.get("column_count", None), columns=_repeated_dict(d, "columns", ColumnInfo))
|
|
1023
1179
|
|
|
1024
1180
|
|
|
1025
1181
|
@dataclass
|
|
@@ -1038,25 +1194,33 @@ class ScanVectorIndexRequest:
|
|
|
1038
1194
|
def as_dict(self) -> dict:
|
|
1039
1195
|
"""Serializes the ScanVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
1040
1196
|
body = {}
|
|
1041
|
-
if self.index_name is not None:
|
|
1042
|
-
|
|
1043
|
-
if self.
|
|
1197
|
+
if self.index_name is not None:
|
|
1198
|
+
body["index_name"] = self.index_name
|
|
1199
|
+
if self.last_primary_key is not None:
|
|
1200
|
+
body["last_primary_key"] = self.last_primary_key
|
|
1201
|
+
if self.num_results is not None:
|
|
1202
|
+
body["num_results"] = self.num_results
|
|
1044
1203
|
return body
|
|
1045
1204
|
|
|
1046
1205
|
def as_shallow_dict(self) -> dict:
|
|
1047
1206
|
"""Serializes the ScanVectorIndexRequest into a shallow dictionary of its immediate attributes."""
|
|
1048
1207
|
body = {}
|
|
1049
|
-
if self.index_name is not None:
|
|
1050
|
-
|
|
1051
|
-
if self.
|
|
1208
|
+
if self.index_name is not None:
|
|
1209
|
+
body["index_name"] = self.index_name
|
|
1210
|
+
if self.last_primary_key is not None:
|
|
1211
|
+
body["last_primary_key"] = self.last_primary_key
|
|
1212
|
+
if self.num_results is not None:
|
|
1213
|
+
body["num_results"] = self.num_results
|
|
1052
1214
|
return body
|
|
1053
1215
|
|
|
1054
1216
|
@classmethod
|
|
1055
|
-
def from_dict(cls, d: Dict[str,
|
|
1217
|
+
def from_dict(cls, d: Dict[str, Any]) -> ScanVectorIndexRequest:
|
|
1056
1218
|
"""Deserializes the ScanVectorIndexRequest from a dictionary."""
|
|
1057
|
-
return cls(
|
|
1058
|
-
|
|
1059
|
-
|
|
1219
|
+
return cls(
|
|
1220
|
+
index_name=d.get("index_name", None),
|
|
1221
|
+
last_primary_key=d.get("last_primary_key", None),
|
|
1222
|
+
num_results=d.get("num_results", None),
|
|
1223
|
+
)
|
|
1060
1224
|
|
|
1061
1225
|
|
|
1062
1226
|
@dataclass
|
|
@@ -1072,21 +1236,25 @@ class ScanVectorIndexResponse:
|
|
|
1072
1236
|
def as_dict(self) -> dict:
|
|
1073
1237
|
"""Serializes the ScanVectorIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
1074
1238
|
body = {}
|
|
1075
|
-
if self.data:
|
|
1076
|
-
|
|
1239
|
+
if self.data:
|
|
1240
|
+
body["data"] = [v.as_dict() for v in self.data]
|
|
1241
|
+
if self.last_primary_key is not None:
|
|
1242
|
+
body["last_primary_key"] = self.last_primary_key
|
|
1077
1243
|
return body
|
|
1078
1244
|
|
|
1079
1245
|
def as_shallow_dict(self) -> dict:
|
|
1080
1246
|
"""Serializes the ScanVectorIndexResponse into a shallow dictionary of its immediate attributes."""
|
|
1081
1247
|
body = {}
|
|
1082
|
-
if self.data:
|
|
1083
|
-
|
|
1248
|
+
if self.data:
|
|
1249
|
+
body["data"] = self.data
|
|
1250
|
+
if self.last_primary_key is not None:
|
|
1251
|
+
body["last_primary_key"] = self.last_primary_key
|
|
1084
1252
|
return body
|
|
1085
1253
|
|
|
1086
1254
|
@classmethod
|
|
1087
|
-
def from_dict(cls, d: Dict[str,
|
|
1255
|
+
def from_dict(cls, d: Dict[str, Any]) -> ScanVectorIndexResponse:
|
|
1088
1256
|
"""Deserializes the ScanVectorIndexResponse from a dictionary."""
|
|
1089
|
-
return cls(data=_repeated_dict(d,
|
|
1257
|
+
return cls(data=_repeated_dict(d, "data", Struct), last_primary_key=d.get("last_primary_key", None))
|
|
1090
1258
|
|
|
1091
1259
|
|
|
1092
1260
|
@dataclass
|
|
@@ -1097,24 +1265,25 @@ class Struct:
|
|
|
1097
1265
|
def as_dict(self) -> dict:
|
|
1098
1266
|
"""Serializes the Struct into a dictionary suitable for use as a JSON request body."""
|
|
1099
1267
|
body = {}
|
|
1100
|
-
if self.fields:
|
|
1268
|
+
if self.fields:
|
|
1269
|
+
body["fields"] = [v.as_dict() for v in self.fields]
|
|
1101
1270
|
return body
|
|
1102
1271
|
|
|
1103
1272
|
def as_shallow_dict(self) -> dict:
|
|
1104
1273
|
"""Serializes the Struct into a shallow dictionary of its immediate attributes."""
|
|
1105
1274
|
body = {}
|
|
1106
|
-
if self.fields:
|
|
1275
|
+
if self.fields:
|
|
1276
|
+
body["fields"] = self.fields
|
|
1107
1277
|
return body
|
|
1108
1278
|
|
|
1109
1279
|
@classmethod
|
|
1110
|
-
def from_dict(cls, d: Dict[str,
|
|
1280
|
+
def from_dict(cls, d: Dict[str, Any]) -> Struct:
|
|
1111
1281
|
"""Deserializes the Struct from a dictionary."""
|
|
1112
|
-
return cls(fields=_repeated_dict(d,
|
|
1282
|
+
return cls(fields=_repeated_dict(d, "fields", MapStringValueEntry))
|
|
1113
1283
|
|
|
1114
1284
|
|
|
1115
1285
|
@dataclass
|
|
1116
1286
|
class SyncIndexResponse:
|
|
1117
|
-
|
|
1118
1287
|
def as_dict(self) -> dict:
|
|
1119
1288
|
"""Serializes the SyncIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
1120
1289
|
body = {}
|
|
@@ -1126,7 +1295,7 @@ class SyncIndexResponse:
|
|
|
1126
1295
|
return body
|
|
1127
1296
|
|
|
1128
1297
|
@classmethod
|
|
1129
|
-
def from_dict(cls, d: Dict[str,
|
|
1298
|
+
def from_dict(cls, d: Dict[str, Any]) -> SyncIndexResponse:
|
|
1130
1299
|
"""Deserializes the SyncIndexResponse from a dictionary."""
|
|
1131
1300
|
return cls()
|
|
1132
1301
|
|
|
@@ -1144,30 +1313,35 @@ class UpsertDataResult:
|
|
|
1144
1313
|
def as_dict(self) -> dict:
|
|
1145
1314
|
"""Serializes the UpsertDataResult into a dictionary suitable for use as a JSON request body."""
|
|
1146
1315
|
body = {}
|
|
1147
|
-
if self.failed_primary_keys:
|
|
1148
|
-
|
|
1316
|
+
if self.failed_primary_keys:
|
|
1317
|
+
body["failed_primary_keys"] = [v for v in self.failed_primary_keys]
|
|
1318
|
+
if self.success_row_count is not None:
|
|
1319
|
+
body["success_row_count"] = self.success_row_count
|
|
1149
1320
|
return body
|
|
1150
1321
|
|
|
1151
1322
|
def as_shallow_dict(self) -> dict:
|
|
1152
1323
|
"""Serializes the UpsertDataResult into a shallow dictionary of its immediate attributes."""
|
|
1153
1324
|
body = {}
|
|
1154
|
-
if self.failed_primary_keys:
|
|
1155
|
-
|
|
1325
|
+
if self.failed_primary_keys:
|
|
1326
|
+
body["failed_primary_keys"] = self.failed_primary_keys
|
|
1327
|
+
if self.success_row_count is not None:
|
|
1328
|
+
body["success_row_count"] = self.success_row_count
|
|
1156
1329
|
return body
|
|
1157
1330
|
|
|
1158
1331
|
@classmethod
|
|
1159
|
-
def from_dict(cls, d: Dict[str,
|
|
1332
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpsertDataResult:
|
|
1160
1333
|
"""Deserializes the UpsertDataResult from a dictionary."""
|
|
1161
|
-
return cls(
|
|
1162
|
-
|
|
1334
|
+
return cls(
|
|
1335
|
+
failed_primary_keys=d.get("failed_primary_keys", None), success_row_count=d.get("success_row_count", None)
|
|
1336
|
+
)
|
|
1163
1337
|
|
|
1164
1338
|
|
|
1165
1339
|
class UpsertDataStatus(Enum):
|
|
1166
1340
|
"""Status of the upsert operation."""
|
|
1167
1341
|
|
|
1168
|
-
FAILURE =
|
|
1169
|
-
PARTIAL_SUCCESS =
|
|
1170
|
-
SUCCESS =
|
|
1342
|
+
FAILURE = "FAILURE"
|
|
1343
|
+
PARTIAL_SUCCESS = "PARTIAL_SUCCESS"
|
|
1344
|
+
SUCCESS = "SUCCESS"
|
|
1171
1345
|
|
|
1172
1346
|
|
|
1173
1347
|
@dataclass
|
|
@@ -1183,21 +1357,25 @@ class UpsertDataVectorIndexRequest:
|
|
|
1183
1357
|
def as_dict(self) -> dict:
|
|
1184
1358
|
"""Serializes the UpsertDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
1185
1359
|
body = {}
|
|
1186
|
-
if self.index_name is not None:
|
|
1187
|
-
|
|
1360
|
+
if self.index_name is not None:
|
|
1361
|
+
body["index_name"] = self.index_name
|
|
1362
|
+
if self.inputs_json is not None:
|
|
1363
|
+
body["inputs_json"] = self.inputs_json
|
|
1188
1364
|
return body
|
|
1189
1365
|
|
|
1190
1366
|
def as_shallow_dict(self) -> dict:
|
|
1191
1367
|
"""Serializes the UpsertDataVectorIndexRequest into a shallow dictionary of its immediate attributes."""
|
|
1192
1368
|
body = {}
|
|
1193
|
-
if self.index_name is not None:
|
|
1194
|
-
|
|
1369
|
+
if self.index_name is not None:
|
|
1370
|
+
body["index_name"] = self.index_name
|
|
1371
|
+
if self.inputs_json is not None:
|
|
1372
|
+
body["inputs_json"] = self.inputs_json
|
|
1195
1373
|
return body
|
|
1196
1374
|
|
|
1197
1375
|
@classmethod
|
|
1198
|
-
def from_dict(cls, d: Dict[str,
|
|
1376
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpsertDataVectorIndexRequest:
|
|
1199
1377
|
"""Deserializes the UpsertDataVectorIndexRequest from a dictionary."""
|
|
1200
|
-
return cls(index_name=d.get(
|
|
1378
|
+
return cls(index_name=d.get("index_name", None), inputs_json=d.get("inputs_json", None))
|
|
1201
1379
|
|
|
1202
1380
|
|
|
1203
1381
|
@dataclass
|
|
@@ -1213,22 +1391,25 @@ class UpsertDataVectorIndexResponse:
|
|
|
1213
1391
|
def as_dict(self) -> dict:
|
|
1214
1392
|
"""Serializes the UpsertDataVectorIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
1215
1393
|
body = {}
|
|
1216
|
-
if self.result:
|
|
1217
|
-
|
|
1394
|
+
if self.result:
|
|
1395
|
+
body["result"] = self.result.as_dict()
|
|
1396
|
+
if self.status is not None:
|
|
1397
|
+
body["status"] = self.status.value
|
|
1218
1398
|
return body
|
|
1219
1399
|
|
|
1220
1400
|
def as_shallow_dict(self) -> dict:
|
|
1221
1401
|
"""Serializes the UpsertDataVectorIndexResponse into a shallow dictionary of its immediate attributes."""
|
|
1222
1402
|
body = {}
|
|
1223
|
-
if self.result:
|
|
1224
|
-
|
|
1403
|
+
if self.result:
|
|
1404
|
+
body["result"] = self.result
|
|
1405
|
+
if self.status is not None:
|
|
1406
|
+
body["status"] = self.status
|
|
1225
1407
|
return body
|
|
1226
1408
|
|
|
1227
1409
|
@classmethod
|
|
1228
|
-
def from_dict(cls, d: Dict[str,
|
|
1410
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpsertDataVectorIndexResponse:
|
|
1229
1411
|
"""Deserializes the UpsertDataVectorIndexResponse from a dictionary."""
|
|
1230
|
-
return cls(result=_from_dict(d,
|
|
1231
|
-
status=_enum(d, 'status', UpsertDataStatus))
|
|
1412
|
+
return cls(result=_from_dict(d, "result", UpsertDataResult), status=_enum(d, "status", UpsertDataStatus))
|
|
1232
1413
|
|
|
1233
1414
|
|
|
1234
1415
|
@dataclass
|
|
@@ -1248,34 +1429,48 @@ class Value:
|
|
|
1248
1429
|
def as_dict(self) -> dict:
|
|
1249
1430
|
"""Serializes the Value into a dictionary suitable for use as a JSON request body."""
|
|
1250
1431
|
body = {}
|
|
1251
|
-
if self.bool_value is not None:
|
|
1252
|
-
|
|
1253
|
-
if self.
|
|
1254
|
-
|
|
1255
|
-
if self.
|
|
1256
|
-
|
|
1432
|
+
if self.bool_value is not None:
|
|
1433
|
+
body["bool_value"] = self.bool_value
|
|
1434
|
+
if self.list_value:
|
|
1435
|
+
body["list_value"] = self.list_value.as_dict()
|
|
1436
|
+
if self.null_value is not None:
|
|
1437
|
+
body["null_value"] = self.null_value
|
|
1438
|
+
if self.number_value is not None:
|
|
1439
|
+
body["number_value"] = self.number_value
|
|
1440
|
+
if self.string_value is not None:
|
|
1441
|
+
body["string_value"] = self.string_value
|
|
1442
|
+
if self.struct_value:
|
|
1443
|
+
body["struct_value"] = self.struct_value.as_dict()
|
|
1257
1444
|
return body
|
|
1258
1445
|
|
|
1259
1446
|
def as_shallow_dict(self) -> dict:
|
|
1260
1447
|
"""Serializes the Value into a shallow dictionary of its immediate attributes."""
|
|
1261
1448
|
body = {}
|
|
1262
|
-
if self.bool_value is not None:
|
|
1263
|
-
|
|
1264
|
-
if self.
|
|
1265
|
-
|
|
1266
|
-
if self.
|
|
1267
|
-
|
|
1449
|
+
if self.bool_value is not None:
|
|
1450
|
+
body["bool_value"] = self.bool_value
|
|
1451
|
+
if self.list_value:
|
|
1452
|
+
body["list_value"] = self.list_value
|
|
1453
|
+
if self.null_value is not None:
|
|
1454
|
+
body["null_value"] = self.null_value
|
|
1455
|
+
if self.number_value is not None:
|
|
1456
|
+
body["number_value"] = self.number_value
|
|
1457
|
+
if self.string_value is not None:
|
|
1458
|
+
body["string_value"] = self.string_value
|
|
1459
|
+
if self.struct_value:
|
|
1460
|
+
body["struct_value"] = self.struct_value
|
|
1268
1461
|
return body
|
|
1269
1462
|
|
|
1270
1463
|
@classmethod
|
|
1271
|
-
def from_dict(cls, d: Dict[str,
|
|
1464
|
+
def from_dict(cls, d: Dict[str, Any]) -> Value:
|
|
1272
1465
|
"""Deserializes the Value from a dictionary."""
|
|
1273
|
-
return cls(
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1466
|
+
return cls(
|
|
1467
|
+
bool_value=d.get("bool_value", None),
|
|
1468
|
+
list_value=_from_dict(d, "list_value", ListValue),
|
|
1469
|
+
null_value=d.get("null_value", None),
|
|
1470
|
+
number_value=d.get("number_value", None),
|
|
1471
|
+
string_value=d.get("string_value", None),
|
|
1472
|
+
struct_value=_from_dict(d, "struct_value", Struct),
|
|
1473
|
+
)
|
|
1279
1474
|
|
|
1280
1475
|
|
|
1281
1476
|
@dataclass
|
|
@@ -1309,43 +1504,58 @@ class VectorIndex:
|
|
|
1309
1504
|
def as_dict(self) -> dict:
|
|
1310
1505
|
"""Serializes the VectorIndex into a dictionary suitable for use as a JSON request body."""
|
|
1311
1506
|
body = {}
|
|
1312
|
-
if self.creator is not None:
|
|
1313
|
-
|
|
1507
|
+
if self.creator is not None:
|
|
1508
|
+
body["creator"] = self.creator
|
|
1509
|
+
if self.delta_sync_index_spec:
|
|
1510
|
+
body["delta_sync_index_spec"] = self.delta_sync_index_spec.as_dict()
|
|
1314
1511
|
if self.direct_access_index_spec:
|
|
1315
|
-
body[
|
|
1316
|
-
if self.endpoint_name is not None:
|
|
1317
|
-
|
|
1318
|
-
if self.
|
|
1319
|
-
|
|
1320
|
-
if self.
|
|
1512
|
+
body["direct_access_index_spec"] = self.direct_access_index_spec.as_dict()
|
|
1513
|
+
if self.endpoint_name is not None:
|
|
1514
|
+
body["endpoint_name"] = self.endpoint_name
|
|
1515
|
+
if self.index_type is not None:
|
|
1516
|
+
body["index_type"] = self.index_type.value
|
|
1517
|
+
if self.name is not None:
|
|
1518
|
+
body["name"] = self.name
|
|
1519
|
+
if self.primary_key is not None:
|
|
1520
|
+
body["primary_key"] = self.primary_key
|
|
1521
|
+
if self.status:
|
|
1522
|
+
body["status"] = self.status.as_dict()
|
|
1321
1523
|
return body
|
|
1322
1524
|
|
|
1323
1525
|
def as_shallow_dict(self) -> dict:
|
|
1324
1526
|
"""Serializes the VectorIndex into a shallow dictionary of its immediate attributes."""
|
|
1325
1527
|
body = {}
|
|
1326
|
-
if self.creator is not None:
|
|
1327
|
-
|
|
1328
|
-
if self.
|
|
1329
|
-
|
|
1330
|
-
if self.
|
|
1331
|
-
|
|
1332
|
-
if self.
|
|
1333
|
-
|
|
1528
|
+
if self.creator is not None:
|
|
1529
|
+
body["creator"] = self.creator
|
|
1530
|
+
if self.delta_sync_index_spec:
|
|
1531
|
+
body["delta_sync_index_spec"] = self.delta_sync_index_spec
|
|
1532
|
+
if self.direct_access_index_spec:
|
|
1533
|
+
body["direct_access_index_spec"] = self.direct_access_index_spec
|
|
1534
|
+
if self.endpoint_name is not None:
|
|
1535
|
+
body["endpoint_name"] = self.endpoint_name
|
|
1536
|
+
if self.index_type is not None:
|
|
1537
|
+
body["index_type"] = self.index_type
|
|
1538
|
+
if self.name is not None:
|
|
1539
|
+
body["name"] = self.name
|
|
1540
|
+
if self.primary_key is not None:
|
|
1541
|
+
body["primary_key"] = self.primary_key
|
|
1542
|
+
if self.status:
|
|
1543
|
+
body["status"] = self.status
|
|
1334
1544
|
return body
|
|
1335
1545
|
|
|
1336
1546
|
@classmethod
|
|
1337
|
-
def from_dict(cls, d: Dict[str,
|
|
1547
|
+
def from_dict(cls, d: Dict[str, Any]) -> VectorIndex:
|
|
1338
1548
|
"""Deserializes the VectorIndex from a dictionary."""
|
|
1339
|
-
return cls(
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1549
|
+
return cls(
|
|
1550
|
+
creator=d.get("creator", None),
|
|
1551
|
+
delta_sync_index_spec=_from_dict(d, "delta_sync_index_spec", DeltaSyncVectorIndexSpecResponse),
|
|
1552
|
+
direct_access_index_spec=_from_dict(d, "direct_access_index_spec", DirectAccessVectorIndexSpec),
|
|
1553
|
+
endpoint_name=d.get("endpoint_name", None),
|
|
1554
|
+
index_type=_enum(d, "index_type", VectorIndexType),
|
|
1555
|
+
name=d.get("name", None),
|
|
1556
|
+
primary_key=d.get("primary_key", None),
|
|
1557
|
+
status=_from_dict(d, "status", VectorIndexStatus),
|
|
1558
|
+
)
|
|
1349
1559
|
|
|
1350
1560
|
|
|
1351
1561
|
@dataclass
|
|
@@ -1365,40 +1575,50 @@ class VectorIndexStatus:
|
|
|
1365
1575
|
def as_dict(self) -> dict:
|
|
1366
1576
|
"""Serializes the VectorIndexStatus into a dictionary suitable for use as a JSON request body."""
|
|
1367
1577
|
body = {}
|
|
1368
|
-
if self.index_url is not None:
|
|
1369
|
-
|
|
1370
|
-
if self.
|
|
1371
|
-
|
|
1578
|
+
if self.index_url is not None:
|
|
1579
|
+
body["index_url"] = self.index_url
|
|
1580
|
+
if self.indexed_row_count is not None:
|
|
1581
|
+
body["indexed_row_count"] = self.indexed_row_count
|
|
1582
|
+
if self.message is not None:
|
|
1583
|
+
body["message"] = self.message
|
|
1584
|
+
if self.ready is not None:
|
|
1585
|
+
body["ready"] = self.ready
|
|
1372
1586
|
return body
|
|
1373
1587
|
|
|
1374
1588
|
def as_shallow_dict(self) -> dict:
|
|
1375
1589
|
"""Serializes the VectorIndexStatus into a shallow dictionary of its immediate attributes."""
|
|
1376
1590
|
body = {}
|
|
1377
|
-
if self.index_url is not None:
|
|
1378
|
-
|
|
1379
|
-
if self.
|
|
1380
|
-
|
|
1591
|
+
if self.index_url is not None:
|
|
1592
|
+
body["index_url"] = self.index_url
|
|
1593
|
+
if self.indexed_row_count is not None:
|
|
1594
|
+
body["indexed_row_count"] = self.indexed_row_count
|
|
1595
|
+
if self.message is not None:
|
|
1596
|
+
body["message"] = self.message
|
|
1597
|
+
if self.ready is not None:
|
|
1598
|
+
body["ready"] = self.ready
|
|
1381
1599
|
return body
|
|
1382
1600
|
|
|
1383
1601
|
@classmethod
|
|
1384
|
-
def from_dict(cls, d: Dict[str,
|
|
1602
|
+
def from_dict(cls, d: Dict[str, Any]) -> VectorIndexStatus:
|
|
1385
1603
|
"""Deserializes the VectorIndexStatus from a dictionary."""
|
|
1386
|
-
return cls(
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1604
|
+
return cls(
|
|
1605
|
+
index_url=d.get("index_url", None),
|
|
1606
|
+
indexed_row_count=d.get("indexed_row_count", None),
|
|
1607
|
+
message=d.get("message", None),
|
|
1608
|
+
ready=d.get("ready", None),
|
|
1609
|
+
)
|
|
1390
1610
|
|
|
1391
1611
|
|
|
1392
1612
|
class VectorIndexType(Enum):
|
|
1393
1613
|
"""There are 2 types of Vector Search indexes:
|
|
1394
|
-
|
|
1614
|
+
|
|
1395
1615
|
- `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and
|
|
1396
1616
|
incrementally updating the index as the underlying data in the Delta Table changes. -
|
|
1397
1617
|
`DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through
|
|
1398
1618
|
our REST and SDK APIs. With this model, the user manages index updates."""
|
|
1399
1619
|
|
|
1400
|
-
DELTA_SYNC =
|
|
1401
|
-
DIRECT_ACCESS =
|
|
1620
|
+
DELTA_SYNC = "DELTA_SYNC"
|
|
1621
|
+
DIRECT_ACCESS = "DIRECT_ACCESS"
|
|
1402
1622
|
|
|
1403
1623
|
|
|
1404
1624
|
class VectorSearchEndpointsAPI:
|
|
@@ -1408,19 +1628,20 @@ class VectorSearchEndpointsAPI:
|
|
|
1408
1628
|
self._api = api_client
|
|
1409
1629
|
|
|
1410
1630
|
def wait_get_endpoint_vector_search_endpoint_online(
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1631
|
+
self,
|
|
1632
|
+
endpoint_name: str,
|
|
1633
|
+
timeout=timedelta(minutes=20),
|
|
1634
|
+
callback: Optional[Callable[[EndpointInfo], None]] = None,
|
|
1635
|
+
) -> EndpointInfo:
|
|
1415
1636
|
deadline = time.time() + timeout.total_seconds()
|
|
1416
|
-
target_states = (EndpointStatusState.ONLINE,
|
|
1417
|
-
failure_states = (EndpointStatusState.OFFLINE,
|
|
1418
|
-
status_message =
|
|
1637
|
+
target_states = (EndpointStatusState.ONLINE,)
|
|
1638
|
+
failure_states = (EndpointStatusState.OFFLINE,)
|
|
1639
|
+
status_message = "polling..."
|
|
1419
1640
|
attempt = 1
|
|
1420
1641
|
while time.time() < deadline:
|
|
1421
1642
|
poll = self.get_endpoint(endpoint_name=endpoint_name)
|
|
1422
1643
|
status = poll.endpoint_status.state
|
|
1423
|
-
status_message = f
|
|
1644
|
+
status_message = f"current status: {status}"
|
|
1424
1645
|
if poll.endpoint_status:
|
|
1425
1646
|
status_message = poll.endpoint_status.message
|
|
1426
1647
|
if status in target_states:
|
|
@@ -1428,100 +1649,113 @@ class VectorSearchEndpointsAPI:
|
|
|
1428
1649
|
if callback:
|
|
1429
1650
|
callback(poll)
|
|
1430
1651
|
if status in failure_states:
|
|
1431
|
-
msg = f
|
|
1652
|
+
msg = f"failed to reach ONLINE, got {status}: {status_message}"
|
|
1432
1653
|
raise OperationFailed(msg)
|
|
1433
1654
|
prefix = f"endpoint_name={endpoint_name}"
|
|
1434
1655
|
sleep = attempt
|
|
1435
1656
|
if sleep > 10:
|
|
1436
1657
|
# sleep 10s max per attempt
|
|
1437
1658
|
sleep = 10
|
|
1438
|
-
_LOG.debug(f
|
|
1659
|
+
_LOG.debug(f"{prefix}: ({status}) {status_message} (sleeping ~{sleep}s)")
|
|
1439
1660
|
time.sleep(sleep + random.random())
|
|
1440
1661
|
attempt += 1
|
|
1441
|
-
raise TimeoutError(f
|
|
1662
|
+
raise TimeoutError(f"timed out after {timeout}: {status_message}")
|
|
1442
1663
|
|
|
1443
1664
|
def create_endpoint(self, name: str, endpoint_type: EndpointType) -> Wait[EndpointInfo]:
|
|
1444
1665
|
"""Create an endpoint.
|
|
1445
|
-
|
|
1666
|
+
|
|
1446
1667
|
Create a new endpoint.
|
|
1447
|
-
|
|
1668
|
+
|
|
1448
1669
|
:param name: str
|
|
1449
1670
|
Name of endpoint
|
|
1450
1671
|
:param endpoint_type: :class:`EndpointType`
|
|
1451
1672
|
Type of endpoint.
|
|
1452
|
-
|
|
1673
|
+
|
|
1453
1674
|
:returns:
|
|
1454
1675
|
Long-running operation waiter for :class:`EndpointInfo`.
|
|
1455
1676
|
See :method:wait_get_endpoint_vector_search_endpoint_online for more details.
|
|
1456
1677
|
"""
|
|
1457
1678
|
body = {}
|
|
1458
|
-
if endpoint_type is not None:
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1679
|
+
if endpoint_type is not None:
|
|
1680
|
+
body["endpoint_type"] = endpoint_type.value
|
|
1681
|
+
if name is not None:
|
|
1682
|
+
body["name"] = name
|
|
1683
|
+
headers = {
|
|
1684
|
+
"Accept": "application/json",
|
|
1685
|
+
"Content-Type": "application/json",
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
op_response = self._api.do("POST", "/api/2.0/vector-search/endpoints", body=body, headers=headers)
|
|
1689
|
+
return Wait(
|
|
1690
|
+
self.wait_get_endpoint_vector_search_endpoint_online,
|
|
1691
|
+
response=EndpointInfo.from_dict(op_response),
|
|
1692
|
+
endpoint_name=op_response["name"],
|
|
1693
|
+
)
|
|
1694
|
+
|
|
1695
|
+
def create_endpoint_and_wait(
|
|
1696
|
+
self, name: str, endpoint_type: EndpointType, timeout=timedelta(minutes=20)
|
|
1697
|
+
) -> EndpointInfo:
|
|
1469
1698
|
return self.create_endpoint(endpoint_type=endpoint_type, name=name).result(timeout=timeout)
|
|
1470
1699
|
|
|
1471
1700
|
def delete_endpoint(self, endpoint_name: str):
|
|
1472
1701
|
"""Delete an endpoint.
|
|
1473
|
-
|
|
1702
|
+
|
|
1474
1703
|
:param endpoint_name: str
|
|
1475
1704
|
Name of the endpoint
|
|
1476
|
-
|
|
1477
|
-
|
|
1705
|
+
|
|
1706
|
+
|
|
1478
1707
|
"""
|
|
1479
1708
|
|
|
1480
1709
|
headers = {}
|
|
1481
1710
|
|
|
1482
|
-
self._api.do(
|
|
1711
|
+
self._api.do("DELETE", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers)
|
|
1483
1712
|
|
|
1484
1713
|
def get_endpoint(self, endpoint_name: str) -> EndpointInfo:
|
|
1485
1714
|
"""Get an endpoint.
|
|
1486
|
-
|
|
1715
|
+
|
|
1487
1716
|
:param endpoint_name: str
|
|
1488
1717
|
Name of the endpoint
|
|
1489
|
-
|
|
1718
|
+
|
|
1490
1719
|
:returns: :class:`EndpointInfo`
|
|
1491
1720
|
"""
|
|
1492
1721
|
|
|
1493
|
-
headers = {
|
|
1722
|
+
headers = {
|
|
1723
|
+
"Accept": "application/json",
|
|
1724
|
+
}
|
|
1494
1725
|
|
|
1495
|
-
res = self._api.do(
|
|
1726
|
+
res = self._api.do("GET", f"/api/2.0/vector-search/endpoints/{endpoint_name}", headers=headers)
|
|
1496
1727
|
return EndpointInfo.from_dict(res)
|
|
1497
1728
|
|
|
1498
1729
|
def list_endpoints(self, *, page_token: Optional[str] = None) -> Iterator[EndpointInfo]:
|
|
1499
1730
|
"""List all endpoints.
|
|
1500
|
-
|
|
1731
|
+
|
|
1501
1732
|
:param page_token: str (optional)
|
|
1502
1733
|
Token for pagination
|
|
1503
|
-
|
|
1734
|
+
|
|
1504
1735
|
:returns: Iterator over :class:`EndpointInfo`
|
|
1505
1736
|
"""
|
|
1506
1737
|
|
|
1507
1738
|
query = {}
|
|
1508
|
-
if page_token is not None:
|
|
1509
|
-
|
|
1739
|
+
if page_token is not None:
|
|
1740
|
+
query["page_token"] = page_token
|
|
1741
|
+
headers = {
|
|
1742
|
+
"Accept": "application/json",
|
|
1743
|
+
}
|
|
1510
1744
|
|
|
1511
1745
|
while True:
|
|
1512
|
-
json = self._api.do(
|
|
1513
|
-
if
|
|
1514
|
-
for v in json[
|
|
1746
|
+
json = self._api.do("GET", "/api/2.0/vector-search/endpoints", query=query, headers=headers)
|
|
1747
|
+
if "endpoints" in json:
|
|
1748
|
+
for v in json["endpoints"]:
|
|
1515
1749
|
yield EndpointInfo.from_dict(v)
|
|
1516
|
-
if
|
|
1750
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
1517
1751
|
return
|
|
1518
|
-
query[
|
|
1752
|
+
query["page_token"] = json["next_page_token"]
|
|
1519
1753
|
|
|
1520
1754
|
|
|
1521
1755
|
class VectorSearchIndexesAPI:
|
|
1522
1756
|
"""**Index**: An efficient representation of your embedding vectors that supports real-time and efficient
|
|
1523
1757
|
approximate nearest neighbor (ANN) search queries.
|
|
1524
|
-
|
|
1758
|
+
|
|
1525
1759
|
There are 2 types of Vector Search indexes: * **Delta Sync Index**: An index that automatically syncs with
|
|
1526
1760
|
a source Delta Table, automatically and incrementally updating the index as the underlying data in the
|
|
1527
1761
|
Delta Table changes. * **Direct Vector Access Index**: An index that supports direct read and write of
|
|
@@ -1531,19 +1765,19 @@ class VectorSearchIndexesAPI:
|
|
|
1531
1765
|
self._api = api_client
|
|
1532
1766
|
|
|
1533
1767
|
def create_index(
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1768
|
+
self,
|
|
1769
|
+
name: str,
|
|
1770
|
+
endpoint_name: str,
|
|
1771
|
+
primary_key: str,
|
|
1772
|
+
index_type: VectorIndexType,
|
|
1773
|
+
*,
|
|
1774
|
+
delta_sync_index_spec: Optional[DeltaSyncVectorIndexSpecRequest] = None,
|
|
1775
|
+
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None,
|
|
1542
1776
|
) -> CreateVectorIndexResponse:
|
|
1543
1777
|
"""Create an index.
|
|
1544
|
-
|
|
1778
|
+
|
|
1545
1779
|
Create a new index.
|
|
1546
|
-
|
|
1780
|
+
|
|
1547
1781
|
:param name: str
|
|
1548
1782
|
Name of the index
|
|
1549
1783
|
:param endpoint_name: str
|
|
@@ -1552,7 +1786,7 @@ class VectorSearchIndexesAPI:
|
|
|
1552
1786
|
Primary key of the index
|
|
1553
1787
|
:param index_type: :class:`VectorIndexType`
|
|
1554
1788
|
There are 2 types of Vector Search indexes:
|
|
1555
|
-
|
|
1789
|
+
|
|
1556
1790
|
- `DELTA_SYNC`: An index that automatically syncs with a source Delta Table, automatically and
|
|
1557
1791
|
incrementally updating the index as the underlying data in the Delta Table changes. -
|
|
1558
1792
|
`DIRECT_ACCESS`: An index that supports direct read and write of vectors and metadata through our
|
|
@@ -1561,127 +1795,145 @@ class VectorSearchIndexesAPI:
|
|
|
1561
1795
|
Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`.
|
|
1562
1796
|
:param direct_access_index_spec: :class:`DirectAccessVectorIndexSpec` (optional)
|
|
1563
1797
|
Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`.
|
|
1564
|
-
|
|
1798
|
+
|
|
1565
1799
|
:returns: :class:`CreateVectorIndexResponse`
|
|
1566
1800
|
"""
|
|
1567
1801
|
body = {}
|
|
1568
|
-
if delta_sync_index_spec is not None:
|
|
1802
|
+
if delta_sync_index_spec is not None:
|
|
1803
|
+
body["delta_sync_index_spec"] = delta_sync_index_spec.as_dict()
|
|
1569
1804
|
if direct_access_index_spec is not None:
|
|
1570
|
-
body[
|
|
1571
|
-
if endpoint_name is not None:
|
|
1572
|
-
|
|
1573
|
-
if
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1805
|
+
body["direct_access_index_spec"] = direct_access_index_spec.as_dict()
|
|
1806
|
+
if endpoint_name is not None:
|
|
1807
|
+
body["endpoint_name"] = endpoint_name
|
|
1808
|
+
if index_type is not None:
|
|
1809
|
+
body["index_type"] = index_type.value
|
|
1810
|
+
if name is not None:
|
|
1811
|
+
body["name"] = name
|
|
1812
|
+
if primary_key is not None:
|
|
1813
|
+
body["primary_key"] = primary_key
|
|
1814
|
+
headers = {
|
|
1815
|
+
"Accept": "application/json",
|
|
1816
|
+
"Content-Type": "application/json",
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
res = self._api.do("POST", "/api/2.0/vector-search/indexes", body=body, headers=headers)
|
|
1578
1820
|
return CreateVectorIndexResponse.from_dict(res)
|
|
1579
1821
|
|
|
1580
|
-
def delete_data_vector_index(self, index_name: str,
|
|
1581
|
-
primary_keys: List[str]) -> DeleteDataVectorIndexResponse:
|
|
1822
|
+
def delete_data_vector_index(self, index_name: str, primary_keys: List[str]) -> DeleteDataVectorIndexResponse:
|
|
1582
1823
|
"""Delete data from index.
|
|
1583
|
-
|
|
1824
|
+
|
|
1584
1825
|
Handles the deletion of data from a specified vector index.
|
|
1585
|
-
|
|
1826
|
+
|
|
1586
1827
|
:param index_name: str
|
|
1587
1828
|
Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index.
|
|
1588
1829
|
:param primary_keys: List[str]
|
|
1589
1830
|
List of primary keys for the data to be deleted.
|
|
1590
|
-
|
|
1831
|
+
|
|
1591
1832
|
:returns: :class:`DeleteDataVectorIndexResponse`
|
|
1592
1833
|
"""
|
|
1593
1834
|
body = {}
|
|
1594
|
-
if primary_keys is not None:
|
|
1595
|
-
|
|
1835
|
+
if primary_keys is not None:
|
|
1836
|
+
body["primary_keys"] = [v for v in primary_keys]
|
|
1837
|
+
headers = {
|
|
1838
|
+
"Accept": "application/json",
|
|
1839
|
+
"Content-Type": "application/json",
|
|
1840
|
+
}
|
|
1596
1841
|
|
|
1597
|
-
res = self._api.do(
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
headers=headers)
|
|
1842
|
+
res = self._api.do(
|
|
1843
|
+
"POST", f"/api/2.0/vector-search/indexes/{index_name}/delete-data", body=body, headers=headers
|
|
1844
|
+
)
|
|
1601
1845
|
return DeleteDataVectorIndexResponse.from_dict(res)
|
|
1602
1846
|
|
|
1603
1847
|
def delete_index(self, index_name: str):
|
|
1604
1848
|
"""Delete an index.
|
|
1605
|
-
|
|
1849
|
+
|
|
1606
1850
|
Delete an index.
|
|
1607
|
-
|
|
1851
|
+
|
|
1608
1852
|
:param index_name: str
|
|
1609
1853
|
Name of the index
|
|
1610
|
-
|
|
1611
|
-
|
|
1854
|
+
|
|
1855
|
+
|
|
1612
1856
|
"""
|
|
1613
1857
|
|
|
1614
1858
|
headers = {}
|
|
1615
1859
|
|
|
1616
|
-
self._api.do(
|
|
1860
|
+
self._api.do("DELETE", f"/api/2.0/vector-search/indexes/{index_name}", headers=headers)
|
|
1617
1861
|
|
|
1618
1862
|
def get_index(self, index_name: str) -> VectorIndex:
|
|
1619
1863
|
"""Get an index.
|
|
1620
|
-
|
|
1864
|
+
|
|
1621
1865
|
Get an index.
|
|
1622
|
-
|
|
1866
|
+
|
|
1623
1867
|
:param index_name: str
|
|
1624
1868
|
Name of the index
|
|
1625
|
-
|
|
1869
|
+
|
|
1626
1870
|
:returns: :class:`VectorIndex`
|
|
1627
1871
|
"""
|
|
1628
1872
|
|
|
1629
|
-
headers = {
|
|
1873
|
+
headers = {
|
|
1874
|
+
"Accept": "application/json",
|
|
1875
|
+
}
|
|
1630
1876
|
|
|
1631
|
-
res = self._api.do(
|
|
1877
|
+
res = self._api.do("GET", f"/api/2.0/vector-search/indexes/{index_name}", headers=headers)
|
|
1632
1878
|
return VectorIndex.from_dict(res)
|
|
1633
1879
|
|
|
1634
|
-
def list_indexes(self,
|
|
1635
|
-
endpoint_name: str,
|
|
1636
|
-
*,
|
|
1637
|
-
page_token: Optional[str] = None) -> Iterator[MiniVectorIndex]:
|
|
1880
|
+
def list_indexes(self, endpoint_name: str, *, page_token: Optional[str] = None) -> Iterator[MiniVectorIndex]:
|
|
1638
1881
|
"""List indexes.
|
|
1639
|
-
|
|
1882
|
+
|
|
1640
1883
|
List all indexes in the given endpoint.
|
|
1641
|
-
|
|
1884
|
+
|
|
1642
1885
|
:param endpoint_name: str
|
|
1643
1886
|
Name of the endpoint
|
|
1644
1887
|
:param page_token: str (optional)
|
|
1645
1888
|
Token for pagination
|
|
1646
|
-
|
|
1889
|
+
|
|
1647
1890
|
:returns: Iterator over :class:`MiniVectorIndex`
|
|
1648
1891
|
"""
|
|
1649
1892
|
|
|
1650
1893
|
query = {}
|
|
1651
|
-
if endpoint_name is not None:
|
|
1652
|
-
|
|
1653
|
-
|
|
1894
|
+
if endpoint_name is not None:
|
|
1895
|
+
query["endpoint_name"] = endpoint_name
|
|
1896
|
+
if page_token is not None:
|
|
1897
|
+
query["page_token"] = page_token
|
|
1898
|
+
headers = {
|
|
1899
|
+
"Accept": "application/json",
|
|
1900
|
+
}
|
|
1654
1901
|
|
|
1655
1902
|
while True:
|
|
1656
|
-
json = self._api.do(
|
|
1657
|
-
if
|
|
1658
|
-
for v in json[
|
|
1903
|
+
json = self._api.do("GET", "/api/2.0/vector-search/indexes", query=query, headers=headers)
|
|
1904
|
+
if "vector_indexes" in json:
|
|
1905
|
+
for v in json["vector_indexes"]:
|
|
1659
1906
|
yield MiniVectorIndex.from_dict(v)
|
|
1660
|
-
if
|
|
1907
|
+
if "next_page_token" not in json or not json["next_page_token"]:
|
|
1661
1908
|
return
|
|
1662
|
-
query[
|
|
1663
|
-
|
|
1664
|
-
def query_index(
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1909
|
+
query["page_token"] = json["next_page_token"]
|
|
1910
|
+
|
|
1911
|
+
def query_index(
|
|
1912
|
+
self,
|
|
1913
|
+
index_name: str,
|
|
1914
|
+
columns: List[str],
|
|
1915
|
+
*,
|
|
1916
|
+
columns_to_rerank: Optional[List[str]] = None,
|
|
1917
|
+
filters_json: Optional[str] = None,
|
|
1918
|
+
num_results: Optional[int] = None,
|
|
1919
|
+
query_text: Optional[str] = None,
|
|
1920
|
+
query_type: Optional[str] = None,
|
|
1921
|
+
query_vector: Optional[List[float]] = None,
|
|
1922
|
+
score_threshold: Optional[float] = None,
|
|
1923
|
+
) -> QueryVectorIndexResponse:
|
|
1674
1924
|
"""Query an index.
|
|
1675
|
-
|
|
1925
|
+
|
|
1676
1926
|
Query the specified vector index.
|
|
1677
|
-
|
|
1927
|
+
|
|
1678
1928
|
:param index_name: str
|
|
1679
1929
|
Name of the vector index to query.
|
|
1680
1930
|
:param columns: List[str]
|
|
1681
1931
|
List of column names to include in the response.
|
|
1932
|
+
:param columns_to_rerank: List[str] (optional)
|
|
1933
|
+
Column names used to retrieve data to send to the reranker.
|
|
1682
1934
|
:param filters_json: str (optional)
|
|
1683
1935
|
JSON string representing query filters.
|
|
1684
|
-
|
|
1936
|
+
|
|
1685
1937
|
Example filters: - `{"id <": 5}`: Filter for id less than 5. - `{"id >": 5}`: Filter for id greater
|
|
1686
1938
|
than 5. - `{"id <=": 5}`: Filter for id less than equal to 5. - `{"id >=": 5}`: Filter for id
|
|
1687
1939
|
greater than equal to 5. - `{"id": 5}`: Filter for id equal to 5.
|
|
@@ -1696,118 +1948,132 @@ class VectorSearchIndexesAPI:
|
|
|
1696
1948
|
vectors.
|
|
1697
1949
|
:param score_threshold: float (optional)
|
|
1698
1950
|
Threshold for the approximate nearest neighbor search. Defaults to 0.0.
|
|
1699
|
-
|
|
1951
|
+
|
|
1700
1952
|
:returns: :class:`QueryVectorIndexResponse`
|
|
1701
1953
|
"""
|
|
1702
1954
|
body = {}
|
|
1703
|
-
if columns is not None:
|
|
1704
|
-
|
|
1705
|
-
if
|
|
1706
|
-
|
|
1707
|
-
if
|
|
1708
|
-
|
|
1709
|
-
if
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1955
|
+
if columns is not None:
|
|
1956
|
+
body["columns"] = [v for v in columns]
|
|
1957
|
+
if columns_to_rerank is not None:
|
|
1958
|
+
body["columns_to_rerank"] = [v for v in columns_to_rerank]
|
|
1959
|
+
if filters_json is not None:
|
|
1960
|
+
body["filters_json"] = filters_json
|
|
1961
|
+
if num_results is not None:
|
|
1962
|
+
body["num_results"] = num_results
|
|
1963
|
+
if query_text is not None:
|
|
1964
|
+
body["query_text"] = query_text
|
|
1965
|
+
if query_type is not None:
|
|
1966
|
+
body["query_type"] = query_type
|
|
1967
|
+
if query_vector is not None:
|
|
1968
|
+
body["query_vector"] = [v for v in query_vector]
|
|
1969
|
+
if score_threshold is not None:
|
|
1970
|
+
body["score_threshold"] = score_threshold
|
|
1971
|
+
headers = {
|
|
1972
|
+
"Accept": "application/json",
|
|
1973
|
+
"Content-Type": "application/json",
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/query", body=body, headers=headers)
|
|
1716
1977
|
return QueryVectorIndexResponse.from_dict(res)
|
|
1717
1978
|
|
|
1718
|
-
def query_next_page(
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
endpoint_name: Optional[str] = None,
|
|
1722
|
-
page_token: Optional[str] = None) -> QueryVectorIndexResponse:
|
|
1979
|
+
def query_next_page(
|
|
1980
|
+
self, index_name: str, *, endpoint_name: Optional[str] = None, page_token: Optional[str] = None
|
|
1981
|
+
) -> QueryVectorIndexResponse:
|
|
1723
1982
|
"""Query next page.
|
|
1724
|
-
|
|
1983
|
+
|
|
1725
1984
|
Use `next_page_token` returned from previous `QueryVectorIndex` or `QueryVectorIndexNextPage` request
|
|
1726
1985
|
to fetch next page of results.
|
|
1727
|
-
|
|
1986
|
+
|
|
1728
1987
|
:param index_name: str
|
|
1729
1988
|
Name of the vector index to query.
|
|
1730
1989
|
:param endpoint_name: str (optional)
|
|
1731
1990
|
Name of the endpoint.
|
|
1732
1991
|
:param page_token: str (optional)
|
|
1733
1992
|
Page token returned from previous `QueryVectorIndex` or `QueryVectorIndexNextPage` API.
|
|
1734
|
-
|
|
1993
|
+
|
|
1735
1994
|
:returns: :class:`QueryVectorIndexResponse`
|
|
1736
1995
|
"""
|
|
1737
1996
|
body = {}
|
|
1738
|
-
if endpoint_name is not None:
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1997
|
+
if endpoint_name is not None:
|
|
1998
|
+
body["endpoint_name"] = endpoint_name
|
|
1999
|
+
if page_token is not None:
|
|
2000
|
+
body["page_token"] = page_token
|
|
2001
|
+
headers = {
|
|
2002
|
+
"Accept": "application/json",
|
|
2003
|
+
"Content-Type": "application/json",
|
|
2004
|
+
}
|
|
2005
|
+
|
|
2006
|
+
res = self._api.do(
|
|
2007
|
+
"POST", f"/api/2.0/vector-search/indexes/{index_name}/query-next-page", body=body, headers=headers
|
|
2008
|
+
)
|
|
1746
2009
|
return QueryVectorIndexResponse.from_dict(res)
|
|
1747
2010
|
|
|
1748
|
-
def scan_index(
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
last_primary_key: Optional[str] = None,
|
|
1752
|
-
num_results: Optional[int] = None) -> ScanVectorIndexResponse:
|
|
2011
|
+
def scan_index(
|
|
2012
|
+
self, index_name: str, *, last_primary_key: Optional[str] = None, num_results: Optional[int] = None
|
|
2013
|
+
) -> ScanVectorIndexResponse:
|
|
1753
2014
|
"""Scan an index.
|
|
1754
|
-
|
|
2015
|
+
|
|
1755
2016
|
Scan the specified vector index and return the first `num_results` entries after the exclusive
|
|
1756
2017
|
`primary_key`.
|
|
1757
|
-
|
|
2018
|
+
|
|
1758
2019
|
:param index_name: str
|
|
1759
2020
|
Name of the vector index to scan.
|
|
1760
2021
|
:param last_primary_key: str (optional)
|
|
1761
2022
|
Primary key of the last entry returned in the previous scan.
|
|
1762
2023
|
:param num_results: int (optional)
|
|
1763
2024
|
Number of results to return. Defaults to 10.
|
|
1764
|
-
|
|
2025
|
+
|
|
1765
2026
|
:returns: :class:`ScanVectorIndexResponse`
|
|
1766
2027
|
"""
|
|
1767
2028
|
body = {}
|
|
1768
|
-
if last_primary_key is not None:
|
|
1769
|
-
|
|
1770
|
-
|
|
2029
|
+
if last_primary_key is not None:
|
|
2030
|
+
body["last_primary_key"] = last_primary_key
|
|
2031
|
+
if num_results is not None:
|
|
2032
|
+
body["num_results"] = num_results
|
|
2033
|
+
headers = {
|
|
2034
|
+
"Accept": "application/json",
|
|
2035
|
+
"Content-Type": "application/json",
|
|
2036
|
+
}
|
|
1771
2037
|
|
|
1772
|
-
res = self._api.do(
|
|
1773
|
-
f'/api/2.0/vector-search/indexes/{index_name}/scan',
|
|
1774
|
-
body=body,
|
|
1775
|
-
headers=headers)
|
|
2038
|
+
res = self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/scan", body=body, headers=headers)
|
|
1776
2039
|
return ScanVectorIndexResponse.from_dict(res)
|
|
1777
2040
|
|
|
1778
2041
|
def sync_index(self, index_name: str):
|
|
1779
2042
|
"""Synchronize an index.
|
|
1780
|
-
|
|
2043
|
+
|
|
1781
2044
|
Triggers a synchronization process for a specified vector index.
|
|
1782
|
-
|
|
2045
|
+
|
|
1783
2046
|
:param index_name: str
|
|
1784
2047
|
Name of the vector index to synchronize. Must be a Delta Sync Index.
|
|
1785
|
-
|
|
1786
|
-
|
|
2048
|
+
|
|
2049
|
+
|
|
1787
2050
|
"""
|
|
1788
2051
|
|
|
1789
2052
|
headers = {}
|
|
1790
2053
|
|
|
1791
|
-
self._api.do(
|
|
2054
|
+
self._api.do("POST", f"/api/2.0/vector-search/indexes/{index_name}/sync", headers=headers)
|
|
1792
2055
|
|
|
1793
2056
|
def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertDataVectorIndexResponse:
|
|
1794
2057
|
"""Upsert data into an index.
|
|
1795
|
-
|
|
2058
|
+
|
|
1796
2059
|
Handles the upserting of data into a specified vector index.
|
|
1797
|
-
|
|
2060
|
+
|
|
1798
2061
|
:param index_name: str
|
|
1799
2062
|
Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index.
|
|
1800
2063
|
:param inputs_json: str
|
|
1801
2064
|
JSON string representing the data to be upserted.
|
|
1802
|
-
|
|
2065
|
+
|
|
1803
2066
|
:returns: :class:`UpsertDataVectorIndexResponse`
|
|
1804
2067
|
"""
|
|
1805
2068
|
body = {}
|
|
1806
|
-
if inputs_json is not None:
|
|
1807
|
-
|
|
2069
|
+
if inputs_json is not None:
|
|
2070
|
+
body["inputs_json"] = inputs_json
|
|
2071
|
+
headers = {
|
|
2072
|
+
"Accept": "application/json",
|
|
2073
|
+
"Content-Type": "application/json",
|
|
2074
|
+
}
|
|
1808
2075
|
|
|
1809
|
-
res = self._api.do(
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
headers=headers)
|
|
2076
|
+
res = self._api.do(
|
|
2077
|
+
"POST", f"/api/2.0/vector-search/indexes/{index_name}/upsert-data", body=body, headers=headers
|
|
2078
|
+
)
|
|
1813
2079
|
return UpsertDataVectorIndexResponse.from_dict(res)
|