databricks-sdk 0.55.0__py3-none-any.whl → 0.57.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 +41 -24
- databricks/sdk/service/aibuilder.py +505 -0
- databricks/sdk/service/apps.py +14 -42
- databricks/sdk/service/billing.py +167 -220
- databricks/sdk/service/catalog.py +462 -1235
- databricks/sdk/service/cleanrooms.py +26 -43
- databricks/sdk/service/compute.py +75 -211
- databricks/sdk/service/dashboards.py +77 -511
- databricks/sdk/service/database.py +1271 -0
- databricks/sdk/service/files.py +20 -54
- databricks/sdk/service/iam.py +61 -171
- databricks/sdk/service/jobs.py +453 -68
- databricks/sdk/service/marketplace.py +46 -146
- databricks/sdk/service/ml.py +453 -477
- databricks/sdk/service/oauth2.py +17 -45
- databricks/sdk/service/pipelines.py +125 -40
- databricks/sdk/service/provisioning.py +30 -93
- databricks/sdk/service/qualitymonitorv2.py +265 -0
- databricks/sdk/service/serving.py +106 -46
- databricks/sdk/service/settings.py +1062 -390
- databricks/sdk/service/sharing.py +33 -88
- databricks/sdk/service/sql.py +292 -185
- databricks/sdk/service/vectorsearch.py +13 -43
- databricks/sdk/service/workspace.py +35 -105
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/METADATA +1 -1
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/RECORD +31 -28
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/licenses/LICENSE +0 -0
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/licenses/NOTICE +0 -0
- {databricks_sdk-0.55.0.dist-info → databricks_sdk-0.57.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
# Code generated from OpenAPI specs by Databricks SDK Generator. DO NOT EDIT.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
from enum import Enum
|
|
8
|
+
from typing import Any, Dict, List, Optional
|
|
9
|
+
|
|
10
|
+
from ._internal import _enum, _from_dict, _repeated_dict
|
|
11
|
+
|
|
12
|
+
_LOG = logging.getLogger("databricks.sdk")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
# all definitions in this file are in alphabetical order
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class CancelCustomLlmOptimizationRunRequest:
|
|
20
|
+
id: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass
|
|
24
|
+
class CancelOptimizeResponse:
|
|
25
|
+
def as_dict(self) -> dict:
|
|
26
|
+
"""Serializes the CancelOptimizeResponse into a dictionary suitable for use as a JSON request body."""
|
|
27
|
+
body = {}
|
|
28
|
+
return body
|
|
29
|
+
|
|
30
|
+
def as_shallow_dict(self) -> dict:
|
|
31
|
+
"""Serializes the CancelOptimizeResponse into a shallow dictionary of its immediate attributes."""
|
|
32
|
+
body = {}
|
|
33
|
+
return body
|
|
34
|
+
|
|
35
|
+
@classmethod
|
|
36
|
+
def from_dict(cls, d: Dict[str, Any]) -> CancelOptimizeResponse:
|
|
37
|
+
"""Deserializes the CancelOptimizeResponse from a dictionary."""
|
|
38
|
+
return cls()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass
|
|
42
|
+
class CreateCustomLlmRequest:
|
|
43
|
+
name: str
|
|
44
|
+
"""Name of the custom LLM. Only alphanumeric characters and dashes allowed."""
|
|
45
|
+
|
|
46
|
+
instructions: str
|
|
47
|
+
"""Instructions for the custom LLM to follow"""
|
|
48
|
+
|
|
49
|
+
agent_artifact_path: Optional[str] = None
|
|
50
|
+
"""Optional: UC path for agent artifacts. If you are using a dataset that you only have read
|
|
51
|
+
permissions, please provide a destination path where you have write permissions. Please provide
|
|
52
|
+
this in catalog.schema format."""
|
|
53
|
+
|
|
54
|
+
datasets: Optional[List[Dataset]] = None
|
|
55
|
+
"""Datasets used for training and evaluating the model, not for inference. Currently, only 1
|
|
56
|
+
dataset is accepted."""
|
|
57
|
+
|
|
58
|
+
guidelines: Optional[List[str]] = None
|
|
59
|
+
"""Guidelines for the custom LLM to adhere to"""
|
|
60
|
+
|
|
61
|
+
def as_dict(self) -> dict:
|
|
62
|
+
"""Serializes the CreateCustomLlmRequest into a dictionary suitable for use as a JSON request body."""
|
|
63
|
+
body = {}
|
|
64
|
+
if self.agent_artifact_path is not None:
|
|
65
|
+
body["agent_artifact_path"] = self.agent_artifact_path
|
|
66
|
+
if self.datasets:
|
|
67
|
+
body["datasets"] = [v.as_dict() for v in self.datasets]
|
|
68
|
+
if self.guidelines:
|
|
69
|
+
body["guidelines"] = [v for v in self.guidelines]
|
|
70
|
+
if self.instructions is not None:
|
|
71
|
+
body["instructions"] = self.instructions
|
|
72
|
+
if self.name is not None:
|
|
73
|
+
body["name"] = self.name
|
|
74
|
+
return body
|
|
75
|
+
|
|
76
|
+
def as_shallow_dict(self) -> dict:
|
|
77
|
+
"""Serializes the CreateCustomLlmRequest into a shallow dictionary of its immediate attributes."""
|
|
78
|
+
body = {}
|
|
79
|
+
if self.agent_artifact_path is not None:
|
|
80
|
+
body["agent_artifact_path"] = self.agent_artifact_path
|
|
81
|
+
if self.datasets:
|
|
82
|
+
body["datasets"] = self.datasets
|
|
83
|
+
if self.guidelines:
|
|
84
|
+
body["guidelines"] = self.guidelines
|
|
85
|
+
if self.instructions is not None:
|
|
86
|
+
body["instructions"] = self.instructions
|
|
87
|
+
if self.name is not None:
|
|
88
|
+
body["name"] = self.name
|
|
89
|
+
return body
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, d: Dict[str, Any]) -> CreateCustomLlmRequest:
|
|
93
|
+
"""Deserializes the CreateCustomLlmRequest from a dictionary."""
|
|
94
|
+
return cls(
|
|
95
|
+
agent_artifact_path=d.get("agent_artifact_path", None),
|
|
96
|
+
datasets=_repeated_dict(d, "datasets", Dataset),
|
|
97
|
+
guidelines=d.get("guidelines", None),
|
|
98
|
+
instructions=d.get("instructions", None),
|
|
99
|
+
name=d.get("name", None),
|
|
100
|
+
)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass
|
|
104
|
+
class CustomLlm:
|
|
105
|
+
name: str
|
|
106
|
+
"""Name of the custom LLM"""
|
|
107
|
+
|
|
108
|
+
instructions: str
|
|
109
|
+
"""Instructions for the custom LLM to follow"""
|
|
110
|
+
|
|
111
|
+
optimization_state: State
|
|
112
|
+
"""If optimization is kicked off, tracks the state of the custom LLM"""
|
|
113
|
+
|
|
114
|
+
agent_artifact_path: Optional[str] = None
|
|
115
|
+
|
|
116
|
+
creation_time: Optional[str] = None
|
|
117
|
+
"""Creation timestamp of the custom LLM"""
|
|
118
|
+
|
|
119
|
+
creator: Optional[str] = None
|
|
120
|
+
"""Creator of the custom LLM"""
|
|
121
|
+
|
|
122
|
+
datasets: Optional[List[Dataset]] = None
|
|
123
|
+
"""Datasets used for training and evaluating the model, not for inference"""
|
|
124
|
+
|
|
125
|
+
endpoint_name: Optional[str] = None
|
|
126
|
+
"""Name of the endpoint that will be used to serve the custom LLM"""
|
|
127
|
+
|
|
128
|
+
guidelines: Optional[List[str]] = None
|
|
129
|
+
"""Guidelines for the custom LLM to adhere to"""
|
|
130
|
+
|
|
131
|
+
id: Optional[str] = None
|
|
132
|
+
|
|
133
|
+
def as_dict(self) -> dict:
|
|
134
|
+
"""Serializes the CustomLlm into a dictionary suitable for use as a JSON request body."""
|
|
135
|
+
body = {}
|
|
136
|
+
if self.agent_artifact_path is not None:
|
|
137
|
+
body["agent_artifact_path"] = self.agent_artifact_path
|
|
138
|
+
if self.creation_time is not None:
|
|
139
|
+
body["creation_time"] = self.creation_time
|
|
140
|
+
if self.creator is not None:
|
|
141
|
+
body["creator"] = self.creator
|
|
142
|
+
if self.datasets:
|
|
143
|
+
body["datasets"] = [v.as_dict() for v in self.datasets]
|
|
144
|
+
if self.endpoint_name is not None:
|
|
145
|
+
body["endpoint_name"] = self.endpoint_name
|
|
146
|
+
if self.guidelines:
|
|
147
|
+
body["guidelines"] = [v for v in self.guidelines]
|
|
148
|
+
if self.id is not None:
|
|
149
|
+
body["id"] = self.id
|
|
150
|
+
if self.instructions is not None:
|
|
151
|
+
body["instructions"] = self.instructions
|
|
152
|
+
if self.name is not None:
|
|
153
|
+
body["name"] = self.name
|
|
154
|
+
if self.optimization_state is not None:
|
|
155
|
+
body["optimization_state"] = self.optimization_state.value
|
|
156
|
+
return body
|
|
157
|
+
|
|
158
|
+
def as_shallow_dict(self) -> dict:
|
|
159
|
+
"""Serializes the CustomLlm into a shallow dictionary of its immediate attributes."""
|
|
160
|
+
body = {}
|
|
161
|
+
if self.agent_artifact_path is not None:
|
|
162
|
+
body["agent_artifact_path"] = self.agent_artifact_path
|
|
163
|
+
if self.creation_time is not None:
|
|
164
|
+
body["creation_time"] = self.creation_time
|
|
165
|
+
if self.creator is not None:
|
|
166
|
+
body["creator"] = self.creator
|
|
167
|
+
if self.datasets:
|
|
168
|
+
body["datasets"] = self.datasets
|
|
169
|
+
if self.endpoint_name is not None:
|
|
170
|
+
body["endpoint_name"] = self.endpoint_name
|
|
171
|
+
if self.guidelines:
|
|
172
|
+
body["guidelines"] = self.guidelines
|
|
173
|
+
if self.id is not None:
|
|
174
|
+
body["id"] = self.id
|
|
175
|
+
if self.instructions is not None:
|
|
176
|
+
body["instructions"] = self.instructions
|
|
177
|
+
if self.name is not None:
|
|
178
|
+
body["name"] = self.name
|
|
179
|
+
if self.optimization_state is not None:
|
|
180
|
+
body["optimization_state"] = self.optimization_state
|
|
181
|
+
return body
|
|
182
|
+
|
|
183
|
+
@classmethod
|
|
184
|
+
def from_dict(cls, d: Dict[str, Any]) -> CustomLlm:
|
|
185
|
+
"""Deserializes the CustomLlm from a dictionary."""
|
|
186
|
+
return cls(
|
|
187
|
+
agent_artifact_path=d.get("agent_artifact_path", None),
|
|
188
|
+
creation_time=d.get("creation_time", None),
|
|
189
|
+
creator=d.get("creator", None),
|
|
190
|
+
datasets=_repeated_dict(d, "datasets", Dataset),
|
|
191
|
+
endpoint_name=d.get("endpoint_name", None),
|
|
192
|
+
guidelines=d.get("guidelines", None),
|
|
193
|
+
id=d.get("id", None),
|
|
194
|
+
instructions=d.get("instructions", None),
|
|
195
|
+
name=d.get("name", None),
|
|
196
|
+
optimization_state=_enum(d, "optimization_state", State),
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
@dataclass
|
|
201
|
+
class Dataset:
|
|
202
|
+
table: Table
|
|
203
|
+
|
|
204
|
+
def as_dict(self) -> dict:
|
|
205
|
+
"""Serializes the Dataset into a dictionary suitable for use as a JSON request body."""
|
|
206
|
+
body = {}
|
|
207
|
+
if self.table:
|
|
208
|
+
body["table"] = self.table.as_dict()
|
|
209
|
+
return body
|
|
210
|
+
|
|
211
|
+
def as_shallow_dict(self) -> dict:
|
|
212
|
+
"""Serializes the Dataset into a shallow dictionary of its immediate attributes."""
|
|
213
|
+
body = {}
|
|
214
|
+
if self.table:
|
|
215
|
+
body["table"] = self.table
|
|
216
|
+
return body
|
|
217
|
+
|
|
218
|
+
@classmethod
|
|
219
|
+
def from_dict(cls, d: Dict[str, Any]) -> Dataset:
|
|
220
|
+
"""Deserializes the Dataset from a dictionary."""
|
|
221
|
+
return cls(table=_from_dict(d, "table", Table))
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@dataclass
|
|
225
|
+
class DeleteCustomLlmResponse:
|
|
226
|
+
def as_dict(self) -> dict:
|
|
227
|
+
"""Serializes the DeleteCustomLlmResponse into a dictionary suitable for use as a JSON request body."""
|
|
228
|
+
body = {}
|
|
229
|
+
return body
|
|
230
|
+
|
|
231
|
+
def as_shallow_dict(self) -> dict:
|
|
232
|
+
"""Serializes the DeleteCustomLlmResponse into a shallow dictionary of its immediate attributes."""
|
|
233
|
+
body = {}
|
|
234
|
+
return body
|
|
235
|
+
|
|
236
|
+
@classmethod
|
|
237
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeleteCustomLlmResponse:
|
|
238
|
+
"""Deserializes the DeleteCustomLlmResponse from a dictionary."""
|
|
239
|
+
return cls()
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@dataclass
|
|
243
|
+
class StartCustomLlmOptimizationRunRequest:
|
|
244
|
+
id: Optional[str] = None
|
|
245
|
+
"""The Id of the tile."""
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class State(Enum):
|
|
249
|
+
"""States of Custom LLM optimization lifecycle."""
|
|
250
|
+
|
|
251
|
+
CANCELLED = "CANCELLED"
|
|
252
|
+
COMPLETED = "COMPLETED"
|
|
253
|
+
CREATED = "CREATED"
|
|
254
|
+
FAILED = "FAILED"
|
|
255
|
+
PENDING = "PENDING"
|
|
256
|
+
RUNNING = "RUNNING"
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
@dataclass
|
|
260
|
+
class Table:
|
|
261
|
+
table_path: str
|
|
262
|
+
"""Full UC table path in catalog.schema.table_name format"""
|
|
263
|
+
|
|
264
|
+
request_col: str
|
|
265
|
+
"""Name of the request column"""
|
|
266
|
+
|
|
267
|
+
response_col: Optional[str] = None
|
|
268
|
+
"""Optional: Name of the response column if the data is labeled"""
|
|
269
|
+
|
|
270
|
+
def as_dict(self) -> dict:
|
|
271
|
+
"""Serializes the Table into a dictionary suitable for use as a JSON request body."""
|
|
272
|
+
body = {}
|
|
273
|
+
if self.request_col is not None:
|
|
274
|
+
body["request_col"] = self.request_col
|
|
275
|
+
if self.response_col is not None:
|
|
276
|
+
body["response_col"] = self.response_col
|
|
277
|
+
if self.table_path is not None:
|
|
278
|
+
body["table_path"] = self.table_path
|
|
279
|
+
return body
|
|
280
|
+
|
|
281
|
+
def as_shallow_dict(self) -> dict:
|
|
282
|
+
"""Serializes the Table into a shallow dictionary of its immediate attributes."""
|
|
283
|
+
body = {}
|
|
284
|
+
if self.request_col is not None:
|
|
285
|
+
body["request_col"] = self.request_col
|
|
286
|
+
if self.response_col is not None:
|
|
287
|
+
body["response_col"] = self.response_col
|
|
288
|
+
if self.table_path is not None:
|
|
289
|
+
body["table_path"] = self.table_path
|
|
290
|
+
return body
|
|
291
|
+
|
|
292
|
+
@classmethod
|
|
293
|
+
def from_dict(cls, d: Dict[str, Any]) -> Table:
|
|
294
|
+
"""Deserializes the Table from a dictionary."""
|
|
295
|
+
return cls(
|
|
296
|
+
request_col=d.get("request_col", None),
|
|
297
|
+
response_col=d.get("response_col", None),
|
|
298
|
+
table_path=d.get("table_path", None),
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
@dataclass
|
|
303
|
+
class UpdateCustomLlmRequest:
|
|
304
|
+
custom_llm: CustomLlm
|
|
305
|
+
"""The CustomLlm containing the fields which should be updated."""
|
|
306
|
+
|
|
307
|
+
update_mask: str
|
|
308
|
+
"""The list of the CustomLlm fields to update. These should correspond to the values (or lack
|
|
309
|
+
thereof) present in `custom_llm`.
|
|
310
|
+
|
|
311
|
+
The field mask must be a single string, with multiple fields separated by commas (no spaces).
|
|
312
|
+
The field path is relative to the resource object, using a dot (`.`) to navigate sub-fields
|
|
313
|
+
(e.g., `author.given_name`). Specification of elements in sequence or map fields is not allowed,
|
|
314
|
+
as only the entire collection field can be specified. Field names must exactly match the
|
|
315
|
+
resource field names.
|
|
316
|
+
|
|
317
|
+
A field mask of `*` indicates full replacement. It’s recommended to always explicitly list the
|
|
318
|
+
fields being updated and avoid using `*` wildcards, as it can lead to unintended results if the
|
|
319
|
+
API changes in the future."""
|
|
320
|
+
|
|
321
|
+
id: Optional[str] = None
|
|
322
|
+
"""The id of the custom llm"""
|
|
323
|
+
|
|
324
|
+
def as_dict(self) -> dict:
|
|
325
|
+
"""Serializes the UpdateCustomLlmRequest into a dictionary suitable for use as a JSON request body."""
|
|
326
|
+
body = {}
|
|
327
|
+
if self.custom_llm:
|
|
328
|
+
body["custom_llm"] = self.custom_llm.as_dict()
|
|
329
|
+
if self.id is not None:
|
|
330
|
+
body["id"] = self.id
|
|
331
|
+
if self.update_mask is not None:
|
|
332
|
+
body["update_mask"] = self.update_mask
|
|
333
|
+
return body
|
|
334
|
+
|
|
335
|
+
def as_shallow_dict(self) -> dict:
|
|
336
|
+
"""Serializes the UpdateCustomLlmRequest into a shallow dictionary of its immediate attributes."""
|
|
337
|
+
body = {}
|
|
338
|
+
if self.custom_llm:
|
|
339
|
+
body["custom_llm"] = self.custom_llm
|
|
340
|
+
if self.id is not None:
|
|
341
|
+
body["id"] = self.id
|
|
342
|
+
if self.update_mask is not None:
|
|
343
|
+
body["update_mask"] = self.update_mask
|
|
344
|
+
return body
|
|
345
|
+
|
|
346
|
+
@classmethod
|
|
347
|
+
def from_dict(cls, d: Dict[str, Any]) -> UpdateCustomLlmRequest:
|
|
348
|
+
"""Deserializes the UpdateCustomLlmRequest from a dictionary."""
|
|
349
|
+
return cls(
|
|
350
|
+
custom_llm=_from_dict(d, "custom_llm", CustomLlm),
|
|
351
|
+
id=d.get("id", None),
|
|
352
|
+
update_mask=d.get("update_mask", None),
|
|
353
|
+
)
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
class AiBuilderAPI:
|
|
357
|
+
"""The Custom LLMs service manages state and powers the UI for the Custom LLM product."""
|
|
358
|
+
|
|
359
|
+
def __init__(self, api_client):
|
|
360
|
+
self._api = api_client
|
|
361
|
+
|
|
362
|
+
def cancel_optimize(self, id: str):
|
|
363
|
+
"""Cancel a Custom LLM Optimization Run.
|
|
364
|
+
|
|
365
|
+
:param id: str
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
"""
|
|
369
|
+
|
|
370
|
+
headers = {
|
|
371
|
+
"Accept": "application/json",
|
|
372
|
+
"Content-Type": "application/json",
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
self._api.do("POST", f"/api/2.0/custom-llms/{id}/optimize/cancel", headers=headers)
|
|
376
|
+
|
|
377
|
+
def create_custom_llm(
|
|
378
|
+
self,
|
|
379
|
+
name: str,
|
|
380
|
+
instructions: str,
|
|
381
|
+
*,
|
|
382
|
+
agent_artifact_path: Optional[str] = None,
|
|
383
|
+
datasets: Optional[List[Dataset]] = None,
|
|
384
|
+
guidelines: Optional[List[str]] = None,
|
|
385
|
+
) -> CustomLlm:
|
|
386
|
+
"""Create a Custom LLM.
|
|
387
|
+
|
|
388
|
+
:param name: str
|
|
389
|
+
Name of the custom LLM. Only alphanumeric characters and dashes allowed.
|
|
390
|
+
:param instructions: str
|
|
391
|
+
Instructions for the custom LLM to follow
|
|
392
|
+
:param agent_artifact_path: str (optional)
|
|
393
|
+
Optional: UC path for agent artifacts. If you are using a dataset that you only have read
|
|
394
|
+
permissions, please provide a destination path where you have write permissions. Please provide this
|
|
395
|
+
in catalog.schema format.
|
|
396
|
+
:param datasets: List[:class:`Dataset`] (optional)
|
|
397
|
+
Datasets used for training and evaluating the model, not for inference. Currently, only 1 dataset is
|
|
398
|
+
accepted.
|
|
399
|
+
:param guidelines: List[str] (optional)
|
|
400
|
+
Guidelines for the custom LLM to adhere to
|
|
401
|
+
|
|
402
|
+
:returns: :class:`CustomLlm`
|
|
403
|
+
"""
|
|
404
|
+
body = {}
|
|
405
|
+
if agent_artifact_path is not None:
|
|
406
|
+
body["agent_artifact_path"] = agent_artifact_path
|
|
407
|
+
if datasets is not None:
|
|
408
|
+
body["datasets"] = [v.as_dict() for v in datasets]
|
|
409
|
+
if guidelines is not None:
|
|
410
|
+
body["guidelines"] = [v for v in guidelines]
|
|
411
|
+
if instructions is not None:
|
|
412
|
+
body["instructions"] = instructions
|
|
413
|
+
if name is not None:
|
|
414
|
+
body["name"] = name
|
|
415
|
+
headers = {
|
|
416
|
+
"Accept": "application/json",
|
|
417
|
+
"Content-Type": "application/json",
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
res = self._api.do("POST", "/api/2.0/custom-llms", body=body, headers=headers)
|
|
421
|
+
return CustomLlm.from_dict(res)
|
|
422
|
+
|
|
423
|
+
def delete_custom_llm(self, id: str):
|
|
424
|
+
"""Delete a Custom LLM.
|
|
425
|
+
|
|
426
|
+
:param id: str
|
|
427
|
+
The id of the custom llm
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
"""
|
|
431
|
+
|
|
432
|
+
headers = {
|
|
433
|
+
"Accept": "application/json",
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
self._api.do("DELETE", f"/api/2.0/custom-lms/{id}", headers=headers)
|
|
437
|
+
|
|
438
|
+
def get_custom_llm(self, id: str) -> CustomLlm:
|
|
439
|
+
"""Get a Custom LLM.
|
|
440
|
+
|
|
441
|
+
:param id: str
|
|
442
|
+
The id of the custom llm
|
|
443
|
+
|
|
444
|
+
:returns: :class:`CustomLlm`
|
|
445
|
+
"""
|
|
446
|
+
|
|
447
|
+
headers = {
|
|
448
|
+
"Accept": "application/json",
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
res = self._api.do("GET", f"/api/2.0/custom-llms/{id}", headers=headers)
|
|
452
|
+
return CustomLlm.from_dict(res)
|
|
453
|
+
|
|
454
|
+
def start_optimize(self, id: str) -> CustomLlm:
|
|
455
|
+
"""Start a Custom LLM Optimization Run.
|
|
456
|
+
|
|
457
|
+
:param id: str
|
|
458
|
+
The Id of the tile.
|
|
459
|
+
|
|
460
|
+
:returns: :class:`CustomLlm`
|
|
461
|
+
"""
|
|
462
|
+
|
|
463
|
+
headers = {
|
|
464
|
+
"Accept": "application/json",
|
|
465
|
+
"Content-Type": "application/json",
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
res = self._api.do("POST", f"/api/2.0/custom-llms/{id}/optimize", headers=headers)
|
|
469
|
+
return CustomLlm.from_dict(res)
|
|
470
|
+
|
|
471
|
+
def update_custom_llm(self, id: str, custom_llm: CustomLlm, update_mask: str) -> CustomLlm:
|
|
472
|
+
"""Update a Custom LLM.
|
|
473
|
+
|
|
474
|
+
:param id: str
|
|
475
|
+
The id of the custom llm
|
|
476
|
+
:param custom_llm: :class:`CustomLlm`
|
|
477
|
+
The CustomLlm containing the fields which should be updated.
|
|
478
|
+
:param update_mask: str
|
|
479
|
+
The list of the CustomLlm fields to update. These should correspond to the values (or lack thereof)
|
|
480
|
+
present in `custom_llm`.
|
|
481
|
+
|
|
482
|
+
The field mask must be a single string, with multiple fields separated by commas (no spaces). The
|
|
483
|
+
field path is relative to the resource object, using a dot (`.`) to navigate sub-fields (e.g.,
|
|
484
|
+
`author.given_name`). Specification of elements in sequence or map fields is not allowed, as only
|
|
485
|
+
the entire collection field can be specified. Field names must exactly match the resource field
|
|
486
|
+
names.
|
|
487
|
+
|
|
488
|
+
A field mask of `*` indicates full replacement. It’s recommended to always explicitly list the
|
|
489
|
+
fields being updated and avoid using `*` wildcards, as it can lead to unintended results if the API
|
|
490
|
+
changes in the future.
|
|
491
|
+
|
|
492
|
+
:returns: :class:`CustomLlm`
|
|
493
|
+
"""
|
|
494
|
+
body = {}
|
|
495
|
+
if custom_llm is not None:
|
|
496
|
+
body["custom_llm"] = custom_llm.as_dict()
|
|
497
|
+
if update_mask is not None:
|
|
498
|
+
body["update_mask"] = update_mask
|
|
499
|
+
headers = {
|
|
500
|
+
"Accept": "application/json",
|
|
501
|
+
"Content-Type": "application/json",
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
res = self._api.do("PATCH", f"/api/2.0/custom-llms/{id}", body=body, headers=headers)
|
|
505
|
+
return CustomLlm.from_dict(res)
|
databricks/sdk/service/apps.py
CHANGED
|
@@ -1232,9 +1232,7 @@ class AppsAPI:
|
|
|
1232
1232
|
raise TimeoutError(f"timed out after {timeout}: {status_message}")
|
|
1233
1233
|
|
|
1234
1234
|
def create(self, app: App, *, no_compute: Optional[bool] = None) -> Wait[App]:
|
|
1235
|
-
"""
|
|
1236
|
-
|
|
1237
|
-
Creates a new app.
|
|
1235
|
+
"""Creates a new app.
|
|
1238
1236
|
|
|
1239
1237
|
:param app: :class:`App`
|
|
1240
1238
|
:param no_compute: bool (optional)
|
|
@@ -1260,9 +1258,7 @@ class AppsAPI:
|
|
|
1260
1258
|
return self.create(app=app, no_compute=no_compute).result(timeout=timeout)
|
|
1261
1259
|
|
|
1262
1260
|
def delete(self, name: str) -> App:
|
|
1263
|
-
"""
|
|
1264
|
-
|
|
1265
|
-
Deletes an app.
|
|
1261
|
+
"""Deletes an app.
|
|
1266
1262
|
|
|
1267
1263
|
:param name: str
|
|
1268
1264
|
The name of the app.
|
|
@@ -1278,9 +1274,7 @@ class AppsAPI:
|
|
|
1278
1274
|
return App.from_dict(res)
|
|
1279
1275
|
|
|
1280
1276
|
def deploy(self, app_name: str, app_deployment: AppDeployment) -> Wait[AppDeployment]:
|
|
1281
|
-
"""
|
|
1282
|
-
|
|
1283
|
-
Creates an app deployment for the app with the supplied name.
|
|
1277
|
+
"""Creates an app deployment for the app with the supplied name.
|
|
1284
1278
|
|
|
1285
1279
|
:param app_name: str
|
|
1286
1280
|
The name of the app.
|
|
@@ -1310,9 +1304,7 @@ class AppsAPI:
|
|
|
1310
1304
|
return self.deploy(app_deployment=app_deployment, app_name=app_name).result(timeout=timeout)
|
|
1311
1305
|
|
|
1312
1306
|
def get(self, name: str) -> App:
|
|
1313
|
-
"""
|
|
1314
|
-
|
|
1315
|
-
Retrieves information for the app with the supplied name.
|
|
1307
|
+
"""Retrieves information for the app with the supplied name.
|
|
1316
1308
|
|
|
1317
1309
|
:param name: str
|
|
1318
1310
|
The name of the app.
|
|
@@ -1328,9 +1320,7 @@ class AppsAPI:
|
|
|
1328
1320
|
return App.from_dict(res)
|
|
1329
1321
|
|
|
1330
1322
|
def get_deployment(self, app_name: str, deployment_id: str) -> AppDeployment:
|
|
1331
|
-
"""
|
|
1332
|
-
|
|
1333
|
-
Retrieves information for the app deployment with the supplied name and deployment id.
|
|
1323
|
+
"""Retrieves information for the app deployment with the supplied name and deployment id.
|
|
1334
1324
|
|
|
1335
1325
|
:param app_name: str
|
|
1336
1326
|
The name of the app.
|
|
@@ -1348,9 +1338,7 @@ class AppsAPI:
|
|
|
1348
1338
|
return AppDeployment.from_dict(res)
|
|
1349
1339
|
|
|
1350
1340
|
def get_permission_levels(self, app_name: str) -> GetAppPermissionLevelsResponse:
|
|
1351
|
-
"""
|
|
1352
|
-
|
|
1353
|
-
Gets the permission levels that a user can have on an object.
|
|
1341
|
+
"""Gets the permission levels that a user can have on an object.
|
|
1354
1342
|
|
|
1355
1343
|
:param app_name: str
|
|
1356
1344
|
The app for which to get or manage permissions.
|
|
@@ -1366,9 +1354,7 @@ class AppsAPI:
|
|
|
1366
1354
|
return GetAppPermissionLevelsResponse.from_dict(res)
|
|
1367
1355
|
|
|
1368
1356
|
def get_permissions(self, app_name: str) -> AppPermissions:
|
|
1369
|
-
"""
|
|
1370
|
-
|
|
1371
|
-
Gets the permissions of an app. Apps can inherit permissions from their root object.
|
|
1357
|
+
"""Gets the permissions of an app. Apps can inherit permissions from their root object.
|
|
1372
1358
|
|
|
1373
1359
|
:param app_name: str
|
|
1374
1360
|
The app for which to get or manage permissions.
|
|
@@ -1384,9 +1370,7 @@ class AppsAPI:
|
|
|
1384
1370
|
return AppPermissions.from_dict(res)
|
|
1385
1371
|
|
|
1386
1372
|
def list(self, *, page_size: Optional[int] = None, page_token: Optional[str] = None) -> Iterator[App]:
|
|
1387
|
-
"""
|
|
1388
|
-
|
|
1389
|
-
Lists all apps in the workspace.
|
|
1373
|
+
"""Lists all apps in the workspace.
|
|
1390
1374
|
|
|
1391
1375
|
:param page_size: int (optional)
|
|
1392
1376
|
Upper bound for items returned.
|
|
@@ -1417,9 +1401,7 @@ class AppsAPI:
|
|
|
1417
1401
|
def list_deployments(
|
|
1418
1402
|
self, app_name: str, *, page_size: Optional[int] = None, page_token: Optional[str] = None
|
|
1419
1403
|
) -> Iterator[AppDeployment]:
|
|
1420
|
-
"""
|
|
1421
|
-
|
|
1422
|
-
Lists all app deployments for the app with the supplied name.
|
|
1404
|
+
"""Lists all app deployments for the app with the supplied name.
|
|
1423
1405
|
|
|
1424
1406
|
:param app_name: str
|
|
1425
1407
|
The name of the app.
|
|
@@ -1452,9 +1434,7 @@ class AppsAPI:
|
|
|
1452
1434
|
def set_permissions(
|
|
1453
1435
|
self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None
|
|
1454
1436
|
) -> AppPermissions:
|
|
1455
|
-
"""
|
|
1456
|
-
|
|
1457
|
-
Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
|
|
1437
|
+
"""Sets permissions on an object, replacing existing permissions if they exist. Deletes all direct
|
|
1458
1438
|
permissions if none are specified. Objects can inherit permissions from their root object.
|
|
1459
1439
|
|
|
1460
1440
|
:param app_name: str
|
|
@@ -1475,9 +1455,7 @@ class AppsAPI:
|
|
|
1475
1455
|
return AppPermissions.from_dict(res)
|
|
1476
1456
|
|
|
1477
1457
|
def start(self, name: str) -> Wait[App]:
|
|
1478
|
-
"""Start
|
|
1479
|
-
|
|
1480
|
-
Start the last active deployment of the app in the workspace.
|
|
1458
|
+
"""Start the last active deployment of the app in the workspace.
|
|
1481
1459
|
|
|
1482
1460
|
:param name: str
|
|
1483
1461
|
The name of the app.
|
|
@@ -1499,9 +1477,7 @@ class AppsAPI:
|
|
|
1499
1477
|
return self.start(name=name).result(timeout=timeout)
|
|
1500
1478
|
|
|
1501
1479
|
def stop(self, name: str) -> Wait[App]:
|
|
1502
|
-
"""
|
|
1503
|
-
|
|
1504
|
-
Stops the active deployment of the app in the workspace.
|
|
1480
|
+
"""Stops the active deployment of the app in the workspace.
|
|
1505
1481
|
|
|
1506
1482
|
:param name: str
|
|
1507
1483
|
The name of the app.
|
|
@@ -1523,9 +1499,7 @@ class AppsAPI:
|
|
|
1523
1499
|
return self.stop(name=name).result(timeout=timeout)
|
|
1524
1500
|
|
|
1525
1501
|
def update(self, name: str, app: App) -> App:
|
|
1526
|
-
"""
|
|
1527
|
-
|
|
1528
|
-
Updates the app with the supplied name.
|
|
1502
|
+
"""Updates the app with the supplied name.
|
|
1529
1503
|
|
|
1530
1504
|
:param name: str
|
|
1531
1505
|
The name of the app. The name must contain only lowercase alphanumeric characters and hyphens. It
|
|
@@ -1546,9 +1520,7 @@ class AppsAPI:
|
|
|
1546
1520
|
def update_permissions(
|
|
1547
1521
|
self, app_name: str, *, access_control_list: Optional[List[AppAccessControlRequest]] = None
|
|
1548
1522
|
) -> AppPermissions:
|
|
1549
|
-
"""
|
|
1550
|
-
|
|
1551
|
-
Updates the permissions on an app. Apps can inherit permissions from their root object.
|
|
1523
|
+
"""Updates the permissions on an app. Apps can inherit permissions from their root object.
|
|
1552
1524
|
|
|
1553
1525
|
:param app_name: str
|
|
1554
1526
|
The app for which to get or manage permissions.
|