mostlyai 0.3.13__tar.gz → 0.4.1__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.1
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.1" # 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-18T15:56:08+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
 
@@ -501,12 +506,28 @@ class Accuracy(CustomBaseModel):
501
506
 
502
507
 
503
508
  class Distances(CustomBaseModel):
509
+ dcr_training: Annotated[
510
+ Optional[float],
511
+ Field(
512
+ None,
513
+ alias="dcrTraining",
514
+ description="The average DCR between the synthetic and the training records.",
515
+ ),
516
+ ] = None
517
+ dcr_holdout: Annotated[
518
+ Optional[float],
519
+ Field(
520
+ None,
521
+ alias="dcrHoldout",
522
+ description="The average DCR between the synthetic and the holdout records.",
523
+ ),
524
+ ] = None
504
525
  dcr_original: Annotated[
505
526
  Optional[float],
506
527
  Field(
507
528
  None,
508
529
  alias="dcrOriginal",
509
- description="The average DCR between the original records.",
530
+ description="(DEPRECATED) The average DCR between the original records.",
510
531
  ),
511
532
  ] = None
512
533
  dcr_synthetic: Annotated[
@@ -514,7 +535,7 @@ class Distances(CustomBaseModel):
514
535
  Field(
515
536
  None,
516
537
  alias="dcrSynthetic",
517
- description="The average DCR between the synthetic and the original records.",
538
+ description="(DEPRECATED) The average DCR between the synthetic and the original records.",
518
539
  ),
519
540
  ] = None
520
541
 
@@ -803,6 +824,10 @@ class AssistantThreadSessionStatus(str, Enum):
803
824
  expired = "expired"
804
825
 
805
826
 
827
+ class AssistantTokenUsage(RootModel[float]):
828
+ root: float
829
+
830
+
806
831
  class AssistantMessageRole(str, Enum):
807
832
  """
808
833
  The role of the author of this message
@@ -812,6 +837,7 @@ class AssistantMessageRole(str, Enum):
812
837
  user = "user"
813
838
  assistant = "assistant"
814
839
  tool = "tool"
840
+ heartbeat = "heartbeat"
815
841
 
816
842
 
817
843
  class AssistantMessageContentType(str, Enum):
@@ -853,6 +879,14 @@ class AssistantMessage(CustomBaseModel):
853
879
  finish_reason: Annotated[
854
880
  Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
855
881
  ] = None
882
+ tokens_consumed: Annotated[
883
+ Optional[float],
884
+ Field(
885
+ None,
886
+ alias="tokensConsumed",
887
+ description="The number of tokens consumed by the assistant message.",
888
+ ),
889
+ ] = None
856
890
 
857
891
 
858
892
  class AssistantMessageDelta(CustomBaseModel):
@@ -880,6 +914,14 @@ class AssistantMessageDelta(CustomBaseModel):
880
914
  finish_reason: Annotated[
881
915
  Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
882
916
  ] = None
917
+ tokens_consumed: Annotated[
918
+ Optional[float],
919
+ Field(
920
+ None,
921
+ alias="tokensConsumed",
922
+ description="The number of tokens consumed by the model.",
923
+ ),
924
+ ] = None
883
925
 
884
926
 
885
927
  class AssistantThreadUsage(CustomBaseModel):
@@ -891,6 +933,14 @@ class AssistantThreadUsage(CustomBaseModel):
891
933
  description="Number of shares of this assistant thread.",
892
934
  ),
893
935
  ] = None
936
+ total_tokens_consumed: Annotated[
937
+ Optional[float],
938
+ Field(
939
+ None,
940
+ alias="totalTokensConsumed",
941
+ description="The total number of tokens consumed by the thread.",
942
+ ),
943
+ ] = None
894
944
 
895
945
 
896
946
  class ComputeResources(CustomBaseModel):
@@ -930,22 +980,6 @@ class Compute(CustomBaseModel):
930
980
  ),
931
981
  ] = None
932
982
 
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
983
 
950
984
  class UsageReportPeriod(CustomBaseModel):
951
985
  """
@@ -1076,6 +1110,23 @@ class ModelConfiguration(CustomBaseModel):
1076
1110
  The training configuration for a AI model
1077
1111
  """
1078
1112
 
1113
+ model: Annotated[
1114
+ Optional[str],
1115
+ Field(
1116
+ None,
1117
+ description="The model to be used for training.",
1118
+ examples=[
1119
+ [
1120
+ "MOSTLY_AI/Small",
1121
+ "MOSTLY_AI/Medium",
1122
+ "MOSTLY_AI/Large",
1123
+ "MOSTLY_AI/LSTMFromScratch-3m",
1124
+ "microsoft/phi-1_5",
1125
+ "Locutusque/TinyMistral-248M",
1126
+ ]
1127
+ ],
1128
+ ),
1129
+ ] = None
1079
1130
  max_sample_size: Annotated[
1080
1131
  Optional[int],
1081
1132
  Field(
@@ -1096,14 +1147,6 @@ class ModelConfiguration(CustomBaseModel):
1096
1147
  le=1000000,
1097
1148
  ),
1098
1149
  ] = 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
1150
  max_training_time: Annotated[
1108
1151
  Optional[int],
1109
1152
  Field(
@@ -1129,7 +1172,7 @@ class ModelConfiguration(CustomBaseModel):
1129
1172
  Field(
1130
1173
  100,
1131
1174
  alias="maxSequenceWindow",
1132
- description="The maximum sequence window to consider for training.",
1175
+ description="The maximum sequence window to consider for training.\nOnly applicable for TABULAR models.\n",
1133
1176
  ge=1,
1134
1177
  le=100000,
1135
1178
  ),
@@ -1139,7 +1182,7 @@ class ModelConfiguration(CustomBaseModel):
1139
1182
  Field(
1140
1183
  True,
1141
1184
  alias="enableFlexibleGeneration",
1142
- description="If true, then the trained generator can be used for rebalancing and imputation.\n",
1185
+ description="If true, then the trained generator can be used for rebalancing and imputation.\nOnly applicable for TABULAR models.\n",
1143
1186
  ),
1144
1187
  ] = True
1145
1188
  value_protection: Annotated[
@@ -1155,7 +1198,7 @@ class ModelConfiguration(CustomBaseModel):
1155
1198
  Field(
1156
1199
  "CONSTANT",
1157
1200
  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",
1201
+ 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
1202
  ),
1160
1203
  ] = "CONSTANT"
1161
1204
  compute: Optional[str] = None
@@ -1168,10 +1211,11 @@ class ProgressStep(CustomBaseModel):
1168
1211
  Field(
1169
1212
  None,
1170
1213
  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"]],
1214
+ 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",
1215
+ examples=[["census:tabular", "census:language"]],
1173
1216
  ),
1174
1217
  ] = None
1218
+ compute_name: Annotated[Optional[str], Field(None, alias="computeName")] = None
1175
1219
  step_code: Annotated[Optional[StepCode], Field(None, alias="stepCode")] = None
1176
1220
  start_date: Annotated[
1177
1221
  Optional[AwareDatetime],
@@ -1192,6 +1236,7 @@ class ProgressStep(CustomBaseModel):
1192
1236
  ),
1193
1237
  ] = None
1194
1238
  messages: Optional[List[Dict[str, Any]]] = None
1239
+ error_message: Annotated[Optional[str], Field(None, alias="errorMessage")] = None
1195
1240
  progress: Optional[ProgressValue] = None
1196
1241
  status: Optional[ProgressStatus] = None
1197
1242
 
@@ -1283,6 +1328,9 @@ class SyntheticTable(CustomBaseModel):
1283
1328
  model_metrics: Annotated[
1284
1329
  Optional[ModelMetrics], Field(None, alias="modelMetrics")
1285
1330
  ] = None
1331
+ language_model_metrics: Annotated[
1332
+ Optional[ModelMetrics], Field(None, alias="languageModelMetrics")
1333
+ ] = None
1286
1334
  foreign_keys: Annotated[
1287
1335
  Optional[List[ForeignKey]],
1288
1336
  Field(None, alias="foreignKeys", description="The foreign keys of this table."),
@@ -1384,11 +1432,14 @@ class SourceTable(CustomBaseModel):
1384
1432
  model_metrics: Annotated[
1385
1433
  Optional[ModelMetrics], Field(None, alias="modelMetrics")
1386
1434
  ] = None
1435
+ language_model_metrics: Annotated[
1436
+ Optional[ModelMetrics], Field(None, alias="languageModelMetrics")
1437
+ ] = None
1387
1438
  model_configuration: Annotated[
1388
1439
  Optional[ModelConfiguration], Field(None, alias="modelConfiguration")
1389
1440
  ] = None
1390
- text_model_configuration: Annotated[
1391
- Optional[ModelConfiguration], Field(None, alias="textModelConfiguration")
1441
+ language_model_configuration: Annotated[
1442
+ Optional[ModelConfiguration], Field(None, alias="languageModelConfiguration")
1392
1443
  ] = None
1393
1444
  total_rows: Annotated[
1394
1445
  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.1"
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