databricks-sdk 0.19.1__py3-none-any.whl → 0.21.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of databricks-sdk might be problematic. Click here for more details.

Files changed (35) hide show
  1. databricks/sdk/__init__.py +28 -6
  2. databricks/sdk/_widgets/__init__.py +2 -2
  3. databricks/sdk/config.py +3 -2
  4. databricks/sdk/core.py +4 -2
  5. databricks/sdk/mixins/workspace.py +2 -1
  6. databricks/sdk/oauth.py +1 -1
  7. databricks/sdk/runtime/__init__.py +85 -11
  8. databricks/sdk/runtime/dbutils_stub.py +1 -1
  9. databricks/sdk/service/_internal.py +1 -1
  10. databricks/sdk/service/billing.py +64 -1
  11. databricks/sdk/service/catalog.py +796 -84
  12. databricks/sdk/service/compute.py +391 -13
  13. databricks/sdk/service/dashboards.py +15 -0
  14. databricks/sdk/service/files.py +289 -15
  15. databricks/sdk/service/iam.py +214 -0
  16. databricks/sdk/service/jobs.py +242 -143
  17. databricks/sdk/service/ml.py +407 -0
  18. databricks/sdk/service/oauth2.py +83 -0
  19. databricks/sdk/service/pipelines.py +78 -8
  20. databricks/sdk/service/provisioning.py +108 -36
  21. databricks/sdk/service/serving.py +101 -35
  22. databricks/sdk/service/settings.py +1316 -186
  23. databricks/sdk/service/sharing.py +94 -18
  24. databricks/sdk/service/sql.py +230 -13
  25. databricks/sdk/service/vectorsearch.py +105 -60
  26. databricks/sdk/service/workspace.py +175 -1
  27. databricks/sdk/version.py +1 -1
  28. {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/METADATA +3 -1
  29. databricks_sdk-0.21.0.dist-info/RECORD +53 -0
  30. databricks/sdk/runtime/stub.py +0 -48
  31. databricks_sdk-0.19.1.dist-info/RECORD +0 -54
  32. {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/LICENSE +0 -0
  33. {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/NOTICE +0 -0
  34. {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/WHEEL +0 -0
  35. {databricks_sdk-0.19.1.dist-info → databricks_sdk-0.21.0.dist-info}/top_level.txt +0 -0
@@ -449,6 +449,20 @@ class DeleteAppResponse:
449
449
  return cls(name=d.get('name', None))
450
450
 
451
451
 
452
+ @dataclass
453
+ class DeleteResponse:
454
+
455
+ def as_dict(self) -> dict:
456
+ """Serializes the DeleteResponse into a dictionary suitable for use as a JSON request body."""
457
+ body = {}
458
+ return body
459
+
460
+ @classmethod
461
+ def from_dict(cls, d: Dict[str, any]) -> DeleteResponse:
462
+ """Deserializes the DeleteResponse from a dictionary."""
463
+ return cls()
464
+
465
+
452
466
  @dataclass
453
467
  class DeployAppRequest:
454
468
  manifest: AppManifest
@@ -751,6 +765,20 @@ class EndpointTag:
751
765
  return cls(key=d.get('key', None), value=d.get('value', None))
752
766
 
753
767
 
768
+ @dataclass
769
+ class ExportMetricsResponse:
770
+
771
+ def as_dict(self) -> dict:
772
+ """Serializes the ExportMetricsResponse into a dictionary suitable for use as a JSON request body."""
773
+ body = {}
774
+ return body
775
+
776
+ @classmethod
777
+ def from_dict(cls, d: Dict[str, any]) -> ExportMetricsResponse:
778
+ """Deserializes the ExportMetricsResponse from a dictionary."""
779
+ return cls()
780
+
781
+
754
782
  @dataclass
755
783
  class ExternalModel:
756
784
  provider: ExternalModelProvider
@@ -764,52 +792,29 @@ class ExternalModel:
764
792
  task: str
765
793
  """The task type of the external model."""
766
794
 
767
- config: ExternalModelConfig
768
- """The config for the external model, which must match the provider."""
769
-
770
- def as_dict(self) -> dict:
771
- """Serializes the ExternalModel into a dictionary suitable for use as a JSON request body."""
772
- body = {}
773
- if self.config: body['config'] = self.config.as_dict()
774
- if self.name is not None: body['name'] = self.name
775
- if self.provider is not None: body['provider'] = self.provider.value
776
- if self.task is not None: body['task'] = self.task
777
- return body
778
-
779
- @classmethod
780
- def from_dict(cls, d: Dict[str, any]) -> ExternalModel:
781
- """Deserializes the ExternalModel from a dictionary."""
782
- return cls(config=_from_dict(d, 'config', ExternalModelConfig),
783
- name=d.get('name', None),
784
- provider=_enum(d, 'provider', ExternalModelProvider),
785
- task=d.get('task', None))
786
-
787
-
788
- @dataclass
789
- class ExternalModelConfig:
790
795
  ai21labs_config: Optional[Ai21LabsConfig] = None
791
- """AI21Labs Config"""
796
+ """AI21Labs Config. Only required if the provider is 'ai21labs'."""
792
797
 
793
798
  anthropic_config: Optional[AnthropicConfig] = None
794
- """Anthropic Config"""
799
+ """Anthropic Config. Only required if the provider is 'anthropic'."""
795
800
 
796
801
  aws_bedrock_config: Optional[AwsBedrockConfig] = None
797
- """AWS Bedrock Config"""
802
+ """AWS Bedrock Config. Only required if the provider is 'aws-bedrock'."""
798
803
 
799
804
  cohere_config: Optional[CohereConfig] = None
800
- """Cohere Config"""
805
+ """Cohere Config. Only required if the provider is 'cohere'."""
801
806
 
802
807
  databricks_model_serving_config: Optional[DatabricksModelServingConfig] = None
803
- """Databricks Model Serving Config"""
808
+ """Databricks Model Serving Config. Only required if the provider is 'databricks-model-serving'."""
804
809
 
805
810
  openai_config: Optional[OpenAiConfig] = None
806
- """OpenAI Config"""
811
+ """OpenAI Config. Only required if the provider is 'openai'."""
807
812
 
808
813
  palm_config: Optional[PaLmConfig] = None
809
- """PaLM Config"""
814
+ """PaLM Config. Only required if the provider is 'palm'."""
810
815
 
811
816
  def as_dict(self) -> dict:
812
- """Serializes the ExternalModelConfig into a dictionary suitable for use as a JSON request body."""
817
+ """Serializes the ExternalModel into a dictionary suitable for use as a JSON request body."""
813
818
  body = {}
814
819
  if self.ai21labs_config: body['ai21labs_config'] = self.ai21labs_config.as_dict()
815
820
  if self.anthropic_config: body['anthropic_config'] = self.anthropic_config.as_dict()
@@ -817,21 +822,27 @@ class ExternalModelConfig:
817
822
  if self.cohere_config: body['cohere_config'] = self.cohere_config.as_dict()
818
823
  if self.databricks_model_serving_config:
819
824
  body['databricks_model_serving_config'] = self.databricks_model_serving_config.as_dict()
825
+ if self.name is not None: body['name'] = self.name
820
826
  if self.openai_config: body['openai_config'] = self.openai_config.as_dict()
821
827
  if self.palm_config: body['palm_config'] = self.palm_config.as_dict()
828
+ if self.provider is not None: body['provider'] = self.provider.value
829
+ if self.task is not None: body['task'] = self.task
822
830
  return body
823
831
 
824
832
  @classmethod
825
- def from_dict(cls, d: Dict[str, any]) -> ExternalModelConfig:
826
- """Deserializes the ExternalModelConfig from a dictionary."""
833
+ def from_dict(cls, d: Dict[str, any]) -> ExternalModel:
834
+ """Deserializes the ExternalModel from a dictionary."""
827
835
  return cls(ai21labs_config=_from_dict(d, 'ai21labs_config', Ai21LabsConfig),
828
836
  anthropic_config=_from_dict(d, 'anthropic_config', AnthropicConfig),
829
837
  aws_bedrock_config=_from_dict(d, 'aws_bedrock_config', AwsBedrockConfig),
830
838
  cohere_config=_from_dict(d, 'cohere_config', CohereConfig),
831
839
  databricks_model_serving_config=_from_dict(d, 'databricks_model_serving_config',
832
840
  DatabricksModelServingConfig),
841
+ name=d.get('name', None),
833
842
  openai_config=_from_dict(d, 'openai_config', OpenAiConfig),
834
- palm_config=_from_dict(d, 'palm_config', PaLmConfig))
843
+ palm_config=_from_dict(d, 'palm_config', PaLmConfig),
844
+ provider=_enum(d, 'provider', ExternalModelProvider),
845
+ task=d.get('task', None))
835
846
 
836
847
 
837
848
  class ExternalModelProvider(Enum):
@@ -1272,6 +1283,10 @@ class QueryEndpointResponse:
1272
1283
  predictions: Optional[List[Any]] = None
1273
1284
  """The predictions returned by the serving endpoint."""
1274
1285
 
1286
+ served_model_name: Optional[str] = None
1287
+ """The name of the served model that served the request. This is useful when there are multiple
1288
+ models behind the same endpoint with traffic split."""
1289
+
1275
1290
  usage: Optional[ExternalModelUsageElement] = None
1276
1291
  """The usage object that may be returned by the __external/foundation model__ serving endpoint.
1277
1292
  This contains information about the number of tokens used in the prompt and response."""
@@ -1286,6 +1301,7 @@ class QueryEndpointResponse:
1286
1301
  if self.model is not None: body['model'] = self.model
1287
1302
  if self.object is not None: body['object'] = self.object.value
1288
1303
  if self.predictions: body['predictions'] = [v for v in self.predictions]
1304
+ if self.served_model_name is not None: body['served-model-name'] = self.served_model_name
1289
1305
  if self.usage: body['usage'] = self.usage.as_dict()
1290
1306
  return body
1291
1307
 
@@ -1299,6 +1315,7 @@ class QueryEndpointResponse:
1299
1315
  model=d.get('model', None),
1300
1316
  object=_enum(d, 'object', QueryEndpointResponseObject),
1301
1317
  predictions=d.get('predictions', None),
1318
+ served_model_name=d.get('served-model-name', None),
1302
1319
  usage=_from_dict(d, 'usage', ExternalModelUsageElement))
1303
1320
 
1304
1321
 
@@ -1406,6 +1423,12 @@ class ServedEntityInput:
1406
1423
  instance_profile_arn: Optional[str] = None
1407
1424
  """ARN of the instance profile that the served entity uses to access AWS resources."""
1408
1425
 
1426
+ max_provisioned_throughput: Optional[int] = None
1427
+ """The maximum tokens per second that the endpoint can scale up to."""
1428
+
1429
+ min_provisioned_throughput: Optional[int] = None
1430
+ """The minimum tokens per second that the endpoint can scale down to."""
1431
+
1409
1432
  name: Optional[str] = None
1410
1433
  """The name of a served entity. It must be unique across an endpoint. A served entity name can
1411
1434
  consist of alphanumeric characters, dashes, and underscores. If not specified for an external
@@ -1439,6 +1462,10 @@ class ServedEntityInput:
1439
1462
  if self.environment_vars: body['environment_vars'] = self.environment_vars
1440
1463
  if self.external_model: body['external_model'] = self.external_model.as_dict()
1441
1464
  if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn
1465
+ if self.max_provisioned_throughput is not None:
1466
+ body['max_provisioned_throughput'] = self.max_provisioned_throughput
1467
+ if self.min_provisioned_throughput is not None:
1468
+ body['min_provisioned_throughput'] = self.min_provisioned_throughput
1442
1469
  if self.name is not None: body['name'] = self.name
1443
1470
  if self.scale_to_zero_enabled is not None: body['scale_to_zero_enabled'] = self.scale_to_zero_enabled
1444
1471
  if self.workload_size is not None: body['workload_size'] = self.workload_size
@@ -1453,6 +1480,8 @@ class ServedEntityInput:
1453
1480
  environment_vars=d.get('environment_vars', None),
1454
1481
  external_model=_from_dict(d, 'external_model', ExternalModel),
1455
1482
  instance_profile_arn=d.get('instance_profile_arn', None),
1483
+ max_provisioned_throughput=d.get('max_provisioned_throughput', None),
1484
+ min_provisioned_throughput=d.get('min_provisioned_throughput', None),
1456
1485
  name=d.get('name', None),
1457
1486
  scale_to_zero_enabled=d.get('scale_to_zero_enabled', None),
1458
1487
  workload_size=d.get('workload_size', None),
@@ -1496,6 +1525,12 @@ class ServedEntityOutput:
1496
1525
  instance_profile_arn: Optional[str] = None
1497
1526
  """ARN of the instance profile that the served entity uses to access AWS resources."""
1498
1527
 
1528
+ max_provisioned_throughput: Optional[int] = None
1529
+ """The maximum tokens per second that the endpoint can scale up to."""
1530
+
1531
+ min_provisioned_throughput: Optional[int] = None
1532
+ """The minimum tokens per second that the endpoint can scale down to."""
1533
+
1499
1534
  name: Optional[str] = None
1500
1535
  """The name of the served entity."""
1501
1536
 
@@ -1532,6 +1567,10 @@ class ServedEntityOutput:
1532
1567
  if self.external_model: body['external_model'] = self.external_model.as_dict()
1533
1568
  if self.foundation_model: body['foundation_model'] = self.foundation_model.as_dict()
1534
1569
  if self.instance_profile_arn is not None: body['instance_profile_arn'] = self.instance_profile_arn
1570
+ if self.max_provisioned_throughput is not None:
1571
+ body['max_provisioned_throughput'] = self.max_provisioned_throughput
1572
+ if self.min_provisioned_throughput is not None:
1573
+ body['min_provisioned_throughput'] = self.min_provisioned_throughput
1535
1574
  if self.name is not None: body['name'] = self.name
1536
1575
  if self.scale_to_zero_enabled is not None: body['scale_to_zero_enabled'] = self.scale_to_zero_enabled
1537
1576
  if self.state: body['state'] = self.state.as_dict()
@@ -1550,6 +1589,8 @@ class ServedEntityOutput:
1550
1589
  external_model=_from_dict(d, 'external_model', ExternalModel),
1551
1590
  foundation_model=_from_dict(d, 'foundation_model', FoundationModel),
1552
1591
  instance_profile_arn=d.get('instance_profile_arn', None),
1592
+ max_provisioned_throughput=d.get('max_provisioned_throughput', None),
1593
+ min_provisioned_throughput=d.get('min_provisioned_throughput', None),
1553
1594
  name=d.get('name', None),
1554
1595
  scale_to_zero_enabled=d.get('scale_to_zero_enabled', None),
1555
1596
  state=_from_dict(d, 'state', ServedModelState),
@@ -2258,6 +2299,7 @@ class AppsAPI:
2258
2299
  if manifest is not None: body['manifest'] = manifest.as_dict()
2259
2300
  if resources is not None: body['resources'] = resources
2260
2301
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2302
+
2261
2303
  res = self._api.do('POST', '/api/2.0/preview/apps/deployments', body=body, headers=headers)
2262
2304
  return DeploymentStatus.from_dict(res)
2263
2305
 
@@ -2273,6 +2315,7 @@ class AppsAPI:
2273
2315
  """
2274
2316
 
2275
2317
  headers = {'Accept': 'application/json', }
2318
+
2276
2319
  res = self._api.do('DELETE', f'/api/2.0/preview/apps/instances/{name}', headers=headers)
2277
2320
  return DeleteAppResponse.from_dict(res)
2278
2321
 
@@ -2288,6 +2331,7 @@ class AppsAPI:
2288
2331
  """
2289
2332
 
2290
2333
  headers = {'Accept': 'application/json', }
2334
+
2291
2335
  res = self._api.do('GET', f'/api/2.0/preview/apps/instances/{name}', headers=headers)
2292
2336
  return GetAppResponse.from_dict(res)
2293
2337
 
@@ -2310,6 +2354,7 @@ class AppsAPI:
2310
2354
  query = {}
2311
2355
  if include_app_log is not None: query['include_app_log'] = include_app_log
2312
2356
  headers = {'Accept': 'application/json', }
2357
+
2313
2358
  res = self._api.do('GET',
2314
2359
  f'/api/2.0/preview/apps/deployments/{deployment_id}',
2315
2360
  query=query,
@@ -2325,6 +2370,7 @@ class AppsAPI:
2325
2370
  """
2326
2371
 
2327
2372
  headers = {'Accept': 'application/json', }
2373
+
2328
2374
  res = self._api.do('GET', '/api/2.0/preview/apps/instances', headers=headers)
2329
2375
  return ListAppsResponse.from_dict(res)
2330
2376
 
@@ -2340,6 +2386,7 @@ class AppsAPI:
2340
2386
  """
2341
2387
 
2342
2388
  headers = {'Accept': 'application/json', }
2389
+
2343
2390
  res = self._api.do('GET', f'/api/2.0/preview/apps/{name}/events', headers=headers)
2344
2391
  return ListAppEventsResponse.from_dict(res)
2345
2392
 
@@ -2405,6 +2452,7 @@ class ServingEndpointsAPI:
2405
2452
  """
2406
2453
 
2407
2454
  headers = {'Accept': 'application/json', }
2455
+
2408
2456
  res = self._api.do('GET',
2409
2457
  f'/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/build-logs',
2410
2458
  headers=headers)
@@ -2439,6 +2487,7 @@ class ServingEndpointsAPI:
2439
2487
  if rate_limits is not None: body['rate_limits'] = [v.as_dict() for v in rate_limits]
2440
2488
  if tags is not None: body['tags'] = [v.as_dict() for v in tags]
2441
2489
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2490
+
2442
2491
  op_response = self._api.do('POST', '/api/2.0/serving-endpoints', body=body, headers=headers)
2443
2492
  return Wait(self.wait_get_serving_endpoint_not_updating,
2444
2493
  response=ServingEndpointDetailed.from_dict(op_response),
@@ -2465,6 +2514,7 @@ class ServingEndpointsAPI:
2465
2514
  """
2466
2515
 
2467
2516
  headers = {'Accept': 'application/json', }
2517
+
2468
2518
  self._api.do('DELETE', f'/api/2.0/serving-endpoints/{name}', headers=headers)
2469
2519
 
2470
2520
  def export_metrics(self, name: str):
@@ -2480,6 +2530,7 @@ class ServingEndpointsAPI:
2480
2530
  """
2481
2531
 
2482
2532
  headers = {}
2533
+
2483
2534
  self._api.do('GET', f'/api/2.0/serving-endpoints/{name}/metrics', headers=headers)
2484
2535
 
2485
2536
  def get(self, name: str) -> ServingEndpointDetailed:
@@ -2494,6 +2545,7 @@ class ServingEndpointsAPI:
2494
2545
  """
2495
2546
 
2496
2547
  headers = {'Accept': 'application/json', }
2548
+
2497
2549
  res = self._api.do('GET', f'/api/2.0/serving-endpoints/{name}', headers=headers)
2498
2550
  return ServingEndpointDetailed.from_dict(res)
2499
2551
 
@@ -2509,6 +2561,7 @@ class ServingEndpointsAPI:
2509
2561
  """
2510
2562
 
2511
2563
  headers = {'Accept': 'application/json', }
2564
+
2512
2565
  res = self._api.do('GET',
2513
2566
  f'/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}/permissionLevels',
2514
2567
  headers=headers)
@@ -2527,6 +2580,7 @@ class ServingEndpointsAPI:
2527
2580
  """
2528
2581
 
2529
2582
  headers = {'Accept': 'application/json', }
2583
+
2530
2584
  res = self._api.do('GET',
2531
2585
  f'/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}',
2532
2586
  headers=headers)
@@ -2539,6 +2593,7 @@ class ServingEndpointsAPI:
2539
2593
  """
2540
2594
 
2541
2595
  headers = {'Accept': 'application/json', }
2596
+
2542
2597
  json = self._api.do('GET', '/api/2.0/serving-endpoints', headers=headers)
2543
2598
  parsed = ListEndpointsResponse.from_dict(json).endpoints
2544
2599
  return parsed if parsed is not None else []
@@ -2557,6 +2612,7 @@ class ServingEndpointsAPI:
2557
2612
  """
2558
2613
 
2559
2614
  headers = {'Accept': 'application/json', }
2615
+
2560
2616
  res = self._api.do('GET',
2561
2617
  f'/api/2.0/serving-endpoints/{name}/served-models/{served_model_name}/logs',
2562
2618
  headers=headers)
@@ -2584,6 +2640,7 @@ class ServingEndpointsAPI:
2584
2640
  if add_tags is not None: body['add_tags'] = [v.as_dict() for v in add_tags]
2585
2641
  if delete_tags is not None: body['delete_tags'] = [v for v in delete_tags]
2586
2642
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2643
+
2587
2644
  res = self._api.do('PATCH', f'/api/2.0/serving-endpoints/{name}/tags', body=body, headers=headers)
2588
2645
  return [EndpointTag.from_dict(v) for v in res]
2589
2646
 
@@ -2603,6 +2660,7 @@ class ServingEndpointsAPI:
2603
2660
  body = {}
2604
2661
  if rate_limits is not None: body['rate_limits'] = [v.as_dict() for v in rate_limits]
2605
2662
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2663
+
2606
2664
  res = self._api.do('PUT',
2607
2665
  f'/api/2.0/serving-endpoints/{name}/rate-limits',
2608
2666
  body=body,
@@ -2688,7 +2746,12 @@ class ServingEndpointsAPI:
2688
2746
  if stream is not None: body['stream'] = stream
2689
2747
  if temperature is not None: body['temperature'] = temperature
2690
2748
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2691
- res = self._api.do('POST', f'/serving-endpoints/{name}/invocations', body=body, headers=headers)
2749
+ response_headers = ['served-model-name', ]
2750
+ res = self._api.do('POST',
2751
+ f'/serving-endpoints/{name}/invocations',
2752
+ body=body,
2753
+ headers=headers,
2754
+ response_headers=response_headers)
2692
2755
  return QueryEndpointResponse.from_dict(res)
2693
2756
 
2694
2757
  def set_permissions(
@@ -2712,6 +2775,7 @@ class ServingEndpointsAPI:
2712
2775
  if access_control_list is not None:
2713
2776
  body['access_control_list'] = [v.as_dict() for v in access_control_list]
2714
2777
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2778
+
2715
2779
  res = self._api.do('PUT',
2716
2780
  f'/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}',
2717
2781
  body=body,
@@ -2754,6 +2818,7 @@ class ServingEndpointsAPI:
2754
2818
  if served_models is not None: body['served_models'] = [v.as_dict() for v in served_models]
2755
2819
  if traffic_config is not None: body['traffic_config'] = traffic_config.as_dict()
2756
2820
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2821
+
2757
2822
  op_response = self._api.do('PUT',
2758
2823
  f'/api/2.0/serving-endpoints/{name}/config',
2759
2824
  body=body,
@@ -2798,6 +2863,7 @@ class ServingEndpointsAPI:
2798
2863
  if access_control_list is not None:
2799
2864
  body['access_control_list'] = [v.as_dict() for v in access_control_list]
2800
2865
  headers = {'Accept': 'application/json', 'Content-Type': 'application/json', }
2866
+
2801
2867
  res = self._api.do('PATCH',
2802
2868
  f'/api/2.0/permissions/serving-endpoints/{serving_endpoint_id}',
2803
2869
  body=body,