databricks-sdk 0.32.3__py3-none-any.whl → 0.34.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 +10 -0
- databricks/sdk/_base_client.py +323 -0
- databricks/sdk/core.py +25 -292
- databricks/sdk/mixins/files.py +9 -9
- databricks/sdk/service/apps.py +366 -113
- databricks/sdk/service/catalog.py +269 -7
- databricks/sdk/service/compute.py +68 -18
- databricks/sdk/service/dashboards.py +34 -11
- databricks/sdk/service/jobs.py +104 -86
- databricks/sdk/service/pipelines.py +58 -1
- databricks/sdk/service/serving.py +326 -10
- databricks/sdk/service/settings.py +573 -1
- databricks/sdk/service/sharing.py +1 -1
- databricks/sdk/service/sql.py +10 -246
- databricks/sdk/service/workspace.py +268 -107
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/METADATA +1 -1
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/RECORD +22 -21
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/LICENSE +0 -0
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/NOTICE +0 -0
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/WHEEL +0 -0
- {databricks_sdk-0.32.3.dist-info → databricks_sdk-0.34.0.dist-info}/top_level.txt +0 -0
|
@@ -50,6 +50,222 @@ class Ai21LabsConfig:
|
|
|
50
50
|
ai21labs_api_key_plaintext=d.get('ai21labs_api_key_plaintext', None))
|
|
51
51
|
|
|
52
52
|
|
|
53
|
+
@dataclass
|
|
54
|
+
class AiGatewayConfig:
|
|
55
|
+
guardrails: Optional[AiGatewayGuardrails] = None
|
|
56
|
+
"""Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
|
|
57
|
+
responses."""
|
|
58
|
+
|
|
59
|
+
inference_table_config: Optional[AiGatewayInferenceTableConfig] = None
|
|
60
|
+
"""Configuration for payload logging using inference tables. Use these tables to monitor and audit
|
|
61
|
+
data being sent to and received from model APIs and to improve model quality."""
|
|
62
|
+
|
|
63
|
+
rate_limits: Optional[List[AiGatewayRateLimit]] = None
|
|
64
|
+
"""Configuration for rate limits which can be set to limit endpoint traffic."""
|
|
65
|
+
|
|
66
|
+
usage_tracking_config: Optional[AiGatewayUsageTrackingConfig] = None
|
|
67
|
+
"""Configuration to enable usage tracking using system tables. These tables allow you to monitor
|
|
68
|
+
operational usage on endpoints and their associated costs."""
|
|
69
|
+
|
|
70
|
+
def as_dict(self) -> dict:
|
|
71
|
+
"""Serializes the AiGatewayConfig into a dictionary suitable for use as a JSON request body."""
|
|
72
|
+
body = {}
|
|
73
|
+
if self.guardrails: body['guardrails'] = self.guardrails.as_dict()
|
|
74
|
+
if self.inference_table_config: body['inference_table_config'] = self.inference_table_config.as_dict()
|
|
75
|
+
if self.rate_limits: body['rate_limits'] = [v.as_dict() for v in self.rate_limits]
|
|
76
|
+
if self.usage_tracking_config: body['usage_tracking_config'] = self.usage_tracking_config.as_dict()
|
|
77
|
+
return body
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayConfig:
|
|
81
|
+
"""Deserializes the AiGatewayConfig from a dictionary."""
|
|
82
|
+
return cls(guardrails=_from_dict(d, 'guardrails', AiGatewayGuardrails),
|
|
83
|
+
inference_table_config=_from_dict(d, 'inference_table_config',
|
|
84
|
+
AiGatewayInferenceTableConfig),
|
|
85
|
+
rate_limits=_repeated_dict(d, 'rate_limits', AiGatewayRateLimit),
|
|
86
|
+
usage_tracking_config=_from_dict(d, 'usage_tracking_config', AiGatewayUsageTrackingConfig))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass
|
|
90
|
+
class AiGatewayGuardrailParameters:
|
|
91
|
+
invalid_keywords: Optional[List[str]] = None
|
|
92
|
+
"""List of invalid keywords. AI guardrail uses keyword or string matching to decide if the keyword
|
|
93
|
+
exists in the request or response content."""
|
|
94
|
+
|
|
95
|
+
pii: Optional[AiGatewayGuardrailPiiBehavior] = None
|
|
96
|
+
"""Configuration for guardrail PII filter."""
|
|
97
|
+
|
|
98
|
+
safety: Optional[bool] = None
|
|
99
|
+
"""Indicates whether the safety filter is enabled."""
|
|
100
|
+
|
|
101
|
+
valid_topics: Optional[List[str]] = None
|
|
102
|
+
"""The list of allowed topics. Given a chat request, this guardrail flags the request if its topic
|
|
103
|
+
is not in the allowed topics."""
|
|
104
|
+
|
|
105
|
+
def as_dict(self) -> dict:
|
|
106
|
+
"""Serializes the AiGatewayGuardrailParameters into a dictionary suitable for use as a JSON request body."""
|
|
107
|
+
body = {}
|
|
108
|
+
if self.invalid_keywords: body['invalid_keywords'] = [v for v in self.invalid_keywords]
|
|
109
|
+
if self.pii: body['pii'] = self.pii.as_dict()
|
|
110
|
+
if self.safety is not None: body['safety'] = self.safety
|
|
111
|
+
if self.valid_topics: body['valid_topics'] = [v for v in self.valid_topics]
|
|
112
|
+
return body
|
|
113
|
+
|
|
114
|
+
@classmethod
|
|
115
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayGuardrailParameters:
|
|
116
|
+
"""Deserializes the AiGatewayGuardrailParameters from a dictionary."""
|
|
117
|
+
return cls(invalid_keywords=d.get('invalid_keywords', None),
|
|
118
|
+
pii=_from_dict(d, 'pii', AiGatewayGuardrailPiiBehavior),
|
|
119
|
+
safety=d.get('safety', None),
|
|
120
|
+
valid_topics=d.get('valid_topics', None))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class AiGatewayGuardrailPiiBehavior:
|
|
125
|
+
behavior: AiGatewayGuardrailPiiBehaviorBehavior
|
|
126
|
+
"""Behavior for PII filter. Currently only 'BLOCK' is supported. If 'BLOCK' is set for the input
|
|
127
|
+
guardrail and the request contains PII, the request is not sent to the model server and 400
|
|
128
|
+
status code is returned; if 'BLOCK' is set for the output guardrail and the model response
|
|
129
|
+
contains PII, the PII info in the response is redacted and 400 status code is returned."""
|
|
130
|
+
|
|
131
|
+
def as_dict(self) -> dict:
|
|
132
|
+
"""Serializes the AiGatewayGuardrailPiiBehavior into a dictionary suitable for use as a JSON request body."""
|
|
133
|
+
body = {}
|
|
134
|
+
if self.behavior is not None: body['behavior'] = self.behavior.value
|
|
135
|
+
return body
|
|
136
|
+
|
|
137
|
+
@classmethod
|
|
138
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayGuardrailPiiBehavior:
|
|
139
|
+
"""Deserializes the AiGatewayGuardrailPiiBehavior from a dictionary."""
|
|
140
|
+
return cls(behavior=_enum(d, 'behavior', AiGatewayGuardrailPiiBehaviorBehavior))
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
class AiGatewayGuardrailPiiBehaviorBehavior(Enum):
|
|
144
|
+
"""Behavior for PII filter. Currently only 'BLOCK' is supported. If 'BLOCK' is set for the input
|
|
145
|
+
guardrail and the request contains PII, the request is not sent to the model server and 400
|
|
146
|
+
status code is returned; if 'BLOCK' is set for the output guardrail and the model response
|
|
147
|
+
contains PII, the PII info in the response is redacted and 400 status code is returned."""
|
|
148
|
+
|
|
149
|
+
BLOCK = 'BLOCK'
|
|
150
|
+
NONE = 'NONE'
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
@dataclass
|
|
154
|
+
class AiGatewayGuardrails:
|
|
155
|
+
input: Optional[AiGatewayGuardrailParameters] = None
|
|
156
|
+
"""Configuration for input guardrail filters."""
|
|
157
|
+
|
|
158
|
+
output: Optional[AiGatewayGuardrailParameters] = None
|
|
159
|
+
"""Configuration for output guardrail filters."""
|
|
160
|
+
|
|
161
|
+
def as_dict(self) -> dict:
|
|
162
|
+
"""Serializes the AiGatewayGuardrails into a dictionary suitable for use as a JSON request body."""
|
|
163
|
+
body = {}
|
|
164
|
+
if self.input: body['input'] = self.input.as_dict()
|
|
165
|
+
if self.output: body['output'] = self.output.as_dict()
|
|
166
|
+
return body
|
|
167
|
+
|
|
168
|
+
@classmethod
|
|
169
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayGuardrails:
|
|
170
|
+
"""Deserializes the AiGatewayGuardrails from a dictionary."""
|
|
171
|
+
return cls(input=_from_dict(d, 'input', AiGatewayGuardrailParameters),
|
|
172
|
+
output=_from_dict(d, 'output', AiGatewayGuardrailParameters))
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
@dataclass
|
|
176
|
+
class AiGatewayInferenceTableConfig:
|
|
177
|
+
catalog_name: Optional[str] = None
|
|
178
|
+
"""The name of the catalog in Unity Catalog. Required when enabling inference tables. NOTE: On
|
|
179
|
+
update, you have to disable inference table first in order to change the catalog name."""
|
|
180
|
+
|
|
181
|
+
enabled: Optional[bool] = None
|
|
182
|
+
"""Indicates whether the inference table is enabled."""
|
|
183
|
+
|
|
184
|
+
schema_name: Optional[str] = None
|
|
185
|
+
"""The name of the schema in Unity Catalog. Required when enabling inference tables. NOTE: On
|
|
186
|
+
update, you have to disable inference table first in order to change the schema name."""
|
|
187
|
+
|
|
188
|
+
table_name_prefix: Optional[str] = None
|
|
189
|
+
"""The prefix of the table in Unity Catalog. NOTE: On update, you have to disable inference table
|
|
190
|
+
first in order to change the prefix name."""
|
|
191
|
+
|
|
192
|
+
def as_dict(self) -> dict:
|
|
193
|
+
"""Serializes the AiGatewayInferenceTableConfig into a dictionary suitable for use as a JSON request body."""
|
|
194
|
+
body = {}
|
|
195
|
+
if self.catalog_name is not None: body['catalog_name'] = self.catalog_name
|
|
196
|
+
if self.enabled is not None: body['enabled'] = self.enabled
|
|
197
|
+
if self.schema_name is not None: body['schema_name'] = self.schema_name
|
|
198
|
+
if self.table_name_prefix is not None: body['table_name_prefix'] = self.table_name_prefix
|
|
199
|
+
return body
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayInferenceTableConfig:
|
|
203
|
+
"""Deserializes the AiGatewayInferenceTableConfig from a dictionary."""
|
|
204
|
+
return cls(catalog_name=d.get('catalog_name', None),
|
|
205
|
+
enabled=d.get('enabled', None),
|
|
206
|
+
schema_name=d.get('schema_name', None),
|
|
207
|
+
table_name_prefix=d.get('table_name_prefix', None))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
@dataclass
|
|
211
|
+
class AiGatewayRateLimit:
|
|
212
|
+
calls: int
|
|
213
|
+
"""Used to specify how many calls are allowed for a key within the renewal_period."""
|
|
214
|
+
|
|
215
|
+
renewal_period: AiGatewayRateLimitRenewalPeriod
|
|
216
|
+
"""Renewal period field for a rate limit. Currently, only 'minute' is supported."""
|
|
217
|
+
|
|
218
|
+
key: Optional[AiGatewayRateLimitKey] = None
|
|
219
|
+
"""Key field for a rate limit. Currently, only 'user' and 'endpoint' are supported, with 'endpoint'
|
|
220
|
+
being the default if not specified."""
|
|
221
|
+
|
|
222
|
+
def as_dict(self) -> dict:
|
|
223
|
+
"""Serializes the AiGatewayRateLimit into a dictionary suitable for use as a JSON request body."""
|
|
224
|
+
body = {}
|
|
225
|
+
if self.calls is not None: body['calls'] = self.calls
|
|
226
|
+
if self.key is not None: body['key'] = self.key.value
|
|
227
|
+
if self.renewal_period is not None: body['renewal_period'] = self.renewal_period.value
|
|
228
|
+
return body
|
|
229
|
+
|
|
230
|
+
@classmethod
|
|
231
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayRateLimit:
|
|
232
|
+
"""Deserializes the AiGatewayRateLimit from a dictionary."""
|
|
233
|
+
return cls(calls=d.get('calls', None),
|
|
234
|
+
key=_enum(d, 'key', AiGatewayRateLimitKey),
|
|
235
|
+
renewal_period=_enum(d, 'renewal_period', AiGatewayRateLimitRenewalPeriod))
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
class AiGatewayRateLimitKey(Enum):
|
|
239
|
+
"""Key field for a rate limit. Currently, only 'user' and 'endpoint' are supported, with 'endpoint'
|
|
240
|
+
being the default if not specified."""
|
|
241
|
+
|
|
242
|
+
ENDPOINT = 'endpoint'
|
|
243
|
+
USER = 'user'
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
class AiGatewayRateLimitRenewalPeriod(Enum):
|
|
247
|
+
"""Renewal period field for a rate limit. Currently, only 'minute' is supported."""
|
|
248
|
+
|
|
249
|
+
MINUTE = 'minute'
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
@dataclass
|
|
253
|
+
class AiGatewayUsageTrackingConfig:
|
|
254
|
+
enabled: Optional[bool] = None
|
|
255
|
+
"""Whether to enable usage tracking."""
|
|
256
|
+
|
|
257
|
+
def as_dict(self) -> dict:
|
|
258
|
+
"""Serializes the AiGatewayUsageTrackingConfig into a dictionary suitable for use as a JSON request body."""
|
|
259
|
+
body = {}
|
|
260
|
+
if self.enabled is not None: body['enabled'] = self.enabled
|
|
261
|
+
return body
|
|
262
|
+
|
|
263
|
+
@classmethod
|
|
264
|
+
def from_dict(cls, d: Dict[str, any]) -> AiGatewayUsageTrackingConfig:
|
|
265
|
+
"""Deserializes the AiGatewayUsageTrackingConfig from a dictionary."""
|
|
266
|
+
return cls(enabled=d.get('enabled', None))
|
|
267
|
+
|
|
268
|
+
|
|
53
269
|
@dataclass
|
|
54
270
|
class AmazonBedrockConfig:
|
|
55
271
|
aws_region: str
|
|
@@ -319,9 +535,13 @@ class CreateServingEndpoint:
|
|
|
319
535
|
config: EndpointCoreConfigInput
|
|
320
536
|
"""The core config of the serving endpoint."""
|
|
321
537
|
|
|
538
|
+
ai_gateway: Optional[AiGatewayConfig] = None
|
|
539
|
+
"""The AI Gateway configuration for the serving endpoint. NOTE: only external model endpoints are
|
|
540
|
+
supported as of now."""
|
|
541
|
+
|
|
322
542
|
rate_limits: Optional[List[RateLimit]] = None
|
|
323
|
-
"""Rate limits to be applied to the serving endpoint. NOTE:
|
|
324
|
-
|
|
543
|
+
"""Rate limits to be applied to the serving endpoint. NOTE: this field is deprecated, please use AI
|
|
544
|
+
Gateway to manage rate limits."""
|
|
325
545
|
|
|
326
546
|
route_optimized: Optional[bool] = None
|
|
327
547
|
"""Enable route optimization for the serving endpoint."""
|
|
@@ -332,6 +552,7 @@ class CreateServingEndpoint:
|
|
|
332
552
|
def as_dict(self) -> dict:
|
|
333
553
|
"""Serializes the CreateServingEndpoint into a dictionary suitable for use as a JSON request body."""
|
|
334
554
|
body = {}
|
|
555
|
+
if self.ai_gateway: body['ai_gateway'] = self.ai_gateway.as_dict()
|
|
335
556
|
if self.config: body['config'] = self.config.as_dict()
|
|
336
557
|
if self.name is not None: body['name'] = self.name
|
|
337
558
|
if self.rate_limits: body['rate_limits'] = [v.as_dict() for v in self.rate_limits]
|
|
@@ -342,7 +563,8 @@ class CreateServingEndpoint:
|
|
|
342
563
|
@classmethod
|
|
343
564
|
def from_dict(cls, d: Dict[str, any]) -> CreateServingEndpoint:
|
|
344
565
|
"""Deserializes the CreateServingEndpoint from a dictionary."""
|
|
345
|
-
return cls(
|
|
566
|
+
return cls(ai_gateway=_from_dict(d, 'ai_gateway', AiGatewayConfig),
|
|
567
|
+
config=_from_dict(d, 'config', EndpointCoreConfigInput),
|
|
346
568
|
name=d.get('name', None),
|
|
347
569
|
rate_limits=_repeated_dict(d, 'rate_limits', RateLimit),
|
|
348
570
|
route_optimized=d.get('route_optimized', None),
|
|
@@ -1119,6 +1341,42 @@ class PayloadTable:
|
|
|
1119
1341
|
status_message=d.get('status_message', None))
|
|
1120
1342
|
|
|
1121
1343
|
|
|
1344
|
+
@dataclass
|
|
1345
|
+
class PutAiGatewayResponse:
|
|
1346
|
+
guardrails: Optional[AiGatewayGuardrails] = None
|
|
1347
|
+
"""Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
|
|
1348
|
+
responses."""
|
|
1349
|
+
|
|
1350
|
+
inference_table_config: Optional[AiGatewayInferenceTableConfig] = None
|
|
1351
|
+
"""Configuration for payload logging using inference tables. Use these tables to monitor and audit
|
|
1352
|
+
data being sent to and received from model APIs and to improve model quality ."""
|
|
1353
|
+
|
|
1354
|
+
rate_limits: Optional[List[AiGatewayRateLimit]] = None
|
|
1355
|
+
"""Configuration for rate limits which can be set to limit endpoint traffic."""
|
|
1356
|
+
|
|
1357
|
+
usage_tracking_config: Optional[AiGatewayUsageTrackingConfig] = None
|
|
1358
|
+
"""Configuration to enable usage tracking using system tables. These tables allow you to monitor
|
|
1359
|
+
operational usage on endpoints and their associated costs."""
|
|
1360
|
+
|
|
1361
|
+
def as_dict(self) -> dict:
|
|
1362
|
+
"""Serializes the PutAiGatewayResponse into a dictionary suitable for use as a JSON request body."""
|
|
1363
|
+
body = {}
|
|
1364
|
+
if self.guardrails: body['guardrails'] = self.guardrails.as_dict()
|
|
1365
|
+
if self.inference_table_config: body['inference_table_config'] = self.inference_table_config.as_dict()
|
|
1366
|
+
if self.rate_limits: body['rate_limits'] = [v.as_dict() for v in self.rate_limits]
|
|
1367
|
+
if self.usage_tracking_config: body['usage_tracking_config'] = self.usage_tracking_config.as_dict()
|
|
1368
|
+
return body
|
|
1369
|
+
|
|
1370
|
+
@classmethod
|
|
1371
|
+
def from_dict(cls, d: Dict[str, any]) -> PutAiGatewayResponse:
|
|
1372
|
+
"""Deserializes the PutAiGatewayResponse from a dictionary."""
|
|
1373
|
+
return cls(guardrails=_from_dict(d, 'guardrails', AiGatewayGuardrails),
|
|
1374
|
+
inference_table_config=_from_dict(d, 'inference_table_config',
|
|
1375
|
+
AiGatewayInferenceTableConfig),
|
|
1376
|
+
rate_limits=_repeated_dict(d, 'rate_limits', AiGatewayRateLimit),
|
|
1377
|
+
usage_tracking_config=_from_dict(d, 'usage_tracking_config', AiGatewayUsageTrackingConfig))
|
|
1378
|
+
|
|
1379
|
+
|
|
1122
1380
|
@dataclass
|
|
1123
1381
|
class PutResponse:
|
|
1124
1382
|
rate_limits: Optional[List[RateLimit]] = None
|
|
@@ -1905,6 +2163,10 @@ class ServerLogsResponse:
|
|
|
1905
2163
|
|
|
1906
2164
|
@dataclass
|
|
1907
2165
|
class ServingEndpoint:
|
|
2166
|
+
ai_gateway: Optional[AiGatewayConfig] = None
|
|
2167
|
+
"""The AI Gateway configuration for the serving endpoint. NOTE: Only external model endpoints are
|
|
2168
|
+
currently supported."""
|
|
2169
|
+
|
|
1908
2170
|
config: Optional[EndpointCoreConfigSummary] = None
|
|
1909
2171
|
"""The config that is currently being served by the endpoint."""
|
|
1910
2172
|
|
|
@@ -1936,6 +2198,7 @@ class ServingEndpoint:
|
|
|
1936
2198
|
def as_dict(self) -> dict:
|
|
1937
2199
|
"""Serializes the ServingEndpoint into a dictionary suitable for use as a JSON request body."""
|
|
1938
2200
|
body = {}
|
|
2201
|
+
if self.ai_gateway: body['ai_gateway'] = self.ai_gateway.as_dict()
|
|
1939
2202
|
if self.config: body['config'] = self.config.as_dict()
|
|
1940
2203
|
if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp
|
|
1941
2204
|
if self.creator is not None: body['creator'] = self.creator
|
|
@@ -1951,7 +2214,8 @@ class ServingEndpoint:
|
|
|
1951
2214
|
@classmethod
|
|
1952
2215
|
def from_dict(cls, d: Dict[str, any]) -> ServingEndpoint:
|
|
1953
2216
|
"""Deserializes the ServingEndpoint from a dictionary."""
|
|
1954
|
-
return cls(
|
|
2217
|
+
return cls(ai_gateway=_from_dict(d, 'ai_gateway', AiGatewayConfig),
|
|
2218
|
+
config=_from_dict(d, 'config', EndpointCoreConfigSummary),
|
|
1955
2219
|
creation_timestamp=d.get('creation_timestamp', None),
|
|
1956
2220
|
creator=d.get('creator', None),
|
|
1957
2221
|
id=d.get('id', None),
|
|
@@ -2035,6 +2299,10 @@ class ServingEndpointAccessControlResponse:
|
|
|
2035
2299
|
|
|
2036
2300
|
@dataclass
|
|
2037
2301
|
class ServingEndpointDetailed:
|
|
2302
|
+
ai_gateway: Optional[AiGatewayConfig] = None
|
|
2303
|
+
"""The AI Gateway configuration for the serving endpoint. NOTE: Only external model endpoints are
|
|
2304
|
+
currently supported."""
|
|
2305
|
+
|
|
2038
2306
|
config: Optional[EndpointCoreConfigOutput] = None
|
|
2039
2307
|
"""The config that is currently being served by the endpoint."""
|
|
2040
2308
|
|
|
@@ -2081,6 +2349,7 @@ class ServingEndpointDetailed:
|
|
|
2081
2349
|
def as_dict(self) -> dict:
|
|
2082
2350
|
"""Serializes the ServingEndpointDetailed into a dictionary suitable for use as a JSON request body."""
|
|
2083
2351
|
body = {}
|
|
2352
|
+
if self.ai_gateway: body['ai_gateway'] = self.ai_gateway.as_dict()
|
|
2084
2353
|
if self.config: body['config'] = self.config.as_dict()
|
|
2085
2354
|
if self.creation_timestamp is not None: body['creation_timestamp'] = self.creation_timestamp
|
|
2086
2355
|
if self.creator is not None: body['creator'] = self.creator
|
|
@@ -2101,7 +2370,8 @@ class ServingEndpointDetailed:
|
|
|
2101
2370
|
@classmethod
|
|
2102
2371
|
def from_dict(cls, d: Dict[str, any]) -> ServingEndpointDetailed:
|
|
2103
2372
|
"""Deserializes the ServingEndpointDetailed from a dictionary."""
|
|
2104
|
-
return cls(
|
|
2373
|
+
return cls(ai_gateway=_from_dict(d, 'ai_gateway', AiGatewayConfig),
|
|
2374
|
+
config=_from_dict(d, 'config', EndpointCoreConfigOutput),
|
|
2105
2375
|
creation_timestamp=d.get('creation_timestamp', None),
|
|
2106
2376
|
creator=d.get('creator', None),
|
|
2107
2377
|
data_plane_info=_from_dict(d, 'data_plane_info', ModelDataPlaneInfo),
|
|
@@ -2353,6 +2623,7 @@ class ServingEndpointsAPI:
|
|
|
2353
2623
|
name: str,
|
|
2354
2624
|
config: EndpointCoreConfigInput,
|
|
2355
2625
|
*,
|
|
2626
|
+
ai_gateway: Optional[AiGatewayConfig] = None,
|
|
2356
2627
|
rate_limits: Optional[List[RateLimit]] = None,
|
|
2357
2628
|
route_optimized: Optional[bool] = None,
|
|
2358
2629
|
tags: Optional[List[EndpointTag]] = None) -> Wait[ServingEndpointDetailed]:
|
|
@@ -2363,9 +2634,12 @@ class ServingEndpointsAPI:
|
|
|
2363
2634
|
workspace. An endpoint name can consist of alphanumeric characters, dashes, and underscores.
|
|
2364
2635
|
:param config: :class:`EndpointCoreConfigInput`
|
|
2365
2636
|
The core config of the serving endpoint.
|
|
2637
|
+
:param ai_gateway: :class:`AiGatewayConfig` (optional)
|
|
2638
|
+
The AI Gateway configuration for the serving endpoint. NOTE: only external model endpoints are
|
|
2639
|
+
supported as of now.
|
|
2366
2640
|
:param rate_limits: List[:class:`RateLimit`] (optional)
|
|
2367
|
-
Rate limits to be applied to the serving endpoint. NOTE:
|
|
2368
|
-
|
|
2641
|
+
Rate limits to be applied to the serving endpoint. NOTE: this field is deprecated, please use AI
|
|
2642
|
+
Gateway to manage rate limits.
|
|
2369
2643
|
:param route_optimized: bool (optional)
|
|
2370
2644
|
Enable route optimization for the serving endpoint.
|
|
2371
2645
|
:param tags: List[:class:`EndpointTag`] (optional)
|
|
@@ -2376,6 +2650,7 @@ class ServingEndpointsAPI:
|
|
|
2376
2650
|
See :method:wait_get_serving_endpoint_not_updating for more details.
|
|
2377
2651
|
"""
|
|
2378
2652
|
body = {}
|
|
2653
|
+
if ai_gateway is not None: body['ai_gateway'] = ai_gateway.as_dict()
|
|
2379
2654
|
if config is not None: body['config'] = config.as_dict()
|
|
2380
2655
|
if name is not None: body['name'] = name
|
|
2381
2656
|
if rate_limits is not None: body['rate_limits'] = [v.as_dict() for v in rate_limits]
|
|
@@ -2393,11 +2668,13 @@ class ServingEndpointsAPI:
|
|
|
2393
2668
|
name: str,
|
|
2394
2669
|
config: EndpointCoreConfigInput,
|
|
2395
2670
|
*,
|
|
2671
|
+
ai_gateway: Optional[AiGatewayConfig] = None,
|
|
2396
2672
|
rate_limits: Optional[List[RateLimit]] = None,
|
|
2397
2673
|
route_optimized: Optional[bool] = None,
|
|
2398
2674
|
tags: Optional[List[EndpointTag]] = None,
|
|
2399
2675
|
timeout=timedelta(minutes=20)) -> ServingEndpointDetailed:
|
|
2400
|
-
return self.create(
|
|
2676
|
+
return self.create(ai_gateway=ai_gateway,
|
|
2677
|
+
config=config,
|
|
2401
2678
|
name=name,
|
|
2402
2679
|
rate_limits=rate_limits,
|
|
2403
2680
|
route_optimized=route_optimized,
|
|
@@ -2563,8 +2840,8 @@ class ServingEndpointsAPI:
|
|
|
2563
2840
|
def put(self, name: str, *, rate_limits: Optional[List[RateLimit]] = None) -> PutResponse:
|
|
2564
2841
|
"""Update rate limits of a serving endpoint.
|
|
2565
2842
|
|
|
2566
|
-
Used to update the rate limits of a serving endpoint. NOTE:
|
|
2567
|
-
|
|
2843
|
+
Used to update the rate limits of a serving endpoint. NOTE: Only foundation model endpoints are
|
|
2844
|
+
currently supported. For external models, use AI Gateway to manage rate limits.
|
|
2568
2845
|
|
|
2569
2846
|
:param name: str
|
|
2570
2847
|
The name of the serving endpoint whose rate limits are being updated. This field is required.
|
|
@@ -2583,6 +2860,45 @@ class ServingEndpointsAPI:
|
|
|
2583
2860
|
headers=headers)
|
|
2584
2861
|
return PutResponse.from_dict(res)
|
|
2585
2862
|
|
|
2863
|
+
def put_ai_gateway(
|
|
2864
|
+
self,
|
|
2865
|
+
name: str,
|
|
2866
|
+
*,
|
|
2867
|
+
guardrails: Optional[AiGatewayGuardrails] = None,
|
|
2868
|
+
inference_table_config: Optional[AiGatewayInferenceTableConfig] = None,
|
|
2869
|
+
rate_limits: Optional[List[AiGatewayRateLimit]] = None,
|
|
2870
|
+
usage_tracking_config: Optional[AiGatewayUsageTrackingConfig] = None) -> PutAiGatewayResponse:
|
|
2871
|
+
"""Update AI Gateway of a serving endpoint.
|
|
2872
|
+
|
|
2873
|
+
Used to update the AI Gateway of a serving endpoint. NOTE: Only external model endpoints are currently
|
|
2874
|
+
supported.
|
|
2875
|
+
|
|
2876
|
+
:param name: str
|
|
2877
|
+
The name of the serving endpoint whose AI Gateway is being updated. This field is required.
|
|
2878
|
+
:param guardrails: :class:`AiGatewayGuardrails` (optional)
|
|
2879
|
+
Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and responses.
|
|
2880
|
+
:param inference_table_config: :class:`AiGatewayInferenceTableConfig` (optional)
|
|
2881
|
+
Configuration for payload logging using inference tables. Use these tables to monitor and audit data
|
|
2882
|
+
being sent to and received from model APIs and to improve model quality.
|
|
2883
|
+
:param rate_limits: List[:class:`AiGatewayRateLimit`] (optional)
|
|
2884
|
+
Configuration for rate limits which can be set to limit endpoint traffic.
|
|
2885
|
+
:param usage_tracking_config: :class:`AiGatewayUsageTrackingConfig` (optional)
|
|
2886
|
+
Configuration to enable usage tracking using system tables. These tables allow you to monitor
|
|
2887
|
+
operational usage on endpoints and their associated costs.
|
|
2888
|
+
|
|
2889
|
+
:returns: :class:`PutAiGatewayResponse`
|
|
2890
|
+
"""
|
|
2891
|
+
body = {}
|
|
2892
|
+
if guardrails is not None: body['guardrails'] = guardrails.as_dict()
|
|
2893
|
+
if inference_table_config is not None:
|
|
2894
|
+
body['inference_table_config'] = inference_table_config.as_dict()
|
|
2895
|
+
if rate_limits is not None: body['rate_limits'] = [v.as_dict() for v in rate_limits]
|
|
2896
|
+
if usage_tracking_config is not None: body['usage_tracking_config'] = usage_tracking_config.as_dict()
|
|
2897
|
+
headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
|
|
2898
|
+
|
|
2899
|
+
res = self._api.do('PUT', f'/api/2.0/serving-endpoints/{name}/ai-gateway', body=body, headers=headers)
|
|
2900
|
+
return PutAiGatewayResponse.from_dict(res)
|
|
2901
|
+
|
|
2586
2902
|
def query(self,
|
|
2587
2903
|
name: str,
|
|
2588
2904
|
*,
|