databricks-sdk 0.45.0__py3-none-any.whl → 0.47.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 +13 -2
- databricks/sdk/config.py +4 -0
- databricks/sdk/credentials_provider.py +6 -1
- databricks/sdk/data_plane.py +1 -59
- databricks/sdk/oauth.py +12 -5
- databricks/sdk/service/catalog.py +2 -0
- databricks/sdk/service/compute.py +414 -202
- databricks/sdk/service/dashboards.py +36 -17
- databricks/sdk/service/files.py +4 -0
- databricks/sdk/service/iam.py +12 -29
- databricks/sdk/service/jobs.py +1 -0
- databricks/sdk/service/marketplace.py +2 -0
- databricks/sdk/service/ml.py +451 -2
- databricks/sdk/service/pipelines.py +25 -28
- databricks/sdk/service/serving.py +222 -21
- databricks/sdk/service/sharing.py +71 -71
- databricks/sdk/version.py +1 -1
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info}/METADATA +4 -3
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info}/RECORD +23 -23
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info}/WHEEL +1 -1
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info/licenses}/LICENSE +0 -0
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info/licenses}/NOTICE +0 -0
- {databricks_sdk-0.45.0.dist-info → databricks_sdk-0.47.0.dist-info}/top_level.txt +0 -0
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
import random
|
|
7
|
+
import threading
|
|
7
8
|
import time
|
|
8
9
|
from dataclasses import dataclass
|
|
9
10
|
from datetime import timedelta
|
|
@@ -62,6 +63,10 @@ class Ai21LabsConfig:
|
|
|
62
63
|
|
|
63
64
|
@dataclass
|
|
64
65
|
class AiGatewayConfig:
|
|
66
|
+
fallback_config: Optional[FallbackConfig] = None
|
|
67
|
+
"""Configuration for traffic fallback which auto fallbacks to other served entities if the request
|
|
68
|
+
to a served entity fails with certain error codes, to increase availability."""
|
|
69
|
+
|
|
65
70
|
guardrails: Optional[AiGatewayGuardrails] = None
|
|
66
71
|
"""Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
|
|
67
72
|
responses."""
|
|
@@ -80,6 +85,8 @@ class AiGatewayConfig:
|
|
|
80
85
|
def as_dict(self) -> dict:
|
|
81
86
|
"""Serializes the AiGatewayConfig into a dictionary suitable for use as a JSON request body."""
|
|
82
87
|
body = {}
|
|
88
|
+
if self.fallback_config:
|
|
89
|
+
body["fallback_config"] = self.fallback_config.as_dict()
|
|
83
90
|
if self.guardrails:
|
|
84
91
|
body["guardrails"] = self.guardrails.as_dict()
|
|
85
92
|
if self.inference_table_config:
|
|
@@ -93,6 +100,8 @@ class AiGatewayConfig:
|
|
|
93
100
|
def as_shallow_dict(self) -> dict:
|
|
94
101
|
"""Serializes the AiGatewayConfig into a shallow dictionary of its immediate attributes."""
|
|
95
102
|
body = {}
|
|
103
|
+
if self.fallback_config:
|
|
104
|
+
body["fallback_config"] = self.fallback_config
|
|
96
105
|
if self.guardrails:
|
|
97
106
|
body["guardrails"] = self.guardrails
|
|
98
107
|
if self.inference_table_config:
|
|
@@ -107,6 +116,7 @@ class AiGatewayConfig:
|
|
|
107
116
|
def from_dict(cls, d: Dict[str, Any]) -> AiGatewayConfig:
|
|
108
117
|
"""Deserializes the AiGatewayConfig from a dictionary."""
|
|
109
118
|
return cls(
|
|
119
|
+
fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
|
|
110
120
|
guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
|
|
111
121
|
inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
|
|
112
122
|
rate_limits=_repeated_dict(d, "rate_limits", AiGatewayRateLimit),
|
|
@@ -505,6 +515,47 @@ class AnthropicConfig:
|
|
|
505
515
|
)
|
|
506
516
|
|
|
507
517
|
|
|
518
|
+
@dataclass
|
|
519
|
+
class ApiKeyAuth:
|
|
520
|
+
key: str
|
|
521
|
+
"""The name of the API key parameter used for authentication."""
|
|
522
|
+
|
|
523
|
+
value: Optional[str] = None
|
|
524
|
+
"""The Databricks secret key reference for an API Key. If you prefer to paste your token directly,
|
|
525
|
+
see `value_plaintext`."""
|
|
526
|
+
|
|
527
|
+
value_plaintext: Optional[str] = None
|
|
528
|
+
"""The API Key provided as a plaintext string. If you prefer to reference your token using
|
|
529
|
+
Databricks Secrets, see `value`."""
|
|
530
|
+
|
|
531
|
+
def as_dict(self) -> dict:
|
|
532
|
+
"""Serializes the ApiKeyAuth into a dictionary suitable for use as a JSON request body."""
|
|
533
|
+
body = {}
|
|
534
|
+
if self.key is not None:
|
|
535
|
+
body["key"] = self.key
|
|
536
|
+
if self.value is not None:
|
|
537
|
+
body["value"] = self.value
|
|
538
|
+
if self.value_plaintext is not None:
|
|
539
|
+
body["value_plaintext"] = self.value_plaintext
|
|
540
|
+
return body
|
|
541
|
+
|
|
542
|
+
def as_shallow_dict(self) -> dict:
|
|
543
|
+
"""Serializes the ApiKeyAuth into a shallow dictionary of its immediate attributes."""
|
|
544
|
+
body = {}
|
|
545
|
+
if self.key is not None:
|
|
546
|
+
body["key"] = self.key
|
|
547
|
+
if self.value is not None:
|
|
548
|
+
body["value"] = self.value
|
|
549
|
+
if self.value_plaintext is not None:
|
|
550
|
+
body["value_plaintext"] = self.value_plaintext
|
|
551
|
+
return body
|
|
552
|
+
|
|
553
|
+
@classmethod
|
|
554
|
+
def from_dict(cls, d: Dict[str, Any]) -> ApiKeyAuth:
|
|
555
|
+
"""Deserializes the ApiKeyAuth from a dictionary."""
|
|
556
|
+
return cls(key=d.get("key", None), value=d.get("value", None), value_plaintext=d.get("value_plaintext", None))
|
|
557
|
+
|
|
558
|
+
|
|
508
559
|
@dataclass
|
|
509
560
|
class AutoCaptureConfigInput:
|
|
510
561
|
catalog_name: Optional[str] = None
|
|
@@ -644,6 +695,40 @@ class AutoCaptureState:
|
|
|
644
695
|
return cls(payload_table=_from_dict(d, "payload_table", PayloadTable))
|
|
645
696
|
|
|
646
697
|
|
|
698
|
+
@dataclass
|
|
699
|
+
class BearerTokenAuth:
|
|
700
|
+
token: Optional[str] = None
|
|
701
|
+
"""The Databricks secret key reference for a token. If you prefer to paste your token directly, see
|
|
702
|
+
`token_plaintext`."""
|
|
703
|
+
|
|
704
|
+
token_plaintext: Optional[str] = None
|
|
705
|
+
"""The token provided as a plaintext string. If you prefer to reference your token using Databricks
|
|
706
|
+
Secrets, see `token`."""
|
|
707
|
+
|
|
708
|
+
def as_dict(self) -> dict:
|
|
709
|
+
"""Serializes the BearerTokenAuth into a dictionary suitable for use as a JSON request body."""
|
|
710
|
+
body = {}
|
|
711
|
+
if self.token is not None:
|
|
712
|
+
body["token"] = self.token
|
|
713
|
+
if self.token_plaintext is not None:
|
|
714
|
+
body["token_plaintext"] = self.token_plaintext
|
|
715
|
+
return body
|
|
716
|
+
|
|
717
|
+
def as_shallow_dict(self) -> dict:
|
|
718
|
+
"""Serializes the BearerTokenAuth into a shallow dictionary of its immediate attributes."""
|
|
719
|
+
body = {}
|
|
720
|
+
if self.token is not None:
|
|
721
|
+
body["token"] = self.token
|
|
722
|
+
if self.token_plaintext is not None:
|
|
723
|
+
body["token_plaintext"] = self.token_plaintext
|
|
724
|
+
return body
|
|
725
|
+
|
|
726
|
+
@classmethod
|
|
727
|
+
def from_dict(cls, d: Dict[str, Any]) -> BearerTokenAuth:
|
|
728
|
+
"""Deserializes the BearerTokenAuth from a dictionary."""
|
|
729
|
+
return cls(token=d.get("token", None), token_plaintext=d.get("token_plaintext", None))
|
|
730
|
+
|
|
731
|
+
|
|
647
732
|
@dataclass
|
|
648
733
|
class BuildLogsResponse:
|
|
649
734
|
logs: str
|
|
@@ -835,6 +920,53 @@ class CreateServingEndpoint:
|
|
|
835
920
|
)
|
|
836
921
|
|
|
837
922
|
|
|
923
|
+
@dataclass
|
|
924
|
+
class CustomProviderConfig:
|
|
925
|
+
"""Configs needed to create a custom provider model route."""
|
|
926
|
+
|
|
927
|
+
custom_provider_url: str
|
|
928
|
+
"""This is a field to provide the URL of the custom provider API."""
|
|
929
|
+
|
|
930
|
+
api_key_auth: Optional[ApiKeyAuth] = None
|
|
931
|
+
"""This is a field to provide API key authentication for the custom provider API. You can only
|
|
932
|
+
specify one authentication method."""
|
|
933
|
+
|
|
934
|
+
bearer_token_auth: Optional[BearerTokenAuth] = None
|
|
935
|
+
"""This is a field to provide bearer token authentication for the custom provider API. You can only
|
|
936
|
+
specify one authentication method."""
|
|
937
|
+
|
|
938
|
+
def as_dict(self) -> dict:
|
|
939
|
+
"""Serializes the CustomProviderConfig into a dictionary suitable for use as a JSON request body."""
|
|
940
|
+
body = {}
|
|
941
|
+
if self.api_key_auth:
|
|
942
|
+
body["api_key_auth"] = self.api_key_auth.as_dict()
|
|
943
|
+
if self.bearer_token_auth:
|
|
944
|
+
body["bearer_token_auth"] = self.bearer_token_auth.as_dict()
|
|
945
|
+
if self.custom_provider_url is not None:
|
|
946
|
+
body["custom_provider_url"] = self.custom_provider_url
|
|
947
|
+
return body
|
|
948
|
+
|
|
949
|
+
def as_shallow_dict(self) -> dict:
|
|
950
|
+
"""Serializes the CustomProviderConfig into a shallow dictionary of its immediate attributes."""
|
|
951
|
+
body = {}
|
|
952
|
+
if self.api_key_auth:
|
|
953
|
+
body["api_key_auth"] = self.api_key_auth
|
|
954
|
+
if self.bearer_token_auth:
|
|
955
|
+
body["bearer_token_auth"] = self.bearer_token_auth
|
|
956
|
+
if self.custom_provider_url is not None:
|
|
957
|
+
body["custom_provider_url"] = self.custom_provider_url
|
|
958
|
+
return body
|
|
959
|
+
|
|
960
|
+
@classmethod
|
|
961
|
+
def from_dict(cls, d: Dict[str, Any]) -> CustomProviderConfig:
|
|
962
|
+
"""Deserializes the CustomProviderConfig from a dictionary."""
|
|
963
|
+
return cls(
|
|
964
|
+
api_key_auth=_from_dict(d, "api_key_auth", ApiKeyAuth),
|
|
965
|
+
bearer_token_auth=_from_dict(d, "bearer_token_auth", BearerTokenAuth),
|
|
966
|
+
custom_provider_url=d.get("custom_provider_url", None),
|
|
967
|
+
)
|
|
968
|
+
|
|
969
|
+
|
|
838
970
|
@dataclass
|
|
839
971
|
class DataPlaneInfo:
|
|
840
972
|
"""Details necessary to query this object's API through the DataPlane APIs."""
|
|
@@ -1494,6 +1626,9 @@ class ExternalModel:
|
|
|
1494
1626
|
cohere_config: Optional[CohereConfig] = None
|
|
1495
1627
|
"""Cohere Config. Only required if the provider is 'cohere'."""
|
|
1496
1628
|
|
|
1629
|
+
custom_provider_config: Optional[CustomProviderConfig] = None
|
|
1630
|
+
"""Custom Provider Config. Only required if the provider is 'custom'."""
|
|
1631
|
+
|
|
1497
1632
|
databricks_model_serving_config: Optional[DatabricksModelServingConfig] = None
|
|
1498
1633
|
"""Databricks Model Serving Config. Only required if the provider is 'databricks-model-serving'."""
|
|
1499
1634
|
|
|
@@ -1517,6 +1652,8 @@ class ExternalModel:
|
|
|
1517
1652
|
body["anthropic_config"] = self.anthropic_config.as_dict()
|
|
1518
1653
|
if self.cohere_config:
|
|
1519
1654
|
body["cohere_config"] = self.cohere_config.as_dict()
|
|
1655
|
+
if self.custom_provider_config:
|
|
1656
|
+
body["custom_provider_config"] = self.custom_provider_config.as_dict()
|
|
1520
1657
|
if self.databricks_model_serving_config:
|
|
1521
1658
|
body["databricks_model_serving_config"] = self.databricks_model_serving_config.as_dict()
|
|
1522
1659
|
if self.google_cloud_vertex_ai_config:
|
|
@@ -1544,6 +1681,8 @@ class ExternalModel:
|
|
|
1544
1681
|
body["anthropic_config"] = self.anthropic_config
|
|
1545
1682
|
if self.cohere_config:
|
|
1546
1683
|
body["cohere_config"] = self.cohere_config
|
|
1684
|
+
if self.custom_provider_config:
|
|
1685
|
+
body["custom_provider_config"] = self.custom_provider_config
|
|
1547
1686
|
if self.databricks_model_serving_config:
|
|
1548
1687
|
body["databricks_model_serving_config"] = self.databricks_model_serving_config
|
|
1549
1688
|
if self.google_cloud_vertex_ai_config:
|
|
@@ -1568,6 +1707,7 @@ class ExternalModel:
|
|
|
1568
1707
|
amazon_bedrock_config=_from_dict(d, "amazon_bedrock_config", AmazonBedrockConfig),
|
|
1569
1708
|
anthropic_config=_from_dict(d, "anthropic_config", AnthropicConfig),
|
|
1570
1709
|
cohere_config=_from_dict(d, "cohere_config", CohereConfig),
|
|
1710
|
+
custom_provider_config=_from_dict(d, "custom_provider_config", CustomProviderConfig),
|
|
1571
1711
|
databricks_model_serving_config=_from_dict(
|
|
1572
1712
|
d, "databricks_model_serving_config", DatabricksModelServingConfig
|
|
1573
1713
|
),
|
|
@@ -1586,6 +1726,7 @@ class ExternalModelProvider(Enum):
|
|
|
1586
1726
|
AMAZON_BEDROCK = "amazon-bedrock"
|
|
1587
1727
|
ANTHROPIC = "anthropic"
|
|
1588
1728
|
COHERE = "cohere"
|
|
1729
|
+
CUSTOM = "custom"
|
|
1589
1730
|
DATABRICKS_MODEL_SERVING = "databricks-model-serving"
|
|
1590
1731
|
GOOGLE_CLOUD_VERTEX_AI = "google-cloud-vertex-ai"
|
|
1591
1732
|
OPENAI = "openai"
|
|
@@ -1635,6 +1776,35 @@ class ExternalModelUsageElement:
|
|
|
1635
1776
|
)
|
|
1636
1777
|
|
|
1637
1778
|
|
|
1779
|
+
@dataclass
|
|
1780
|
+
class FallbackConfig:
|
|
1781
|
+
enabled: bool
|
|
1782
|
+
"""Whether to enable traffic fallback. When a served entity in the serving endpoint returns
|
|
1783
|
+
specific error codes (e.g. 500), the request will automatically be round-robin attempted with
|
|
1784
|
+
other served entities in the same endpoint, following the order of served entity list, until a
|
|
1785
|
+
successful response is returned. If all attempts fail, return the last response with the error
|
|
1786
|
+
code."""
|
|
1787
|
+
|
|
1788
|
+
def as_dict(self) -> dict:
|
|
1789
|
+
"""Serializes the FallbackConfig into a dictionary suitable for use as a JSON request body."""
|
|
1790
|
+
body = {}
|
|
1791
|
+
if self.enabled is not None:
|
|
1792
|
+
body["enabled"] = self.enabled
|
|
1793
|
+
return body
|
|
1794
|
+
|
|
1795
|
+
def as_shallow_dict(self) -> dict:
|
|
1796
|
+
"""Serializes the FallbackConfig into a shallow dictionary of its immediate attributes."""
|
|
1797
|
+
body = {}
|
|
1798
|
+
if self.enabled is not None:
|
|
1799
|
+
body["enabled"] = self.enabled
|
|
1800
|
+
return body
|
|
1801
|
+
|
|
1802
|
+
@classmethod
|
|
1803
|
+
def from_dict(cls, d: Dict[str, Any]) -> FallbackConfig:
|
|
1804
|
+
"""Deserializes the FallbackConfig from a dictionary."""
|
|
1805
|
+
return cls(enabled=d.get("enabled", None))
|
|
1806
|
+
|
|
1807
|
+
|
|
1638
1808
|
@dataclass
|
|
1639
1809
|
class FoundationModel:
|
|
1640
1810
|
"""All fields are not sensitive as they are hard-coded in the system and made available to
|
|
@@ -2123,6 +2293,10 @@ class PayloadTable:
|
|
|
2123
2293
|
|
|
2124
2294
|
@dataclass
|
|
2125
2295
|
class PutAiGatewayRequest:
|
|
2296
|
+
fallback_config: Optional[FallbackConfig] = None
|
|
2297
|
+
"""Configuration for traffic fallback which auto fallbacks to other served entities if the request
|
|
2298
|
+
to a served entity fails with certain error codes, to increase availability."""
|
|
2299
|
+
|
|
2126
2300
|
guardrails: Optional[AiGatewayGuardrails] = None
|
|
2127
2301
|
"""Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
|
|
2128
2302
|
responses."""
|
|
@@ -2144,6 +2318,8 @@ class PutAiGatewayRequest:
|
|
|
2144
2318
|
def as_dict(self) -> dict:
|
|
2145
2319
|
"""Serializes the PutAiGatewayRequest into a dictionary suitable for use as a JSON request body."""
|
|
2146
2320
|
body = {}
|
|
2321
|
+
if self.fallback_config:
|
|
2322
|
+
body["fallback_config"] = self.fallback_config.as_dict()
|
|
2147
2323
|
if self.guardrails:
|
|
2148
2324
|
body["guardrails"] = self.guardrails.as_dict()
|
|
2149
2325
|
if self.inference_table_config:
|
|
@@ -2159,6 +2335,8 @@ class PutAiGatewayRequest:
|
|
|
2159
2335
|
def as_shallow_dict(self) -> dict:
|
|
2160
2336
|
"""Serializes the PutAiGatewayRequest into a shallow dictionary of its immediate attributes."""
|
|
2161
2337
|
body = {}
|
|
2338
|
+
if self.fallback_config:
|
|
2339
|
+
body["fallback_config"] = self.fallback_config
|
|
2162
2340
|
if self.guardrails:
|
|
2163
2341
|
body["guardrails"] = self.guardrails
|
|
2164
2342
|
if self.inference_table_config:
|
|
@@ -2175,6 +2353,7 @@ class PutAiGatewayRequest:
|
|
|
2175
2353
|
def from_dict(cls, d: Dict[str, Any]) -> PutAiGatewayRequest:
|
|
2176
2354
|
"""Deserializes the PutAiGatewayRequest from a dictionary."""
|
|
2177
2355
|
return cls(
|
|
2356
|
+
fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
|
|
2178
2357
|
guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
|
|
2179
2358
|
inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
|
|
2180
2359
|
name=d.get("name", None),
|
|
@@ -2185,6 +2364,10 @@ class PutAiGatewayRequest:
|
|
|
2185
2364
|
|
|
2186
2365
|
@dataclass
|
|
2187
2366
|
class PutAiGatewayResponse:
|
|
2367
|
+
fallback_config: Optional[FallbackConfig] = None
|
|
2368
|
+
"""Configuration for traffic fallback which auto fallbacks to other served entities if the request
|
|
2369
|
+
to a served entity fails with certain error codes, to increase availability."""
|
|
2370
|
+
|
|
2188
2371
|
guardrails: Optional[AiGatewayGuardrails] = None
|
|
2189
2372
|
"""Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
|
|
2190
2373
|
responses."""
|
|
@@ -2203,6 +2386,8 @@ class PutAiGatewayResponse:
|
|
|
2203
2386
|
def as_dict(self) -> dict:
|
|
2204
2387
|
"""Serializes the PutAiGatewayResponse into a dictionary suitable for use as a JSON request body."""
|
|
2205
2388
|
body = {}
|
|
2389
|
+
if self.fallback_config:
|
|
2390
|
+
body["fallback_config"] = self.fallback_config.as_dict()
|
|
2206
2391
|
if self.guardrails:
|
|
2207
2392
|
body["guardrails"] = self.guardrails.as_dict()
|
|
2208
2393
|
if self.inference_table_config:
|
|
@@ -2216,6 +2401,8 @@ class PutAiGatewayResponse:
|
|
|
2216
2401
|
def as_shallow_dict(self) -> dict:
|
|
2217
2402
|
"""Serializes the PutAiGatewayResponse into a shallow dictionary of its immediate attributes."""
|
|
2218
2403
|
body = {}
|
|
2404
|
+
if self.fallback_config:
|
|
2405
|
+
body["fallback_config"] = self.fallback_config
|
|
2219
2406
|
if self.guardrails:
|
|
2220
2407
|
body["guardrails"] = self.guardrails
|
|
2221
2408
|
if self.inference_table_config:
|
|
@@ -2230,6 +2417,7 @@ class PutAiGatewayResponse:
|
|
|
2230
2417
|
def from_dict(cls, d: Dict[str, Any]) -> PutAiGatewayResponse:
|
|
2231
2418
|
"""Deserializes the PutAiGatewayResponse from a dictionary."""
|
|
2232
2419
|
return cls(
|
|
2420
|
+
fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
|
|
2233
2421
|
guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
|
|
2234
2422
|
inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
|
|
2235
2423
|
rate_limits=_repeated_dict(d, "rate_limits", AiGatewayRateLimit),
|
|
@@ -4368,6 +4556,7 @@ class ServingEndpointsAPI:
|
|
|
4368
4556
|
self,
|
|
4369
4557
|
name: str,
|
|
4370
4558
|
*,
|
|
4559
|
+
fallback_config: Optional[FallbackConfig] = None,
|
|
4371
4560
|
guardrails: Optional[AiGatewayGuardrails] = None,
|
|
4372
4561
|
inference_table_config: Optional[AiGatewayInferenceTableConfig] = None,
|
|
4373
4562
|
rate_limits: Optional[List[AiGatewayRateLimit]] = None,
|
|
@@ -4380,6 +4569,9 @@ class ServingEndpointsAPI:
|
|
|
4380
4569
|
|
|
4381
4570
|
:param name: str
|
|
4382
4571
|
The name of the serving endpoint whose AI Gateway is being updated. This field is required.
|
|
4572
|
+
:param fallback_config: :class:`FallbackConfig` (optional)
|
|
4573
|
+
Configuration for traffic fallback which auto fallbacks to other served entities if the request to a
|
|
4574
|
+
served entity fails with certain error codes, to increase availability.
|
|
4383
4575
|
:param guardrails: :class:`AiGatewayGuardrails` (optional)
|
|
4384
4576
|
Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and responses.
|
|
4385
4577
|
:param inference_table_config: :class:`AiGatewayInferenceTableConfig` (optional)
|
|
@@ -4394,6 +4586,8 @@ class ServingEndpointsAPI:
|
|
|
4394
4586
|
:returns: :class:`PutAiGatewayResponse`
|
|
4395
4587
|
"""
|
|
4396
4588
|
body = {}
|
|
4589
|
+
if fallback_config is not None:
|
|
4590
|
+
body["fallback_config"] = fallback_config.as_dict()
|
|
4397
4591
|
if guardrails is not None:
|
|
4398
4592
|
body["guardrails"] = guardrails.as_dict()
|
|
4399
4593
|
if inference_table_config is not None:
|
|
@@ -4657,12 +4851,31 @@ class ServingEndpointsDataPlaneAPI:
|
|
|
4657
4851
|
"""Serving endpoints DataPlane provides a set of operations to interact with data plane endpoints for Serving
|
|
4658
4852
|
endpoints service."""
|
|
4659
4853
|
|
|
4660
|
-
def __init__(self, api_client,
|
|
4854
|
+
def __init__(self, api_client, control_plane_service, dpts):
|
|
4661
4855
|
self._api = api_client
|
|
4662
|
-
self.
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
self.
|
|
4856
|
+
self._lock = threading.Lock()
|
|
4857
|
+
self._control_plane_service = control_plane_service
|
|
4858
|
+
self._dpts = dpts
|
|
4859
|
+
self._data_plane_details = {}
|
|
4860
|
+
|
|
4861
|
+
def _data_plane_info_query(self, name: str) -> DataPlaneInfo:
|
|
4862
|
+
key = "query" + "/".join(
|
|
4863
|
+
[
|
|
4864
|
+
str(name),
|
|
4865
|
+
]
|
|
4866
|
+
)
|
|
4867
|
+
with self._lock:
|
|
4868
|
+
if key in self._data_plane_details:
|
|
4869
|
+
return self._data_plane_details[key]
|
|
4870
|
+
response = self._control_plane_service.get(
|
|
4871
|
+
name=name,
|
|
4872
|
+
)
|
|
4873
|
+
if response.data_plane_info is None:
|
|
4874
|
+
raise Exception("Resource does not support direct Data Plane access")
|
|
4875
|
+
result = response.data_plane_info.query_info
|
|
4876
|
+
with self._lock:
|
|
4877
|
+
self._data_plane_details[key] = result
|
|
4878
|
+
return result
|
|
4666
4879
|
|
|
4667
4880
|
def query(
|
|
4668
4881
|
self,
|
|
@@ -4757,22 +4970,10 @@ class ServingEndpointsDataPlaneAPI:
|
|
|
4757
4970
|
body["stream"] = stream
|
|
4758
4971
|
if temperature is not None:
|
|
4759
4972
|
body["temperature"] = temperature
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
response = self._control_plane.get(
|
|
4763
|
-
name=name,
|
|
4764
|
-
)
|
|
4765
|
-
if response.data_plane_info is None:
|
|
4766
|
-
raise Exception("Resource does not support direct Data Plane access")
|
|
4767
|
-
return response.data_plane_info.query_info
|
|
4768
|
-
|
|
4769
|
-
get_params = [
|
|
4770
|
-
name,
|
|
4771
|
-
]
|
|
4772
|
-
data_plane_details = self._data_plane_service.get_data_plane_details(
|
|
4773
|
-
"query", get_params, info_getter, self._api.get_oauth_token
|
|
4973
|
+
data_plane_info = self._data_plane_info_query(
|
|
4974
|
+
name=name,
|
|
4774
4975
|
)
|
|
4775
|
-
token =
|
|
4976
|
+
token = self._dpts.token(data_plane_info.endpoint_url, data_plane_info.authorization_details)
|
|
4776
4977
|
|
|
4777
4978
|
def auth(r: requests.PreparedRequest) -> requests.PreparedRequest:
|
|
4778
4979
|
authorization = f"{token.token_type} {token.access_token}"
|
|
@@ -4788,7 +4989,7 @@ class ServingEndpointsDataPlaneAPI:
|
|
|
4788
4989
|
]
|
|
4789
4990
|
res = self._api.do(
|
|
4790
4991
|
"POST",
|
|
4791
|
-
url=
|
|
4992
|
+
url=data_plane_info.endpoint_url,
|
|
4792
4993
|
body=body,
|
|
4793
4994
|
headers=headers,
|
|
4794
4995
|
response_headers=response_headers,
|
|
@@ -324,71 +324,7 @@ class DeltaSharingDependencyList:
|
|
|
324
324
|
|
|
325
325
|
|
|
326
326
|
@dataclass
|
|
327
|
-
class
|
|
328
|
-
"""A Function in UC as a dependency."""
|
|
329
|
-
|
|
330
|
-
function_name: Optional[str] = None
|
|
331
|
-
|
|
332
|
-
schema_name: Optional[str] = None
|
|
333
|
-
|
|
334
|
-
def as_dict(self) -> dict:
|
|
335
|
-
"""Serializes the DeltaSharingFunctionDependency into a dictionary suitable for use as a JSON request body."""
|
|
336
|
-
body = {}
|
|
337
|
-
if self.function_name is not None:
|
|
338
|
-
body["function_name"] = self.function_name
|
|
339
|
-
if self.schema_name is not None:
|
|
340
|
-
body["schema_name"] = self.schema_name
|
|
341
|
-
return body
|
|
342
|
-
|
|
343
|
-
def as_shallow_dict(self) -> dict:
|
|
344
|
-
"""Serializes the DeltaSharingFunctionDependency into a shallow dictionary of its immediate attributes."""
|
|
345
|
-
body = {}
|
|
346
|
-
if self.function_name is not None:
|
|
347
|
-
body["function_name"] = self.function_name
|
|
348
|
-
if self.schema_name is not None:
|
|
349
|
-
body["schema_name"] = self.schema_name
|
|
350
|
-
return body
|
|
351
|
-
|
|
352
|
-
@classmethod
|
|
353
|
-
def from_dict(cls, d: Dict[str, Any]) -> DeltaSharingFunctionDependency:
|
|
354
|
-
"""Deserializes the DeltaSharingFunctionDependency from a dictionary."""
|
|
355
|
-
return cls(function_name=d.get("function_name", None), schema_name=d.get("schema_name", None))
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
@dataclass
|
|
359
|
-
class DeltaSharingTableDependency:
|
|
360
|
-
"""A Table in UC as a dependency."""
|
|
361
|
-
|
|
362
|
-
schema_name: Optional[str] = None
|
|
363
|
-
|
|
364
|
-
table_name: Optional[str] = None
|
|
365
|
-
|
|
366
|
-
def as_dict(self) -> dict:
|
|
367
|
-
"""Serializes the DeltaSharingTableDependency into a dictionary suitable for use as a JSON request body."""
|
|
368
|
-
body = {}
|
|
369
|
-
if self.schema_name is not None:
|
|
370
|
-
body["schema_name"] = self.schema_name
|
|
371
|
-
if self.table_name is not None:
|
|
372
|
-
body["table_name"] = self.table_name
|
|
373
|
-
return body
|
|
374
|
-
|
|
375
|
-
def as_shallow_dict(self) -> dict:
|
|
376
|
-
"""Serializes the DeltaSharingTableDependency into a shallow dictionary of its immediate attributes."""
|
|
377
|
-
body = {}
|
|
378
|
-
if self.schema_name is not None:
|
|
379
|
-
body["schema_name"] = self.schema_name
|
|
380
|
-
if self.table_name is not None:
|
|
381
|
-
body["table_name"] = self.table_name
|
|
382
|
-
return body
|
|
383
|
-
|
|
384
|
-
@classmethod
|
|
385
|
-
def from_dict(cls, d: Dict[str, Any]) -> DeltaSharingTableDependency:
|
|
386
|
-
"""Deserializes the DeltaSharingTableDependency from a dictionary."""
|
|
387
|
-
return cls(schema_name=d.get("schema_name", None), table_name=d.get("table_name", None))
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
@dataclass
|
|
391
|
-
class Function:
|
|
327
|
+
class DeltaSharingFunction:
|
|
392
328
|
aliases: Optional[List[RegisteredModelAlias]] = None
|
|
393
329
|
"""The aliass of registered model."""
|
|
394
330
|
|
|
@@ -438,7 +374,7 @@ class Function:
|
|
|
438
374
|
"""The tags of the function."""
|
|
439
375
|
|
|
440
376
|
def as_dict(self) -> dict:
|
|
441
|
-
"""Serializes the
|
|
377
|
+
"""Serializes the DeltaSharingFunction into a dictionary suitable for use as a JSON request body."""
|
|
442
378
|
body = {}
|
|
443
379
|
if self.aliases:
|
|
444
380
|
body["aliases"] = [v.as_dict() for v in self.aliases]
|
|
@@ -475,7 +411,7 @@ class Function:
|
|
|
475
411
|
return body
|
|
476
412
|
|
|
477
413
|
def as_shallow_dict(self) -> dict:
|
|
478
|
-
"""Serializes the
|
|
414
|
+
"""Serializes the DeltaSharingFunction into a shallow dictionary of its immediate attributes."""
|
|
479
415
|
body = {}
|
|
480
416
|
if self.aliases:
|
|
481
417
|
body["aliases"] = self.aliases
|
|
@@ -512,8 +448,8 @@ class Function:
|
|
|
512
448
|
return body
|
|
513
449
|
|
|
514
450
|
@classmethod
|
|
515
|
-
def from_dict(cls, d: Dict[str, Any]) ->
|
|
516
|
-
"""Deserializes the
|
|
451
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeltaSharingFunction:
|
|
452
|
+
"""Deserializes the DeltaSharingFunction from a dictionary."""
|
|
517
453
|
return cls(
|
|
518
454
|
aliases=_repeated_dict(d, "aliases", RegisteredModelAlias),
|
|
519
455
|
comment=d.get("comment", None),
|
|
@@ -534,6 +470,70 @@ class Function:
|
|
|
534
470
|
)
|
|
535
471
|
|
|
536
472
|
|
|
473
|
+
@dataclass
|
|
474
|
+
class DeltaSharingFunctionDependency:
|
|
475
|
+
"""A Function in UC as a dependency."""
|
|
476
|
+
|
|
477
|
+
function_name: Optional[str] = None
|
|
478
|
+
|
|
479
|
+
schema_name: Optional[str] = None
|
|
480
|
+
|
|
481
|
+
def as_dict(self) -> dict:
|
|
482
|
+
"""Serializes the DeltaSharingFunctionDependency into a dictionary suitable for use as a JSON request body."""
|
|
483
|
+
body = {}
|
|
484
|
+
if self.function_name is not None:
|
|
485
|
+
body["function_name"] = self.function_name
|
|
486
|
+
if self.schema_name is not None:
|
|
487
|
+
body["schema_name"] = self.schema_name
|
|
488
|
+
return body
|
|
489
|
+
|
|
490
|
+
def as_shallow_dict(self) -> dict:
|
|
491
|
+
"""Serializes the DeltaSharingFunctionDependency into a shallow dictionary of its immediate attributes."""
|
|
492
|
+
body = {}
|
|
493
|
+
if self.function_name is not None:
|
|
494
|
+
body["function_name"] = self.function_name
|
|
495
|
+
if self.schema_name is not None:
|
|
496
|
+
body["schema_name"] = self.schema_name
|
|
497
|
+
return body
|
|
498
|
+
|
|
499
|
+
@classmethod
|
|
500
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeltaSharingFunctionDependency:
|
|
501
|
+
"""Deserializes the DeltaSharingFunctionDependency from a dictionary."""
|
|
502
|
+
return cls(function_name=d.get("function_name", None), schema_name=d.get("schema_name", None))
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
@dataclass
|
|
506
|
+
class DeltaSharingTableDependency:
|
|
507
|
+
"""A Table in UC as a dependency."""
|
|
508
|
+
|
|
509
|
+
schema_name: Optional[str] = None
|
|
510
|
+
|
|
511
|
+
table_name: Optional[str] = None
|
|
512
|
+
|
|
513
|
+
def as_dict(self) -> dict:
|
|
514
|
+
"""Serializes the DeltaSharingTableDependency into a dictionary suitable for use as a JSON request body."""
|
|
515
|
+
body = {}
|
|
516
|
+
if self.schema_name is not None:
|
|
517
|
+
body["schema_name"] = self.schema_name
|
|
518
|
+
if self.table_name is not None:
|
|
519
|
+
body["table_name"] = self.table_name
|
|
520
|
+
return body
|
|
521
|
+
|
|
522
|
+
def as_shallow_dict(self) -> dict:
|
|
523
|
+
"""Serializes the DeltaSharingTableDependency into a shallow dictionary of its immediate attributes."""
|
|
524
|
+
body = {}
|
|
525
|
+
if self.schema_name is not None:
|
|
526
|
+
body["schema_name"] = self.schema_name
|
|
527
|
+
if self.table_name is not None:
|
|
528
|
+
body["table_name"] = self.table_name
|
|
529
|
+
return body
|
|
530
|
+
|
|
531
|
+
@classmethod
|
|
532
|
+
def from_dict(cls, d: Dict[str, Any]) -> DeltaSharingTableDependency:
|
|
533
|
+
"""Deserializes the DeltaSharingTableDependency from a dictionary."""
|
|
534
|
+
return cls(schema_name=d.get("schema_name", None), table_name=d.get("table_name", None))
|
|
535
|
+
|
|
536
|
+
|
|
537
537
|
@dataclass
|
|
538
538
|
class FunctionParameterInfo:
|
|
539
539
|
"""Represents a parameter of a function. The same message is used for both input and output
|
|
@@ -809,7 +809,7 @@ class IpAccessList:
|
|
|
809
809
|
class ListProviderShareAssetsResponse:
|
|
810
810
|
"""Response to ListProviderShareAssets, which contains the list of assets of a share."""
|
|
811
811
|
|
|
812
|
-
functions: Optional[List[
|
|
812
|
+
functions: Optional[List[DeltaSharingFunction]] = None
|
|
813
813
|
"""The list of functions in the share."""
|
|
814
814
|
|
|
815
815
|
notebooks: Optional[List[NotebookFile]] = None
|
|
@@ -851,7 +851,7 @@ class ListProviderShareAssetsResponse:
|
|
|
851
851
|
def from_dict(cls, d: Dict[str, Any]) -> ListProviderShareAssetsResponse:
|
|
852
852
|
"""Deserializes the ListProviderShareAssetsResponse from a dictionary."""
|
|
853
853
|
return cls(
|
|
854
|
-
functions=_repeated_dict(d, "functions",
|
|
854
|
+
functions=_repeated_dict(d, "functions", DeltaSharingFunction),
|
|
855
855
|
notebooks=_repeated_dict(d, "notebooks", NotebookFile),
|
|
856
856
|
tables=_repeated_dict(d, "tables", Table),
|
|
857
857
|
volumes=_repeated_dict(d, "volumes", Volume),
|
databricks/sdk/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.47.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: databricks-sdk
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.47.0
|
|
4
4
|
Summary: Databricks SDK for Python (Beta)
|
|
5
5
|
Project-URL: Documentation, https://databricks-sdk-py.readthedocs.io
|
|
6
6
|
Keywords: databricks,sdk
|
|
@@ -44,12 +44,13 @@ Requires-Dist: langchain-openai; python_version > "3.7" and extra == "dev"
|
|
|
44
44
|
Requires-Dist: httpx; extra == "dev"
|
|
45
45
|
Requires-Dist: build; extra == "dev"
|
|
46
46
|
Provides-Extra: notebook
|
|
47
|
-
Requires-Dist: ipython<
|
|
47
|
+
Requires-Dist: ipython<10,>=8; extra == "notebook"
|
|
48
48
|
Requires-Dist: ipywidgets<9,>=8; extra == "notebook"
|
|
49
49
|
Provides-Extra: openai
|
|
50
50
|
Requires-Dist: openai; extra == "openai"
|
|
51
51
|
Requires-Dist: langchain-openai; python_version > "3.7" and extra == "openai"
|
|
52
52
|
Requires-Dist: httpx; extra == "openai"
|
|
53
|
+
Dynamic: license-file
|
|
53
54
|
|
|
54
55
|
# Databricks SDK for Python (Beta)
|
|
55
56
|
|