databricks-sdk 0.19.1__py3-none-any.whl → 0.21.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 +28 -6
- databricks/sdk/_widgets/__init__.py +2 -2
- databricks/sdk/config.py +3 -2
- databricks/sdk/core.py +4 -2
- databricks/sdk/mixins/workspace.py +2 -1
- databricks/sdk/oauth.py +1 -1
- databricks/sdk/runtime/__init__.py +85 -11
- databricks/sdk/runtime/dbutils_stub.py +1 -1
- databricks/sdk/service/_internal.py +1 -1
- databricks/sdk/service/billing.py +64 -1
- databricks/sdk/service/catalog.py +796 -84
- databricks/sdk/service/compute.py +391 -13
- databricks/sdk/service/dashboards.py +15 -0
- databricks/sdk/service/files.py +289 -15
- databricks/sdk/service/iam.py +214 -0
- databricks/sdk/service/jobs.py +242 -143
- databricks/sdk/service/ml.py +407 -0
- databricks/sdk/service/oauth2.py +83 -0
- databricks/sdk/service/pipelines.py +78 -8
- databricks/sdk/service/provisioning.py +108 -36
- databricks/sdk/service/serving.py +101 -35
- databricks/sdk/service/settings.py +1316 -186
- databricks/sdk/service/sharing.py +94 -18
- databricks/sdk/service/sql.py +230 -13
- databricks/sdk/service/vectorsearch.py +105 -60
- databricks/sdk/service/workspace.py +175 -1
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/METADATA +3 -1
- databricks_sdk-0.21.0.dist-info/RECORD +53 -0
- databricks/sdk/runtime/stub.py +0 -48
- databricks_sdk-0.19.1.dist-info/RECORD +0 -54
- {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/top_level.txt +0 -0
|
@@ -61,6 +61,9 @@ class CreateVectorIndexRequest:
|
|
|
61
61
|
name: str
|
|
62
62
|
"""Name of the index"""
|
|
63
63
|
|
|
64
|
+
endpoint_name: str
|
|
65
|
+
"""Name of the endpoint to be used for serving the index"""
|
|
66
|
+
|
|
64
67
|
primary_key: str
|
|
65
68
|
"""Primary key of the index"""
|
|
66
69
|
|
|
@@ -78,9 +81,6 @@ class CreateVectorIndexRequest:
|
|
|
78
81
|
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
79
82
|
"""Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`."""
|
|
80
83
|
|
|
81
|
-
endpoint_name: Optional[str] = None
|
|
82
|
-
"""Name of the endpoint to be used for serving the index"""
|
|
83
|
-
|
|
84
84
|
def as_dict(self) -> dict:
|
|
85
85
|
"""Serializes the CreateVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
86
86
|
body = {}
|
|
@@ -161,20 +161,20 @@ class DeleteDataVectorIndexRequest:
|
|
|
161
161
|
primary_keys: List[str]
|
|
162
162
|
"""List of primary keys for the data to be deleted."""
|
|
163
163
|
|
|
164
|
-
|
|
164
|
+
index_name: Optional[str] = None
|
|
165
165
|
"""Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index."""
|
|
166
166
|
|
|
167
167
|
def as_dict(self) -> dict:
|
|
168
168
|
"""Serializes the DeleteDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
169
169
|
body = {}
|
|
170
|
-
if self.
|
|
170
|
+
if self.index_name is not None: body['index_name'] = self.index_name
|
|
171
171
|
if self.primary_keys: body['primary_keys'] = [v for v in self.primary_keys]
|
|
172
172
|
return body
|
|
173
173
|
|
|
174
174
|
@classmethod
|
|
175
175
|
def from_dict(cls, d: Dict[str, any]) -> DeleteDataVectorIndexRequest:
|
|
176
176
|
"""Deserializes the DeleteDataVectorIndexRequest from a dictionary."""
|
|
177
|
-
return cls(
|
|
177
|
+
return cls(index_name=d.get('index_name', None), primary_keys=d.get('primary_keys', None))
|
|
178
178
|
|
|
179
179
|
|
|
180
180
|
@dataclass
|
|
@@ -201,6 +201,34 @@ class DeleteDataVectorIndexResponse:
|
|
|
201
201
|
status=_enum(d, 'status', DeleteDataStatus))
|
|
202
202
|
|
|
203
203
|
|
|
204
|
+
@dataclass
|
|
205
|
+
class DeleteEndpointResponse:
|
|
206
|
+
|
|
207
|
+
def as_dict(self) -> dict:
|
|
208
|
+
"""Serializes the DeleteEndpointResponse into a dictionary suitable for use as a JSON request body."""
|
|
209
|
+
body = {}
|
|
210
|
+
return body
|
|
211
|
+
|
|
212
|
+
@classmethod
|
|
213
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteEndpointResponse:
|
|
214
|
+
"""Deserializes the DeleteEndpointResponse from a dictionary."""
|
|
215
|
+
return cls()
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
@dataclass
|
|
219
|
+
class DeleteIndexResponse:
|
|
220
|
+
|
|
221
|
+
def as_dict(self) -> dict:
|
|
222
|
+
"""Serializes the DeleteIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
223
|
+
body = {}
|
|
224
|
+
return body
|
|
225
|
+
|
|
226
|
+
@classmethod
|
|
227
|
+
def from_dict(cls, d: Dict[str, any]) -> DeleteIndexResponse:
|
|
228
|
+
"""Deserializes the DeleteIndexResponse from a dictionary."""
|
|
229
|
+
return cls()
|
|
230
|
+
|
|
231
|
+
|
|
204
232
|
@dataclass
|
|
205
233
|
class DeltaSyncVectorIndexSpecRequest:
|
|
206
234
|
embedding_source_columns: Optional[List[EmbeddingSourceColumn]] = None
|
|
@@ -319,41 +347,25 @@ class DirectAccessVectorIndexSpec:
|
|
|
319
347
|
|
|
320
348
|
|
|
321
349
|
@dataclass
|
|
322
|
-
class
|
|
350
|
+
class EmbeddingSourceColumn:
|
|
323
351
|
embedding_model_endpoint_name: Optional[str] = None
|
|
324
352
|
"""Name of the embedding model endpoint"""
|
|
325
353
|
|
|
326
|
-
def as_dict(self) -> dict:
|
|
327
|
-
"""Serializes the EmbeddingConfig into a dictionary suitable for use as a JSON request body."""
|
|
328
|
-
body = {}
|
|
329
|
-
if self.embedding_model_endpoint_name is not None:
|
|
330
|
-
body['embedding_model_endpoint_name'] = self.embedding_model_endpoint_name
|
|
331
|
-
return body
|
|
332
|
-
|
|
333
|
-
@classmethod
|
|
334
|
-
def from_dict(cls, d: Dict[str, any]) -> EmbeddingConfig:
|
|
335
|
-
"""Deserializes the EmbeddingConfig from a dictionary."""
|
|
336
|
-
return cls(embedding_model_endpoint_name=d.get('embedding_model_endpoint_name', None))
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
@dataclass
|
|
340
|
-
class EmbeddingSourceColumn:
|
|
341
|
-
embedding_config: Optional[EmbeddingConfig] = None
|
|
342
|
-
|
|
343
354
|
name: Optional[str] = None
|
|
344
355
|
"""Name of the column"""
|
|
345
356
|
|
|
346
357
|
def as_dict(self) -> dict:
|
|
347
358
|
"""Serializes the EmbeddingSourceColumn into a dictionary suitable for use as a JSON request body."""
|
|
348
359
|
body = {}
|
|
349
|
-
if self.
|
|
360
|
+
if self.embedding_model_endpoint_name is not None:
|
|
361
|
+
body['embedding_model_endpoint_name'] = self.embedding_model_endpoint_name
|
|
350
362
|
if self.name is not None: body['name'] = self.name
|
|
351
363
|
return body
|
|
352
364
|
|
|
353
365
|
@classmethod
|
|
354
366
|
def from_dict(cls, d: Dict[str, any]) -> EmbeddingSourceColumn:
|
|
355
367
|
"""Deserializes the EmbeddingSourceColumn from a dictionary."""
|
|
356
|
-
return cls(
|
|
368
|
+
return cls(embedding_model_endpoint_name=d.get('embedding_model_endpoint_name', None),
|
|
357
369
|
name=d.get('name', None))
|
|
358
370
|
|
|
359
371
|
|
|
@@ -598,6 +610,9 @@ class QueryVectorIndexRequest:
|
|
|
598
610
|
"""Query vector. Required for Direct Vector Access Index and Delta Sync Index using self-managed
|
|
599
611
|
vectors."""
|
|
600
612
|
|
|
613
|
+
score_threshold: Optional[float] = None
|
|
614
|
+
"""Threshold for the approximate nearest neighbor search. Defaults to 0.0."""
|
|
615
|
+
|
|
601
616
|
def as_dict(self) -> dict:
|
|
602
617
|
"""Serializes the QueryVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
603
618
|
body = {}
|
|
@@ -607,6 +622,7 @@ class QueryVectorIndexRequest:
|
|
|
607
622
|
if self.num_results is not None: body['num_results'] = self.num_results
|
|
608
623
|
if self.query_text is not None: body['query_text'] = self.query_text
|
|
609
624
|
if self.query_vector: body['query_vector'] = [v for v in self.query_vector]
|
|
625
|
+
if self.score_threshold is not None: body['score_threshold'] = self.score_threshold
|
|
610
626
|
return body
|
|
611
627
|
|
|
612
628
|
@classmethod
|
|
@@ -617,7 +633,8 @@ class QueryVectorIndexRequest:
|
|
|
617
633
|
index_name=d.get('index_name', None),
|
|
618
634
|
num_results=d.get('num_results', None),
|
|
619
635
|
query_text=d.get('query_text', None),
|
|
620
|
-
query_vector=d.get('query_vector', None)
|
|
636
|
+
query_vector=d.get('query_vector', None),
|
|
637
|
+
score_threshold=d.get('score_threshold', None))
|
|
621
638
|
|
|
622
639
|
|
|
623
640
|
@dataclass
|
|
@@ -688,6 +705,20 @@ class ResultManifest:
|
|
|
688
705
|
return cls(column_count=d.get('column_count', None), columns=_repeated_dict(d, 'columns', ColumnInfo))
|
|
689
706
|
|
|
690
707
|
|
|
708
|
+
@dataclass
|
|
709
|
+
class SyncIndexResponse:
|
|
710
|
+
|
|
711
|
+
def as_dict(self) -> dict:
|
|
712
|
+
"""Serializes the SyncIndexResponse into a dictionary suitable for use as a JSON request body."""
|
|
713
|
+
body = {}
|
|
714
|
+
return body
|
|
715
|
+
|
|
716
|
+
@classmethod
|
|
717
|
+
def from_dict(cls, d: Dict[str, any]) -> SyncIndexResponse:
|
|
718
|
+
"""Deserializes the SyncIndexResponse from a dictionary."""
|
|
719
|
+
return cls()
|
|
720
|
+
|
|
721
|
+
|
|
691
722
|
@dataclass
|
|
692
723
|
class UpsertDataResult:
|
|
693
724
|
"""Result of the upsert or delete operation."""
|
|
@@ -727,20 +758,20 @@ class UpsertDataVectorIndexRequest:
|
|
|
727
758
|
inputs_json: str
|
|
728
759
|
"""JSON string representing the data to be upserted."""
|
|
729
760
|
|
|
730
|
-
|
|
761
|
+
index_name: Optional[str] = None
|
|
731
762
|
"""Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index."""
|
|
732
763
|
|
|
733
764
|
def as_dict(self) -> dict:
|
|
734
765
|
"""Serializes the UpsertDataVectorIndexRequest into a dictionary suitable for use as a JSON request body."""
|
|
735
766
|
body = {}
|
|
767
|
+
if self.index_name is not None: body['index_name'] = self.index_name
|
|
736
768
|
if self.inputs_json is not None: body['inputs_json'] = self.inputs_json
|
|
737
|
-
if self.name is not None: body['name'] = self.name
|
|
738
769
|
return body
|
|
739
770
|
|
|
740
771
|
@classmethod
|
|
741
772
|
def from_dict(cls, d: Dict[str, any]) -> UpsertDataVectorIndexRequest:
|
|
742
773
|
"""Deserializes the UpsertDataVectorIndexRequest from a dictionary."""
|
|
743
|
-
return cls(
|
|
774
|
+
return cls(index_name=d.get('index_name', None), inputs_json=d.get('inputs_json', None))
|
|
744
775
|
|
|
745
776
|
|
|
746
777
|
@dataclass
|
|
@@ -772,9 +803,9 @@ class VectorIndex:
|
|
|
772
803
|
creator: Optional[str] = None
|
|
773
804
|
"""The user who created the index."""
|
|
774
805
|
|
|
775
|
-
|
|
806
|
+
delta_sync_index_spec: Optional[DeltaSyncVectorIndexSpecResponse] = None
|
|
776
807
|
|
|
777
|
-
|
|
808
|
+
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
778
809
|
|
|
779
810
|
endpoint_name: Optional[str] = None
|
|
780
811
|
"""Name of the endpoint associated with the index"""
|
|
@@ -799,10 +830,9 @@ class VectorIndex:
|
|
|
799
830
|
"""Serializes the VectorIndex into a dictionary suitable for use as a JSON request body."""
|
|
800
831
|
body = {}
|
|
801
832
|
if self.creator is not None: body['creator'] = self.creator
|
|
802
|
-
if self.
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
body['direct_access_vector_index_spec'] = self.direct_access_vector_index_spec.as_dict()
|
|
833
|
+
if self.delta_sync_index_spec: body['delta_sync_index_spec'] = self.delta_sync_index_spec.as_dict()
|
|
834
|
+
if self.direct_access_index_spec:
|
|
835
|
+
body['direct_access_index_spec'] = self.direct_access_index_spec.as_dict()
|
|
806
836
|
if self.endpoint_name is not None: body['endpoint_name'] = self.endpoint_name
|
|
807
837
|
if self.index_type is not None: body['index_type'] = self.index_type.value
|
|
808
838
|
if self.name is not None: body['name'] = self.name
|
|
@@ -814,10 +844,10 @@ class VectorIndex:
|
|
|
814
844
|
def from_dict(cls, d: Dict[str, any]) -> VectorIndex:
|
|
815
845
|
"""Deserializes the VectorIndex from a dictionary."""
|
|
816
846
|
return cls(creator=d.get('creator', None),
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
847
|
+
delta_sync_index_spec=_from_dict(d, 'delta_sync_index_spec',
|
|
848
|
+
DeltaSyncVectorIndexSpecResponse),
|
|
849
|
+
direct_access_index_spec=_from_dict(d, 'direct_access_index_spec',
|
|
850
|
+
DirectAccessVectorIndexSpec),
|
|
821
851
|
endpoint_name=d.get('endpoint_name', None),
|
|
822
852
|
index_type=_enum(d, 'index_type', VectorIndexType),
|
|
823
853
|
name=d.get('name', None),
|
|
@@ -926,6 +956,7 @@ class VectorSearchEndpointsAPI:
|
|
|
926
956
|
if endpoint_type is not None: body['endpoint_type'] = endpoint_type.value
|
|
927
957
|
if name is not None: body['name'] = name
|
|
928
958
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
959
|
+
|
|
929
960
|
op_response = self._api.do('POST', '/api/2.0/vector-search/endpoints', body=body, headers=headers)
|
|
930
961
|
return Wait(self.wait_get_endpoint_vector_search_endpoint_online,
|
|
931
962
|
response=EndpointInfo.from_dict(op_response),
|
|
@@ -935,18 +966,17 @@ class VectorSearchEndpointsAPI:
|
|
|
935
966
|
timeout=timedelta(minutes=20)) -> EndpointInfo:
|
|
936
967
|
return self.create_endpoint(endpoint_type=endpoint_type, name=name).result(timeout=timeout)
|
|
937
968
|
|
|
938
|
-
def delete_endpoint(self, endpoint_name: str
|
|
969
|
+
def delete_endpoint(self, endpoint_name: str):
|
|
939
970
|
"""Delete an endpoint.
|
|
940
971
|
|
|
941
972
|
:param endpoint_name: str
|
|
942
973
|
Name of the endpoint
|
|
943
|
-
:param name: str
|
|
944
|
-
Name of the endpoint to delete
|
|
945
974
|
|
|
946
975
|
|
|
947
976
|
"""
|
|
948
977
|
|
|
949
978
|
headers = {}
|
|
979
|
+
|
|
950
980
|
self._api.do('DELETE', f'/api/2.0/vector-search/endpoints/{endpoint_name}', headers=headers)
|
|
951
981
|
|
|
952
982
|
def get_endpoint(self, endpoint_name: str) -> EndpointInfo:
|
|
@@ -959,6 +989,7 @@ class VectorSearchEndpointsAPI:
|
|
|
959
989
|
"""
|
|
960
990
|
|
|
961
991
|
headers = {'Accept': 'application/json', }
|
|
992
|
+
|
|
962
993
|
res = self._api.do('GET', f'/api/2.0/vector-search/endpoints/{endpoint_name}', headers=headers)
|
|
963
994
|
return EndpointInfo.from_dict(res)
|
|
964
995
|
|
|
@@ -997,20 +1028,24 @@ class VectorSearchIndexesAPI:
|
|
|
997
1028
|
def __init__(self, api_client):
|
|
998
1029
|
self._api = api_client
|
|
999
1030
|
|
|
1000
|
-
def create_index(
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1031
|
+
def create_index(
|
|
1032
|
+
self,
|
|
1033
|
+
name: str,
|
|
1034
|
+
endpoint_name: str,
|
|
1035
|
+
primary_key: str,
|
|
1036
|
+
index_type: VectorIndexType,
|
|
1037
|
+
*,
|
|
1038
|
+
delta_sync_index_spec: Optional[DeltaSyncVectorIndexSpecRequest] = None,
|
|
1039
|
+
direct_access_index_spec: Optional[DirectAccessVectorIndexSpec] = None
|
|
1040
|
+
) -> CreateVectorIndexResponse:
|
|
1008
1041
|
"""Create an index.
|
|
1009
1042
|
|
|
1010
1043
|
Create a new index.
|
|
1011
1044
|
|
|
1012
1045
|
:param name: str
|
|
1013
1046
|
Name of the index
|
|
1047
|
+
:param endpoint_name: str
|
|
1048
|
+
Name of the endpoint to be used for serving the index
|
|
1014
1049
|
:param primary_key: str
|
|
1015
1050
|
Primary key of the index
|
|
1016
1051
|
:param index_type: :class:`VectorIndexType`
|
|
@@ -1024,8 +1059,6 @@ class VectorSearchIndexesAPI:
|
|
|
1024
1059
|
Specification for Delta Sync Index. Required if `index_type` is `DELTA_SYNC`.
|
|
1025
1060
|
:param direct_access_index_spec: :class:`DirectAccessVectorIndexSpec` (optional)
|
|
1026
1061
|
Specification for Direct Vector Access Index. Required if `index_type` is `DIRECT_ACCESS`.
|
|
1027
|
-
:param endpoint_name: str (optional)
|
|
1028
|
-
Name of the endpoint to be used for serving the index
|
|
1029
1062
|
|
|
1030
1063
|
:returns: :class:`CreateVectorIndexResponse`
|
|
1031
1064
|
"""
|
|
@@ -1038,15 +1071,17 @@ class VectorSearchIndexesAPI:
|
|
|
1038
1071
|
if name is not None: body['name'] = name
|
|
1039
1072
|
if primary_key is not None: body['primary_key'] = primary_key
|
|
1040
1073
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1074
|
+
|
|
1041
1075
|
res = self._api.do('POST', '/api/2.0/vector-search/indexes', body=body, headers=headers)
|
|
1042
1076
|
return CreateVectorIndexResponse.from_dict(res)
|
|
1043
1077
|
|
|
1044
|
-
def delete_data_vector_index(self,
|
|
1078
|
+
def delete_data_vector_index(self, index_name: str,
|
|
1079
|
+
primary_keys: List[str]) -> DeleteDataVectorIndexResponse:
|
|
1045
1080
|
"""Delete data from index.
|
|
1046
1081
|
|
|
1047
1082
|
Handles the deletion of data from a specified vector index.
|
|
1048
1083
|
|
|
1049
|
-
:param
|
|
1084
|
+
:param index_name: str
|
|
1050
1085
|
Name of the vector index where data is to be deleted. Must be a Direct Vector Access Index.
|
|
1051
1086
|
:param primary_keys: List[str]
|
|
1052
1087
|
List of primary keys for the data to be deleted.
|
|
@@ -1056,8 +1091,9 @@ class VectorSearchIndexesAPI:
|
|
|
1056
1091
|
body = {}
|
|
1057
1092
|
if primary_keys is not None: body['primary_keys'] = [v for v in primary_keys]
|
|
1058
1093
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1094
|
+
|
|
1059
1095
|
res = self._api.do('POST',
|
|
1060
|
-
f'/api/2.0/vector-search/indexes/{
|
|
1096
|
+
f'/api/2.0/vector-search/indexes/{index_name}/delete-data',
|
|
1061
1097
|
body=body,
|
|
1062
1098
|
headers=headers)
|
|
1063
1099
|
return DeleteDataVectorIndexResponse.from_dict(res)
|
|
@@ -1074,6 +1110,7 @@ class VectorSearchIndexesAPI:
|
|
|
1074
1110
|
"""
|
|
1075
1111
|
|
|
1076
1112
|
headers = {}
|
|
1113
|
+
|
|
1077
1114
|
self._api.do('DELETE', f'/api/2.0/vector-search/indexes/{index_name}', headers=headers)
|
|
1078
1115
|
|
|
1079
1116
|
def get_index(self, index_name: str) -> VectorIndex:
|
|
@@ -1088,6 +1125,7 @@ class VectorSearchIndexesAPI:
|
|
|
1088
1125
|
"""
|
|
1089
1126
|
|
|
1090
1127
|
headers = {'Accept': 'application/json', }
|
|
1128
|
+
|
|
1091
1129
|
res = self._api.do('GET', f'/api/2.0/vector-search/indexes/{index_name}', headers=headers)
|
|
1092
1130
|
return VectorIndex.from_dict(res)
|
|
1093
1131
|
|
|
@@ -1128,7 +1166,8 @@ class VectorSearchIndexesAPI:
|
|
|
1128
1166
|
filters_json: Optional[str] = None,
|
|
1129
1167
|
num_results: Optional[int] = None,
|
|
1130
1168
|
query_text: Optional[str] = None,
|
|
1131
|
-
query_vector: Optional[List[float]] = None
|
|
1169
|
+
query_vector: Optional[List[float]] = None,
|
|
1170
|
+
score_threshold: Optional[float] = None) -> QueryVectorIndexResponse:
|
|
1132
1171
|
"""Query an index.
|
|
1133
1172
|
|
|
1134
1173
|
Query the specified vector index.
|
|
@@ -1150,6 +1189,8 @@ class VectorSearchIndexesAPI:
|
|
|
1150
1189
|
:param query_vector: List[float] (optional)
|
|
1151
1190
|
Query vector. Required for Direct Vector Access Index and Delta Sync Index using self-managed
|
|
1152
1191
|
vectors.
|
|
1192
|
+
:param score_threshold: float (optional)
|
|
1193
|
+
Threshold for the approximate nearest neighbor search. Defaults to 0.0.
|
|
1153
1194
|
|
|
1154
1195
|
:returns: :class:`QueryVectorIndexResponse`
|
|
1155
1196
|
"""
|
|
@@ -1159,7 +1200,9 @@ class VectorSearchIndexesAPI:
|
|
|
1159
1200
|
if num_results is not None: body['num_results'] = num_results
|
|
1160
1201
|
if query_text is not None: body['query_text'] = query_text
|
|
1161
1202
|
if query_vector is not None: body['query_vector'] = [v for v in query_vector]
|
|
1203
|
+
if score_threshold is not None: body['score_threshold'] = score_threshold
|
|
1162
1204
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1205
|
+
|
|
1163
1206
|
res = self._api.do('POST',
|
|
1164
1207
|
f'/api/2.0/vector-search/indexes/{index_name}/query',
|
|
1165
1208
|
body=body,
|
|
@@ -1178,14 +1221,15 @@ class VectorSearchIndexesAPI:
|
|
|
1178
1221
|
"""
|
|
1179
1222
|
|
|
1180
1223
|
headers = {}
|
|
1224
|
+
|
|
1181
1225
|
self._api.do('POST', f'/api/2.0/vector-search/indexes/{index_name}/sync', headers=headers)
|
|
1182
1226
|
|
|
1183
|
-
def upsert_data_vector_index(self,
|
|
1227
|
+
def upsert_data_vector_index(self, index_name: str, inputs_json: str) -> UpsertDataVectorIndexResponse:
|
|
1184
1228
|
"""Upsert data into an index.
|
|
1185
1229
|
|
|
1186
1230
|
Handles the upserting of data into a specified vector index.
|
|
1187
1231
|
|
|
1188
|
-
:param
|
|
1232
|
+
:param index_name: str
|
|
1189
1233
|
Name of the vector index where data is to be upserted. Must be a Direct Vector Access Index.
|
|
1190
1234
|
:param inputs_json: str
|
|
1191
1235
|
JSON string representing the data to be upserted.
|
|
@@ -1195,8 +1239,9 @@ class VectorSearchIndexesAPI:
|
|
|
1195
1239
|
body = {}
|
|
1196
1240
|
if inputs_json is not None: body['inputs_json'] = inputs_json
|
|
1197
1241
|
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
1242
|
+
|
|
1198
1243
|
res = self._api.do('POST',
|
|
1199
|
-
f'/api/2.0/vector-search/indexes/{
|
|
1244
|
+
f'/api/2.0/vector-search/indexes/{index_name}/upsert-data',
|
|
1200
1245
|
body=body,
|
|
1201
1246
|
headers=headers)
|
|
1202
1247
|
return UpsertDataVectorIndexResponse.from_dict(res)
|