databricks-sdk 0.48.0__py3-none-any.whl → 0.50.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.

@@ -63,6 +63,10 @@ class Ai21LabsConfig:
63
63
 
64
64
  @dataclass
65
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
+
66
70
  guardrails: Optional[AiGatewayGuardrails] = None
67
71
  """Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
68
72
  responses."""
@@ -81,6 +85,8 @@ class AiGatewayConfig:
81
85
  def as_dict(self) -> dict:
82
86
  """Serializes the AiGatewayConfig into a dictionary suitable for use as a JSON request body."""
83
87
  body = {}
88
+ if self.fallback_config:
89
+ body["fallback_config"] = self.fallback_config.as_dict()
84
90
  if self.guardrails:
85
91
  body["guardrails"] = self.guardrails.as_dict()
86
92
  if self.inference_table_config:
@@ -94,6 +100,8 @@ class AiGatewayConfig:
94
100
  def as_shallow_dict(self) -> dict:
95
101
  """Serializes the AiGatewayConfig into a shallow dictionary of its immediate attributes."""
96
102
  body = {}
103
+ if self.fallback_config:
104
+ body["fallback_config"] = self.fallback_config
97
105
  if self.guardrails:
98
106
  body["guardrails"] = self.guardrails
99
107
  if self.inference_table_config:
@@ -108,6 +116,7 @@ class AiGatewayConfig:
108
116
  def from_dict(cls, d: Dict[str, Any]) -> AiGatewayConfig:
109
117
  """Deserializes the AiGatewayConfig from a dictionary."""
110
118
  return cls(
119
+ fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
111
120
  guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
112
121
  inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
113
122
  rate_limits=_repeated_dict(d, "rate_limits", AiGatewayRateLimit),
@@ -506,6 +515,47 @@ class AnthropicConfig:
506
515
  )
507
516
 
508
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
+
509
559
  @dataclass
510
560
  class AutoCaptureConfigInput:
511
561
  catalog_name: Optional[str] = None
@@ -645,6 +695,40 @@ class AutoCaptureState:
645
695
  return cls(payload_table=_from_dict(d, "payload_table", PayloadTable))
646
696
 
647
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
+
648
732
  @dataclass
649
733
  class BuildLogsResponse:
650
734
  logs: str
@@ -765,8 +849,9 @@ class CreateServingEndpoint:
765
849
  workspace. An endpoint name can consist of alphanumeric characters, dashes, and underscores."""
766
850
 
767
851
  ai_gateway: Optional[AiGatewayConfig] = None
768
- """The AI Gateway configuration for the serving endpoint. NOTE: Only external model and provisioned
769
- throughput endpoints are currently supported."""
852
+ """The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned
853
+ throughput, and pay-per-token endpoints are fully supported; agent endpoints currently only
854
+ support inference tables."""
770
855
 
771
856
  budget_policy_id: Optional[str] = None
772
857
  """The budget policy to be applied to the serving endpoint."""
@@ -836,6 +921,53 @@ class CreateServingEndpoint:
836
921
  )
837
922
 
838
923
 
924
+ @dataclass
925
+ class CustomProviderConfig:
926
+ """Configs needed to create a custom provider model route."""
927
+
928
+ custom_provider_url: str
929
+ """This is a field to provide the URL of the custom provider API."""
930
+
931
+ api_key_auth: Optional[ApiKeyAuth] = None
932
+ """This is a field to provide API key authentication for the custom provider API. You can only
933
+ specify one authentication method."""
934
+
935
+ bearer_token_auth: Optional[BearerTokenAuth] = None
936
+ """This is a field to provide bearer token authentication for the custom provider API. You can only
937
+ specify one authentication method."""
938
+
939
+ def as_dict(self) -> dict:
940
+ """Serializes the CustomProviderConfig into a dictionary suitable for use as a JSON request body."""
941
+ body = {}
942
+ if self.api_key_auth:
943
+ body["api_key_auth"] = self.api_key_auth.as_dict()
944
+ if self.bearer_token_auth:
945
+ body["bearer_token_auth"] = self.bearer_token_auth.as_dict()
946
+ if self.custom_provider_url is not None:
947
+ body["custom_provider_url"] = self.custom_provider_url
948
+ return body
949
+
950
+ def as_shallow_dict(self) -> dict:
951
+ """Serializes the CustomProviderConfig into a shallow dictionary of its immediate attributes."""
952
+ body = {}
953
+ if self.api_key_auth:
954
+ body["api_key_auth"] = self.api_key_auth
955
+ if self.bearer_token_auth:
956
+ body["bearer_token_auth"] = self.bearer_token_auth
957
+ if self.custom_provider_url is not None:
958
+ body["custom_provider_url"] = self.custom_provider_url
959
+ return body
960
+
961
+ @classmethod
962
+ def from_dict(cls, d: Dict[str, Any]) -> CustomProviderConfig:
963
+ """Deserializes the CustomProviderConfig from a dictionary."""
964
+ return cls(
965
+ api_key_auth=_from_dict(d, "api_key_auth", ApiKeyAuth),
966
+ bearer_token_auth=_from_dict(d, "bearer_token_auth", BearerTokenAuth),
967
+ custom_provider_url=d.get("custom_provider_url", None),
968
+ )
969
+
970
+
839
971
  @dataclass
840
972
  class DataPlaneInfo:
841
973
  """Details necessary to query this object's API through the DataPlane APIs."""
@@ -1495,6 +1627,9 @@ class ExternalModel:
1495
1627
  cohere_config: Optional[CohereConfig] = None
1496
1628
  """Cohere Config. Only required if the provider is 'cohere'."""
1497
1629
 
1630
+ custom_provider_config: Optional[CustomProviderConfig] = None
1631
+ """Custom Provider Config. Only required if the provider is 'custom'."""
1632
+
1498
1633
  databricks_model_serving_config: Optional[DatabricksModelServingConfig] = None
1499
1634
  """Databricks Model Serving Config. Only required if the provider is 'databricks-model-serving'."""
1500
1635
 
@@ -1518,6 +1653,8 @@ class ExternalModel:
1518
1653
  body["anthropic_config"] = self.anthropic_config.as_dict()
1519
1654
  if self.cohere_config:
1520
1655
  body["cohere_config"] = self.cohere_config.as_dict()
1656
+ if self.custom_provider_config:
1657
+ body["custom_provider_config"] = self.custom_provider_config.as_dict()
1521
1658
  if self.databricks_model_serving_config:
1522
1659
  body["databricks_model_serving_config"] = self.databricks_model_serving_config.as_dict()
1523
1660
  if self.google_cloud_vertex_ai_config:
@@ -1545,6 +1682,8 @@ class ExternalModel:
1545
1682
  body["anthropic_config"] = self.anthropic_config
1546
1683
  if self.cohere_config:
1547
1684
  body["cohere_config"] = self.cohere_config
1685
+ if self.custom_provider_config:
1686
+ body["custom_provider_config"] = self.custom_provider_config
1548
1687
  if self.databricks_model_serving_config:
1549
1688
  body["databricks_model_serving_config"] = self.databricks_model_serving_config
1550
1689
  if self.google_cloud_vertex_ai_config:
@@ -1569,6 +1708,7 @@ class ExternalModel:
1569
1708
  amazon_bedrock_config=_from_dict(d, "amazon_bedrock_config", AmazonBedrockConfig),
1570
1709
  anthropic_config=_from_dict(d, "anthropic_config", AnthropicConfig),
1571
1710
  cohere_config=_from_dict(d, "cohere_config", CohereConfig),
1711
+ custom_provider_config=_from_dict(d, "custom_provider_config", CustomProviderConfig),
1572
1712
  databricks_model_serving_config=_from_dict(
1573
1713
  d, "databricks_model_serving_config", DatabricksModelServingConfig
1574
1714
  ),
@@ -1587,6 +1727,7 @@ class ExternalModelProvider(Enum):
1587
1727
  AMAZON_BEDROCK = "amazon-bedrock"
1588
1728
  ANTHROPIC = "anthropic"
1589
1729
  COHERE = "cohere"
1730
+ CUSTOM = "custom"
1590
1731
  DATABRICKS_MODEL_SERVING = "databricks-model-serving"
1591
1732
  GOOGLE_CLOUD_VERTEX_AI = "google-cloud-vertex-ai"
1592
1733
  OPENAI = "openai"
@@ -1636,6 +1777,35 @@ class ExternalModelUsageElement:
1636
1777
  )
1637
1778
 
1638
1779
 
1780
+ @dataclass
1781
+ class FallbackConfig:
1782
+ enabled: bool
1783
+ """Whether to enable traffic fallback. When a served entity in the serving endpoint returns
1784
+ specific error codes (e.g. 500), the request will automatically be round-robin attempted with
1785
+ other served entities in the same endpoint, following the order of served entity list, until a
1786
+ successful response is returned. If all attempts fail, return the last response with the error
1787
+ code."""
1788
+
1789
+ def as_dict(self) -> dict:
1790
+ """Serializes the FallbackConfig into a dictionary suitable for use as a JSON request body."""
1791
+ body = {}
1792
+ if self.enabled is not None:
1793
+ body["enabled"] = self.enabled
1794
+ return body
1795
+
1796
+ def as_shallow_dict(self) -> dict:
1797
+ """Serializes the FallbackConfig into a shallow dictionary of its immediate attributes."""
1798
+ body = {}
1799
+ if self.enabled is not None:
1800
+ body["enabled"] = self.enabled
1801
+ return body
1802
+
1803
+ @classmethod
1804
+ def from_dict(cls, d: Dict[str, Any]) -> FallbackConfig:
1805
+ """Deserializes the FallbackConfig from a dictionary."""
1806
+ return cls(enabled=d.get("enabled", None))
1807
+
1808
+
1639
1809
  @dataclass
1640
1810
  class FoundationModel:
1641
1811
  """All fields are not sensitive as they are hard-coded in the system and made available to
@@ -2124,6 +2294,10 @@ class PayloadTable:
2124
2294
 
2125
2295
  @dataclass
2126
2296
  class PutAiGatewayRequest:
2297
+ fallback_config: Optional[FallbackConfig] = None
2298
+ """Configuration for traffic fallback which auto fallbacks to other served entities if the request
2299
+ to a served entity fails with certain error codes, to increase availability."""
2300
+
2127
2301
  guardrails: Optional[AiGatewayGuardrails] = None
2128
2302
  """Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
2129
2303
  responses."""
@@ -2145,6 +2319,8 @@ class PutAiGatewayRequest:
2145
2319
  def as_dict(self) -> dict:
2146
2320
  """Serializes the PutAiGatewayRequest into a dictionary suitable for use as a JSON request body."""
2147
2321
  body = {}
2322
+ if self.fallback_config:
2323
+ body["fallback_config"] = self.fallback_config.as_dict()
2148
2324
  if self.guardrails:
2149
2325
  body["guardrails"] = self.guardrails.as_dict()
2150
2326
  if self.inference_table_config:
@@ -2160,6 +2336,8 @@ class PutAiGatewayRequest:
2160
2336
  def as_shallow_dict(self) -> dict:
2161
2337
  """Serializes the PutAiGatewayRequest into a shallow dictionary of its immediate attributes."""
2162
2338
  body = {}
2339
+ if self.fallback_config:
2340
+ body["fallback_config"] = self.fallback_config
2163
2341
  if self.guardrails:
2164
2342
  body["guardrails"] = self.guardrails
2165
2343
  if self.inference_table_config:
@@ -2176,6 +2354,7 @@ class PutAiGatewayRequest:
2176
2354
  def from_dict(cls, d: Dict[str, Any]) -> PutAiGatewayRequest:
2177
2355
  """Deserializes the PutAiGatewayRequest from a dictionary."""
2178
2356
  return cls(
2357
+ fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
2179
2358
  guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
2180
2359
  inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
2181
2360
  name=d.get("name", None),
@@ -2186,6 +2365,10 @@ class PutAiGatewayRequest:
2186
2365
 
2187
2366
  @dataclass
2188
2367
  class PutAiGatewayResponse:
2368
+ fallback_config: Optional[FallbackConfig] = None
2369
+ """Configuration for traffic fallback which auto fallbacks to other served entities if the request
2370
+ to a served entity fails with certain error codes, to increase availability."""
2371
+
2189
2372
  guardrails: Optional[AiGatewayGuardrails] = None
2190
2373
  """Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and
2191
2374
  responses."""
@@ -2204,6 +2387,8 @@ class PutAiGatewayResponse:
2204
2387
  def as_dict(self) -> dict:
2205
2388
  """Serializes the PutAiGatewayResponse into a dictionary suitable for use as a JSON request body."""
2206
2389
  body = {}
2390
+ if self.fallback_config:
2391
+ body["fallback_config"] = self.fallback_config.as_dict()
2207
2392
  if self.guardrails:
2208
2393
  body["guardrails"] = self.guardrails.as_dict()
2209
2394
  if self.inference_table_config:
@@ -2217,6 +2402,8 @@ class PutAiGatewayResponse:
2217
2402
  def as_shallow_dict(self) -> dict:
2218
2403
  """Serializes the PutAiGatewayResponse into a shallow dictionary of its immediate attributes."""
2219
2404
  body = {}
2405
+ if self.fallback_config:
2406
+ body["fallback_config"] = self.fallback_config
2220
2407
  if self.guardrails:
2221
2408
  body["guardrails"] = self.guardrails
2222
2409
  if self.inference_table_config:
@@ -2231,6 +2418,7 @@ class PutAiGatewayResponse:
2231
2418
  def from_dict(cls, d: Dict[str, Any]) -> PutAiGatewayResponse:
2232
2419
  """Deserializes the PutAiGatewayResponse from a dictionary."""
2233
2420
  return cls(
2421
+ fallback_config=_from_dict(d, "fallback_config", FallbackConfig),
2234
2422
  guardrails=_from_dict(d, "guardrails", AiGatewayGuardrails),
2235
2423
  inference_table_config=_from_dict(d, "inference_table_config", AiGatewayInferenceTableConfig),
2236
2424
  rate_limits=_repeated_dict(d, "rate_limits", AiGatewayRateLimit),
@@ -3107,6 +3295,7 @@ class ServedModelInputWorkloadSize(Enum):
3107
3295
 
3108
3296
 
3109
3297
  class ServedModelInputWorkloadType(Enum):
3298
+ """Please keep this in sync with with workload types in InferenceEndpointEntities.scala"""
3110
3299
 
3111
3300
  CPU = "CPU"
3112
3301
  GPU_LARGE = "GPU_LARGE"
@@ -3343,8 +3532,9 @@ class ServerLogsResponse:
3343
3532
  @dataclass
3344
3533
  class ServingEndpoint:
3345
3534
  ai_gateway: Optional[AiGatewayConfig] = None
3346
- """The AI Gateway configuration for the serving endpoint. NOTE: Only external model and provisioned
3347
- throughput endpoints are currently supported."""
3535
+ """The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned
3536
+ throughput, and pay-per-token endpoints are fully supported; agent endpoints currently only
3537
+ support inference tables."""
3348
3538
 
3349
3539
  budget_policy_id: Optional[str] = None
3350
3540
  """The budget policy associated with the endpoint."""
@@ -3561,8 +3751,9 @@ class ServingEndpointAccessControlResponse:
3561
3751
  @dataclass
3562
3752
  class ServingEndpointDetailed:
3563
3753
  ai_gateway: Optional[AiGatewayConfig] = None
3564
- """The AI Gateway configuration for the serving endpoint. NOTE: Only external model and provisioned
3565
- throughput endpoints are currently supported."""
3754
+ """The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned
3755
+ throughput, and pay-per-token endpoints are fully supported; agent endpoints currently only
3756
+ support inference tables."""
3566
3757
 
3567
3758
  budget_policy_id: Optional[str] = None
3568
3759
  """The budget policy associated with the endpoint."""
@@ -3872,6 +4063,7 @@ class ServingEndpointPermissionsRequest:
3872
4063
 
3873
4064
 
3874
4065
  class ServingModelWorkloadType(Enum):
4066
+ """Please keep this in sync with with workload types in InferenceEndpointEntities.scala"""
3875
4067
 
3876
4068
  CPU = "CPU"
3877
4069
  GPU_LARGE = "GPU_LARGE"
@@ -4053,8 +4245,9 @@ class ServingEndpointsAPI:
4053
4245
  The name of the serving endpoint. This field is required and must be unique across a Databricks
4054
4246
  workspace. An endpoint name can consist of alphanumeric characters, dashes, and underscores.
4055
4247
  :param ai_gateway: :class:`AiGatewayConfig` (optional)
4056
- The AI Gateway configuration for the serving endpoint. NOTE: Only external model and provisioned
4057
- throughput endpoints are currently supported.
4248
+ The AI Gateway configuration for the serving endpoint. NOTE: External model, provisioned throughput,
4249
+ and pay-per-token endpoints are fully supported; agent endpoints currently only support inference
4250
+ tables.
4058
4251
  :param budget_policy_id: str (optional)
4059
4252
  The budget policy to be applied to the serving endpoint.
4060
4253
  :param config: :class:`EndpointCoreConfigInput` (optional)
@@ -4344,8 +4537,7 @@ class ServingEndpointsAPI:
4344
4537
  def put(self, name: str, *, rate_limits: Optional[List[RateLimit]] = None) -> PutResponse:
4345
4538
  """Update rate limits of a serving endpoint.
4346
4539
 
4347
- Used to update the rate limits of a serving endpoint. NOTE: Only foundation model endpoints are
4348
- currently supported. For external models, use AI Gateway to manage rate limits.
4540
+ Deprecated: Please use AI Gateway to manage rate limits instead.
4349
4541
 
4350
4542
  :param name: str
4351
4543
  The name of the serving endpoint whose rate limits are being updated. This field is required.
@@ -4369,6 +4561,7 @@ class ServingEndpointsAPI:
4369
4561
  self,
4370
4562
  name: str,
4371
4563
  *,
4564
+ fallback_config: Optional[FallbackConfig] = None,
4372
4565
  guardrails: Optional[AiGatewayGuardrails] = None,
4373
4566
  inference_table_config: Optional[AiGatewayInferenceTableConfig] = None,
4374
4567
  rate_limits: Optional[List[AiGatewayRateLimit]] = None,
@@ -4376,11 +4569,14 @@ class ServingEndpointsAPI:
4376
4569
  ) -> PutAiGatewayResponse:
4377
4570
  """Update AI Gateway of a serving endpoint.
4378
4571
 
4379
- Used to update the AI Gateway of a serving endpoint. NOTE: Only external model and provisioned
4380
- throughput endpoints are currently supported.
4572
+ Used to update the AI Gateway of a serving endpoint. NOTE: External model, provisioned throughput, and
4573
+ pay-per-token endpoints are fully supported; agent endpoints currently only support inference tables.
4381
4574
 
4382
4575
  :param name: str
4383
4576
  The name of the serving endpoint whose AI Gateway is being updated. This field is required.
4577
+ :param fallback_config: :class:`FallbackConfig` (optional)
4578
+ Configuration for traffic fallback which auto fallbacks to other served entities if the request to a
4579
+ served entity fails with certain error codes, to increase availability.
4384
4580
  :param guardrails: :class:`AiGatewayGuardrails` (optional)
4385
4581
  Configuration for AI Guardrails to prevent unwanted data and unsafe data in requests and responses.
4386
4582
  :param inference_table_config: :class:`AiGatewayInferenceTableConfig` (optional)
@@ -4395,6 +4591,8 @@ class ServingEndpointsAPI:
4395
4591
  :returns: :class:`PutAiGatewayResponse`
4396
4592
  """
4397
4593
  body = {}
4594
+ if fallback_config is not None:
4595
+ body["fallback_config"] = fallback_config.as_dict()
4398
4596
  if guardrails is not None:
4399
4597
  body["guardrails"] = guardrails.as_dict()
4400
4598
  if inference_table_config is not None: