mostlyai 0.3.13__tar.gz → 0.4.0__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mostlyai
3
- Version: 0.3.13
3
+ Version: 0.4.0
4
4
  Summary: The official Python client for the MOSTLY AI platform.
5
5
  Home-page: https://app.mostly.ai/
6
6
  License: Proprietary
@@ -32,13 +32,13 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
32
32
  | Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
33
33
  | Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
34
34
  | Connect to any data source within your org | `mostly.connect(config)` |
35
+ | List the available models | `mostly.models(model_type)` |
36
+ | List the available computes | `mostly.computes()` |
35
37
  | Info about the current user | `mostly.me()` |
36
- | Info about the usage | `mostly.usage_report()` |
37
38
  | Info about the platform | `mostly.about()` |
38
39
 
39
40
 
40
41
 
41
-
42
42
  ## Installation
43
43
 
44
44
  ```shell
@@ -142,24 +142,17 @@ sd.shares()
142
142
  c.shares()
143
143
  ```
144
144
 
145
- ### Computes
146
-
145
+ ### Job Configuration Info
147
146
  ```python
148
- l = mostly.computes.list()
149
-
150
- cmp = mostly.computes.create(config)
151
- cmp = mostly.computes.get(id)
152
-
153
- cmp.update(config)
154
- cmp.delete()
147
+ mostly.models(model_type)
148
+ mostly.computes()
155
149
  ```
156
150
 
157
- ### Info
151
+ ### User Info
158
152
 
159
153
  ```python
160
154
  mostly.me()
161
- mostly.usage_report()
162
- mostly.usage_report(by_periods=True)
163
155
  mostly.about()
156
+
164
157
  ```
165
158
 
@@ -10,13 +10,13 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
10
10
  | Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
11
11
  | Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
12
12
  | Connect to any data source within your org | `mostly.connect(config)` |
13
+ | List the available models | `mostly.models(model_type)` |
14
+ | List the available computes | `mostly.computes()` |
13
15
  | Info about the current user | `mostly.me()` |
14
- | Info about the usage | `mostly.usage_report()` |
15
16
  | Info about the platform | `mostly.about()` |
16
17
 
17
18
 
18
19
 
19
-
20
20
  ## Installation
21
21
 
22
22
  ```shell
@@ -120,23 +120,16 @@ sd.shares()
120
120
  c.shares()
121
121
  ```
122
122
 
123
- ### Computes
124
-
123
+ ### Job Configuration Info
125
124
  ```python
126
- l = mostly.computes.list()
127
-
128
- cmp = mostly.computes.create(config)
129
- cmp = mostly.computes.get(id)
130
-
131
- cmp.update(config)
132
- cmp.delete()
125
+ mostly.models(model_type)
126
+ mostly.computes()
133
127
  ```
134
128
 
135
- ### Info
129
+ ### User Info
136
130
 
137
131
  ```python
138
132
  mostly.me()
139
- mostly.usage_report()
140
- mostly.usage_report(by_periods=True)
141
133
  mostly.about()
134
+
142
135
  ```
@@ -0,0 +1,4 @@
1
+ from mostlyai.api import MostlyAI
2
+
3
+ __all__ = ["MostlyAI"]
4
+ __version__ = "0.4.0" # Do not set this manually. Use poetry version [params].
@@ -1,5 +1,3 @@
1
- import io
2
- import json
3
1
  from pathlib import Path
4
2
  from typing import Any, Optional, Union, Literal
5
3
 
@@ -7,7 +5,6 @@ import pandas as pd
7
5
  import rich
8
6
 
9
7
  from mostlyai.base import GET, _MostlyBaseClient
10
- from mostlyai.computes import _MostlyComputesClient
11
8
  from mostlyai.connectors import _MostlyConnectorsClient
12
9
  from mostlyai.generators import _MostlyGeneratorsClient
13
10
  from mostlyai.model import (
@@ -17,6 +14,7 @@ from mostlyai.model import (
17
14
  PermissionLevel,
18
15
  ProgressStatus,
19
16
  SyntheticDataset,
17
+ ModelType,
20
18
  )
21
19
  from mostlyai.shares import _MostlySharesClient
22
20
  from mostlyai.synthetic_datasets import (
@@ -62,7 +60,6 @@ class MostlyAI(_MostlyBaseClient):
62
60
  self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
63
61
  self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
64
62
  self.shares = _MostlySharesClient(**client_kwargs)
65
- self.computes = _MostlyComputesClient(**client_kwargs)
66
63
 
67
64
  def connect(self, config: dict[str, Any]) -> Connector:
68
65
  """
@@ -379,24 +376,6 @@ class MostlyAI(_MostlyBaseClient):
379
376
  """
380
377
  return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
381
378
 
382
- def usage_report(self, by_periods: bool = False) -> pd.DataFrame:
383
- """
384
- Retrieve usage report as a pd.DataFrame.
385
-
386
- :param by_periods: if True, by periods. Otherwise, the overall usage report.
387
- :return: summary of the usage (either by periods or overall)
388
- """
389
- headers = {"Accept": "*/*"} # Accept any content type
390
- path = ["usage-report"] + (["periods"] if by_periods else ["download"])
391
- response = self.request(verb=GET, headers=headers, path=path, raw_response=True)
392
- if by_periods:
393
- data = json.loads(response.content.decode("utf-8"))["usage"]
394
- df = pd.DataFrame(data)
395
- else:
396
- csv_file = io.BytesIO(response.content)
397
- df = pd.read_csv(csv_file)
398
- return df
399
-
400
379
  def about(self) -> dict[str, Any]:
401
380
  """
402
381
  Retrieve about info from the endpoint.
@@ -404,3 +383,11 @@ class MostlyAI(_MostlyBaseClient):
404
383
  :return: info about the platform.
405
384
  """
406
385
  return self.request(verb=GET, path=["about"])
386
+
387
+ def models(self, model_type: Union[str, ModelType]) -> list[str]:
388
+ if isinstance(model_type, ModelType):
389
+ model_type = model_type.value
390
+ return self.request(verb=GET, path=["models", model_type])
391
+
392
+ def computes(self) -> list[dict[str, Any]]:
393
+ return self.request(verb=GET, path=["computes"])
@@ -210,7 +210,7 @@ class CustomBaseModel(BaseModel):
210
210
  # Use rich.print to create a rich representation of the model
211
211
  console = Console()
212
212
  with console.capture() as capture:
213
- rich.print(self.dict())
213
+ rich.print(self.model_dump())
214
214
  return capture.get()
215
215
 
216
216
  def open(self) -> str:
@@ -7,7 +7,11 @@ import pandas as pd
7
7
  from mostlyai.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
8
8
  from mostlyai.model import Generator, JobProgress
9
9
  from mostlyai.shares import _MostlySharesMixin
10
- from mostlyai.utils import _convert_to_base64, _job_wait, _read_table_from_path
10
+ from mostlyai.utils import (
11
+ _convert_to_base64,
12
+ _job_wait,
13
+ _read_table_from_path,
14
+ )
11
15
 
12
16
 
13
17
  class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
@@ -56,10 +60,10 @@ class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
56
60
  return response
57
61
 
58
62
  def create(self, config: dict) -> Generator:
59
- # convert `data` to base64-encoded Parquet files
60
- if "tables" in config and config["tables"]:
63
+ if config.get("tables"):
61
64
  for table in config["tables"]:
62
- if "data" in table and table["data"] is not None:
65
+ # convert `data` to base64-encoded Parquet files
66
+ if table.get("data") is not None:
63
67
  if isinstance(table["data"], (str, Path)):
64
68
  name, df = _read_table_from_path(table["data"])
65
69
  table["data"] = _convert_to_base64(df)
@@ -70,15 +74,12 @@ class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
70
74
  table["data"] = _convert_to_base64(table["data"])
71
75
  else:
72
76
  raise ValueError("data must be a DataFrame or a file path")
73
- # convert `columns` to list[dict], if provided as list[str]
74
- if "tables" in config and config["tables"]:
75
- for table in config["tables"]:
76
- if "columns" in table and table["columns"]:
77
+ if table.get("columns"):
78
+ # convert `columns` to list[dict], if provided as list[str]
77
79
  table["columns"] = [
78
80
  {"name": col} if isinstance(col, str) else col
79
81
  for col in table["columns"]
80
82
  ]
81
-
82
83
  generator = self.request(
83
84
  verb=POST, path=[], json=config, response_type=Generator
84
85
  )
@@ -1,5 +1,5 @@
1
1
  # generated by datamodel-codegen:
2
- # timestamp: 2024-08-16T09:29:18+00:00
2
+ # timestamp: 2024-09-04T22:33:57+00:00
3
3
 
4
4
  from __future__ import annotations
5
5
 
@@ -142,22 +142,35 @@ class PaginatedTotalCount(RootModel[int]):
142
142
  class ModelEncodingType(str, Enum):
143
143
  """
144
144
  The encoding type used for model training and data generation.
145
- This property is only relevant if generation method is AI_MODEL.
146
145
  - AUTO: Model chooses among available encoding types based on the column's data type.
147
- - CATEGORICAL: Model samples from existing (non-rare) categories.
148
- - NUMERIC_AUTO: Model chooses among 3 numeric encoding types based on the values.
149
- - NUMERIC_DISCRETE: Model samples from existing discrete numerical values.
150
- - NUMERIC_BINNED: Model samples from binned buckets, to then sample randomly within a bucket.
151
- - NUMERIC_DIGIT: Model samples each digit of a numerical value.
152
- - CHARACTER: Model samples each character of a string value.
153
- - DATETIME: Model samples each part of a datetime value.
154
- - DATETIME_RELATIVE: Model samples the relative difference between datetimes within a sequence.
155
- - LAT_LONG: Model samples a latitude-longitude column. The format is "latitude,longitude".
156
- - TEXT_MODEL: Model will train a distinct TEXT model for this column.
146
+ - TABULAR_CATEGORICAL: Model samples from existing (non-rare) categories.
147
+ - TABULAR_NUMERIC_AUTO: Model chooses among 3 numeric encoding types based on the values.
148
+ - TABULAR_NUMERIC_DISCRETE: Model samples from existing discrete numerical values.
149
+ - TABULAR_NUMERIC_BINNED: Model samples from binned buckets, to then sample randomly within a bucket.
150
+ - TABULAR_NUMERIC_DIGIT: Model samples each digit of a numerical value.
151
+ - TABULAR_CHARACTER: Model samples each character of a string value.
152
+ - TABULAR_DATETIME: Model samples each part of a datetime value.
153
+ - TABULAR_DATETIME_RELATIVE: Model samples the relative difference between datetimes within a sequence.
154
+ - TABULAR_LAT_LONG: Model samples a latitude-longitude column. The format is "latitude,longitude".
155
+ - LANGUAGE_TEXT: Model will train a distinct LANGUAGE model for this column, to then generate free text.
156
+ # - LANGUAGE_NUMERIC
157
+ # - LANGUAGE_CATEGORICAL
158
+ # - LANGUAGE_DATETIME
159
+ Encoding types, that are not being prefixed with either TABULAR or LANGUAGE have been deprecated.
157
160
 
158
161
  """
159
162
 
160
163
  auto = "AUTO"
164
+ tabular_categorical = "TABULAR_CATEGORICAL"
165
+ tabular_numeric_auto = "TABULAR_NUMERIC_AUTO"
166
+ tabular_numeric_discrete = "TABULAR_NUMERIC_DISCRETE"
167
+ tabular_numeric_binned = "TABULAR_NUMERIC_BINNED"
168
+ tabular_numeric_digit = "TABULAR_NUMERIC_DIGIT"
169
+ tabular_character = "TABULAR_CHARACTER"
170
+ tabular_datetime = "TABULAR_DATETIME"
171
+ tabular_datetime_relative = "TABULAR_DATETIME_RELATIVE"
172
+ tabular_lat_long = "TABULAR_LAT_LONG"
173
+ language_text = "LANGUAGE_TEXT"
161
174
  categorical = "CATEGORICAL"
162
175
  numeric_auto = "NUMERIC_AUTO"
163
176
  numeric_discrete = "NUMERIC_DISCRETE"
@@ -167,7 +180,6 @@ class ModelEncodingType(str, Enum):
167
180
  datetime = "DATETIME"
168
181
  datetime_relative = "DATETIME_RELATIVE"
169
182
  lat_long = "LAT_LONG"
170
- text_model = "TEXT_MODEL"
171
183
 
172
184
 
173
185
  class ConnectorAccessType(str, Enum):
@@ -440,23 +452,16 @@ class SourceForeignKey(CustomBaseModel):
440
452
  ]
441
453
 
442
454
 
443
- class ModelSize(str, Enum):
444
- """
445
- The size of the model, with the default being M(edium).
446
- Choose S(mall) for faster training, or L(arge) for better results for large dataset.
447
- Note, that larger model sizes will require more memory and more compute.
448
-
449
- """
450
-
451
- s = "S"
452
- m = "M"
453
- l = "L"
455
+ class ModelType(str, Enum):
456
+ tabular = "TABULAR"
457
+ language = "LANGUAGE"
454
458
 
455
459
 
456
460
  class RareCategoryReplacementMethod(str, Enum):
457
461
  """
458
462
  Specifies, if the rare categories for categoricals will be replaced by a constant
459
463
  _RARE_ or by a sample from non-rare categories.
464
+ Only applicable if valueProtection is set to True.
460
465
 
461
466
  """
462
467
 
@@ -803,6 +808,10 @@ class AssistantThreadSessionStatus(str, Enum):
803
808
  expired = "expired"
804
809
 
805
810
 
811
+ class AssistantTokenUsage(RootModel[float]):
812
+ root: float
813
+
814
+
806
815
  class AssistantMessageRole(str, Enum):
807
816
  """
808
817
  The role of the author of this message
@@ -812,6 +821,7 @@ class AssistantMessageRole(str, Enum):
812
821
  user = "user"
813
822
  assistant = "assistant"
814
823
  tool = "tool"
824
+ heartbeat = "heartbeat"
815
825
 
816
826
 
817
827
  class AssistantMessageContentType(str, Enum):
@@ -853,6 +863,14 @@ class AssistantMessage(CustomBaseModel):
853
863
  finish_reason: Annotated[
854
864
  Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
855
865
  ] = None
866
+ tokens_consumed: Annotated[
867
+ Optional[float],
868
+ Field(
869
+ None,
870
+ alias="tokensConsumed",
871
+ description="The number of tokens consumed by the assistant message.",
872
+ ),
873
+ ] = None
856
874
 
857
875
 
858
876
  class AssistantMessageDelta(CustomBaseModel):
@@ -880,6 +898,14 @@ class AssistantMessageDelta(CustomBaseModel):
880
898
  finish_reason: Annotated[
881
899
  Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
882
900
  ] = None
901
+ tokens_consumed: Annotated[
902
+ Optional[float],
903
+ Field(
904
+ None,
905
+ alias="tokensConsumed",
906
+ description="The number of tokens consumed by the model.",
907
+ ),
908
+ ] = None
883
909
 
884
910
 
885
911
  class AssistantThreadUsage(CustomBaseModel):
@@ -891,6 +917,14 @@ class AssistantThreadUsage(CustomBaseModel):
891
917
  description="Number of shares of this assistant thread.",
892
918
  ),
893
919
  ] = None
920
+ total_tokens_consumed: Annotated[
921
+ Optional[float],
922
+ Field(
923
+ None,
924
+ alias="totalTokensConsumed",
925
+ description="The total number of tokens consumed by the thread.",
926
+ ),
927
+ ] = None
894
928
 
895
929
 
896
930
  class ComputeResources(CustomBaseModel):
@@ -930,22 +964,6 @@ class Compute(CustomBaseModel):
930
964
  ),
931
965
  ] = None
932
966
 
933
- def update(self, config) -> "Compute":
934
- """
935
- Update a compute. Only accessible for SuperAdmins.
936
-
937
- For the structure of the config and secrets, see the CREATE method.
938
-
939
- :return: The updated compute
940
- """
941
- return self.client._update(compute_id=self.id, config=config)
942
-
943
- def delete(self):
944
- """
945
- Delete compute. Only accessible for SuperAdmins.
946
- """
947
- return self.client._delete(compute_id=self.id)
948
-
949
967
 
950
968
  class UsageReportPeriod(CustomBaseModel):
951
969
  """
@@ -1076,6 +1094,23 @@ class ModelConfiguration(CustomBaseModel):
1076
1094
  The training configuration for a AI model
1077
1095
  """
1078
1096
 
1097
+ model: Annotated[
1098
+ Optional[str],
1099
+ Field(
1100
+ None,
1101
+ description="The model to be used for training.",
1102
+ examples=[
1103
+ [
1104
+ "MOSTLY_AI/Small",
1105
+ "MOSTLY_AI/Medium",
1106
+ "MOSTLY_AI/Large",
1107
+ "MOSTLY_AI/LSTMFromScratch-3m",
1108
+ "microsoft/phi-1_5",
1109
+ "Locutusque/TinyMistral-248M",
1110
+ ]
1111
+ ],
1112
+ ),
1113
+ ] = None
1079
1114
  max_sample_size: Annotated[
1080
1115
  Optional[int],
1081
1116
  Field(
@@ -1096,14 +1131,6 @@ class ModelConfiguration(CustomBaseModel):
1096
1131
  le=1000000,
1097
1132
  ),
1098
1133
  ] = None
1099
- model_size: Annotated[
1100
- Optional[ModelSize],
1101
- Field(
1102
- "M",
1103
- alias="modelSize",
1104
- description="The size of the model, with the default being M(edium).\nChoose S(mall) for faster training, or L(arge) for better results for large dataset.\nNote, that larger model sizes will require more memory and more compute.\n",
1105
- ),
1106
- ] = "M"
1107
1134
  max_training_time: Annotated[
1108
1135
  Optional[int],
1109
1136
  Field(
@@ -1129,7 +1156,7 @@ class ModelConfiguration(CustomBaseModel):
1129
1156
  Field(
1130
1157
  100,
1131
1158
  alias="maxSequenceWindow",
1132
- description="The maximum sequence window to consider for training.",
1159
+ description="The maximum sequence window to consider for training.\nOnly applicable for TABULAR models.\n",
1133
1160
  ge=1,
1134
1161
  le=100000,
1135
1162
  ),
@@ -1139,7 +1166,7 @@ class ModelConfiguration(CustomBaseModel):
1139
1166
  Field(
1140
1167
  True,
1141
1168
  alias="enableFlexibleGeneration",
1142
- description="If true, then the trained generator can be used for rebalancing and imputation.\n",
1169
+ description="If true, then the trained generator can be used for rebalancing and imputation.\nOnly applicable for TABULAR models.\n",
1143
1170
  ),
1144
1171
  ] = True
1145
1172
  value_protection: Annotated[
@@ -1155,7 +1182,7 @@ class ModelConfiguration(CustomBaseModel):
1155
1182
  Field(
1156
1183
  "CONSTANT",
1157
1184
  alias="rareCategoryReplacementMethod",
1158
- description="Specifies, if the rare categories for categoricals will be replaced by a constant\n_RARE_ or by a sample from non-rare categories.\n",
1185
+ description="Specifies, if the rare categories for categoricals will be replaced by a constant\n_RARE_ or by a sample from non-rare categories.\nOnly applicable if valueProtection is set to True.\n",
1159
1186
  ),
1160
1187
  ] = "CONSTANT"
1161
1188
  compute: Optional[str] = None
@@ -1168,8 +1195,8 @@ class ProgressStep(CustomBaseModel):
1168
1195
  Field(
1169
1196
  None,
1170
1197
  alias="modelLabel",
1171
- description="The unique label for the model, consisting of table name and an optional suffix for text model.\nThis will be empty for steps that are not related to a model.\n",
1172
- examples=[["census", "census:text"]],
1198
+ description="The unique label for the model, consisting of table name and a suffix for the model type.\nThis will be empty for steps that are not related to a model.\n",
1199
+ examples=[["census:tabular", "census:language"]],
1173
1200
  ),
1174
1201
  ] = None
1175
1202
  step_code: Annotated[Optional[StepCode], Field(None, alias="stepCode")] = None
@@ -1192,6 +1219,7 @@ class ProgressStep(CustomBaseModel):
1192
1219
  ),
1193
1220
  ] = None
1194
1221
  messages: Optional[List[Dict[str, Any]]] = None
1222
+ error_message: Annotated[Optional[str], Field(None, alias="errorMessage")] = None
1195
1223
  progress: Optional[ProgressValue] = None
1196
1224
  status: Optional[ProgressStatus] = None
1197
1225
 
@@ -1384,11 +1412,14 @@ class SourceTable(CustomBaseModel):
1384
1412
  model_metrics: Annotated[
1385
1413
  Optional[ModelMetrics], Field(None, alias="modelMetrics")
1386
1414
  ] = None
1415
+ language_model_metrics: Annotated[
1416
+ Optional[ModelMetrics], Field(None, alias="languageModelMetrics")
1417
+ ] = None
1387
1418
  model_configuration: Annotated[
1388
1419
  Optional[ModelConfiguration], Field(None, alias="modelConfiguration")
1389
1420
  ] = None
1390
- text_model_configuration: Annotated[
1391
- Optional[ModelConfiguration], Field(None, alias="textModelConfiguration")
1421
+ language_model_configuration: Annotated[
1422
+ Optional[ModelConfiguration], Field(None, alias="languageModelConfiguration")
1392
1423
  ] = None
1393
1424
  total_rows: Annotated[
1394
1425
  Optional[int],
@@ -1,6 +1,7 @@
1
1
  import base64
2
2
  import io
3
3
  import time
4
+ import warnings
4
5
  from pathlib import Path
5
6
  from typing import Callable, Union, Optional, Any, Literal
6
7
 
@@ -23,6 +24,8 @@ from mostlyai.model import (
23
24
  SyntheticDataset,
24
25
  )
25
26
 
27
+ warnings.simplefilter("always", DeprecationWarning)
28
+
26
29
 
27
30
  def _job_wait(
28
31
  get_progress: Callable,
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "mostlyai"
3
- version = "0.3.13"
3
+ version = "0.4.0"
4
4
  description = "The official Python client for the MOSTLY AI platform."
5
5
  homepage = "https://app.mostly.ai/"
6
6
  authors = ["MOSTLY AI <office@mostly.ai>"]
@@ -1,4 +0,0 @@
1
- from mostlyai.api import MostlyAI
2
-
3
- __all__ = ["MostlyAI"]
4
- __version__ = "0.3.13" # Do not set this manually. Use poetry version [params].
@@ -1,72 +0,0 @@
1
- from typing import Any
2
-
3
- from mostlyai.base import DELETE, GET, POST, _MostlyBaseClient, PATCH
4
- from mostlyai.model import (
5
- Compute,
6
- )
7
-
8
-
9
- class _MostlyComputesClient(_MostlyBaseClient):
10
- SECTION = ["computes"]
11
-
12
- # PUBLIC METHODS #
13
-
14
- def list(self) -> list[Compute]:
15
- """
16
- List the available computes, sorted by order index. The first returned compute is the default compute.
17
-
18
- :return: List the available computes
19
- """
20
- response = self.request(verb=GET, path=[])
21
- response = [Compute(**compute) for compute in response]
22
- return response
23
-
24
- def create(
25
- self,
26
- config: dict[str, Any],
27
- ) -> Compute:
28
- """
29
- Create a compute. Only accessible for SuperAdmins.
30
- The structures of the config and secrets parameters depend on the compute type.
31
- ```yaml
32
- - type: KUBERNETES
33
- config:
34
- toleration: string
35
- - type: DATABRICKS
36
- config:
37
- instanceURL: string
38
- clusterID: string
39
- secrets:
40
- token: string
41
- ```
42
- """
43
- response = self.request(verb=POST, path=[], json=config, response_type=Compute)
44
- return response
45
-
46
- def get(self, compute_id: str) -> Compute:
47
- """
48
- Retrieve compute.
49
-
50
- :param compute_id: The unique identifier of a compute
51
- :return: The retrieved compute
52
- """
53
- response = self.request(verb=GET, path=[compute_id], response_type=Compute)
54
- return response
55
-
56
- # PRIVATE METHODS #
57
-
58
- def _update(
59
- self,
60
- compute_id: str,
61
- config: dict[str, Any],
62
- ) -> Compute:
63
- response = self.request(
64
- verb=PATCH,
65
- path=[compute_id],
66
- json=config,
67
- response_type=Compute,
68
- )
69
- return response
70
-
71
- def _delete(self, compute_id: str) -> None:
72
- self.request(verb=DELETE, path=[compute_id])
File without changes
File without changes