mostlyai 4.3.2__tar.gz → 4.3.4__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.
Files changed (85) hide show
  1. {mostlyai-4.3.2 → mostlyai-4.3.4}/PKG-INFO +30 -34
  2. {mostlyai-4.3.2 → mostlyai-4.3.4}/README.md +12 -24
  3. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/_utils.py +3 -1
  5. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/api.py +146 -85
  6. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/base.py +13 -13
  7. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/generators.py +50 -18
  8. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/domain.py +35 -44
  9. {mostlyai-4.3.2 → mostlyai-4.3.4}/pyproject.toml +25 -12
  10. {mostlyai-4.3.2 → mostlyai-4.3.4}/.gitignore +0 -0
  11. {mostlyai-4.3.2 → mostlyai-4.3.4}/LICENSE +0 -0
  12. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/__init__.py +0 -0
  13. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/auto_detect.py +0 -0
  14. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/base.py +0 -0
  15. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/context.py +0 -0
  16. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/conversions.py +0 -0
  17. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/__init__.py +0 -0
  18. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/base.py +0 -0
  19. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  20. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/databricks.py +0 -0
  21. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/hive.py +0 -0
  22. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/mssql.py +0 -0
  23. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/mysql.py +0 -0
  24. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/oracle.py +0 -0
  25. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  26. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  27. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  28. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  29. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/dtype.py +0 -0
  30. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/exceptions.py +0 -0
  31. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/__init__.py +0 -0
  32. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/base.py +0 -0
  33. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  34. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  35. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  36. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  37. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  38. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  39. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  40. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  41. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  42. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/table/json.py +0 -0
  43. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  44. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/file/utils.py +0 -0
  45. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/language_model.py +0 -0
  46. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  47. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/non_context.py +0 -0
  48. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/progress_callback.py +0 -0
  49. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/pull.py +0 -0
  50. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/pull_context.py +0 -0
  51. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/pull_utils.py +0 -0
  52. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/push.py +0 -0
  53. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/util/__init__.py +0 -0
  54. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/util/common.py +0 -0
  55. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  56. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/__init__.py +0 -0
  57. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/cli.py +0 -0
  58. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/connectors.py +0 -0
  59. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  60. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  61. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/plan.py +0 -0
  62. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  63. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  64. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  65. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  66. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  67. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  68. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  69. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  70. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  71. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  72. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  73. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/generators.py +0 -0
  74. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/progress.py +0 -0
  75. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/routes.py +0 -0
  76. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/server.py +0 -0
  77. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/storage.py +0 -0
  78. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  79. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/__init__.py +0 -0
  80. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/_base_utils.py +0 -0
  81. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  82. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/connectors.py +0 -0
  83. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/exceptions.py +0 -0
  84. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  85. {mostlyai-4.3.2 → mostlyai-4.3.4}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.3.2
3
+ Version: 4.3.4
4
4
  Summary: Synthetic Data SDK
5
5
  Project-URL: homepage, https://app.mostly.ai/
6
6
  Project-URL: repository, https://github.com/mostly-ai/mostlyai
@@ -57,8 +57,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
57
57
  Requires-Dist: filelock>=3.16.1; extra == 'local'
58
58
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local'
59
59
  Requires-Dist: joblib>=1.2.0; extra == 'local'
60
- Requires-Dist: mostlyai-engine==1.1.6; extra == 'local'
61
- Requires-Dist: mostlyai-qa==1.5.6; extra == 'local'
60
+ Requires-Dist: mostlyai-engine==1.1.7; extra == 'local'
61
+ Requires-Dist: mostlyai-qa==1.5.7; extra == 'local'
62
62
  Requires-Dist: networkx<4,>=3.0; extra == 'local'
63
63
  Requires-Dist: openpyxl>=3.1.5; extra == 'local'
64
64
  Requires-Dist: python-multipart>=0.0.20; extra == 'local'
@@ -66,7 +66,10 @@ Requires-Dist: s3fs>=2023.1.0; extra == 'local'
66
66
  Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local'
67
67
  Requires-Dist: sqlalchemy>=2.0.0; extra == 'local'
68
68
  Requires-Dist: sshtunnel<0.5,>=0.4.0; extra == 'local'
69
- Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local'
69
+ Requires-Dist: torch<2.7.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local'
70
+ Requires-Dist: torch==2.5.1; (sys_platform == 'linux') and extra == 'local'
71
+ Requires-Dist: torchaudio==2.5.1; (sys_platform == 'linux') and extra == 'local'
72
+ Requires-Dist: torchvision==0.20.1; (sys_platform == 'linux') and extra == 'local'
70
73
  Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local'
71
74
  Requires-Dist: xlsxwriter<4,>=3.1.9; extra == 'local'
72
75
  Provides-Extra: local-cpu
@@ -77,8 +80,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-cpu'
77
80
  Requires-Dist: filelock>=3.16.1; extra == 'local-cpu'
78
81
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-cpu'
79
82
  Requires-Dist: joblib>=1.2.0; extra == 'local-cpu'
80
- Requires-Dist: mostlyai-engine[cpu]==1.1.6; extra == 'local-cpu'
81
- Requires-Dist: mostlyai-qa[cpu]==1.5.6; extra == 'local-cpu'
83
+ Requires-Dist: mostlyai-engine[cpu]==1.1.7; extra == 'local-cpu'
84
+ Requires-Dist: mostlyai-qa[cpu]==1.5.7; extra == 'local-cpu'
82
85
  Requires-Dist: networkx<4,>=3.0; extra == 'local-cpu'
83
86
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-cpu'
84
87
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-cpu'
@@ -86,8 +89,10 @@ Requires-Dist: s3fs>=2023.1.0; extra == 'local-cpu'
86
89
  Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local-cpu'
87
90
  Requires-Dist: sqlalchemy>=2.0.0; extra == 'local-cpu'
88
91
  Requires-Dist: sshtunnel<0.5,>=0.4.0; extra == 'local-cpu'
89
- Requires-Dist: torch<2.6.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-cpu'
92
+ Requires-Dist: torch<2.7.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-cpu'
90
93
  Requires-Dist: torch==2.5.1+cpu; (sys_platform == 'linux') and extra == 'local-cpu'
94
+ Requires-Dist: torchaudio==2.5.1+cpu; (sys_platform == 'linux') and extra == 'local-cpu'
95
+ Requires-Dist: torchvision==0.20.1+cpu; (sys_platform == 'linux') and extra == 'local-cpu'
91
96
  Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-cpu'
92
97
  Requires-Dist: xlsxwriter<4,>=3.1.9; extra == 'local-cpu'
93
98
  Provides-Extra: local-gpu
@@ -98,8 +103,8 @@ Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
98
103
  Requires-Dist: filelock>=3.16.1; extra == 'local-gpu'
99
104
  Requires-Dist: gcsfs>=2023.1.0; extra == 'local-gpu'
100
105
  Requires-Dist: joblib>=1.2.0; extra == 'local-gpu'
101
- Requires-Dist: mostlyai-engine[gpu]==1.1.6; extra == 'local-gpu'
102
- Requires-Dist: mostlyai-qa[gpu]==1.5.6; extra == 'local-gpu'
106
+ Requires-Dist: mostlyai-engine[gpu]==1.1.7; extra == 'local-gpu'
107
+ Requires-Dist: mostlyai-qa[gpu]==1.5.7; extra == 'local-gpu'
103
108
  Requires-Dist: networkx<4,>=3.0; extra == 'local-gpu'
104
109
  Requires-Dist: openpyxl>=3.1.5; extra == 'local-gpu'
105
110
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
@@ -107,7 +112,10 @@ Requires-Dist: s3fs>=2023.1.0; extra == 'local-gpu'
107
112
  Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0; extra == 'local-gpu'
108
113
  Requires-Dist: sqlalchemy>=2.0.0; extra == 'local-gpu'
109
114
  Requires-Dist: sshtunnel<0.5,>=0.4.0; extra == 'local-gpu'
110
- Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local-gpu'
115
+ Requires-Dist: torch<2.7.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-gpu'
116
+ Requires-Dist: torch==2.5.1; (sys_platform == 'linux') and extra == 'local-gpu'
117
+ Requires-Dist: torchaudio==2.5.1; (sys_platform == 'linux') and extra == 'local-gpu'
118
+ Requires-Dist: torchvision==0.20.1; (sys_platform == 'linux') and extra == 'local-gpu'
111
119
  Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-gpu'
112
120
  Requires-Dist: xlsxwriter<4,>=3.1.9; extra == 'local-gpu'
113
121
  Provides-Extra: mssql
@@ -200,33 +208,13 @@ from mostlyai.sdk import MostlyAI
200
208
  # load original data
201
209
  repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
202
210
  df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz")
211
+ df_original = df_original.sample(n=10_000) # sub-sample to speed up demo
203
212
 
204
213
  # initialize the SDK
205
214
  mostly = MostlyAI()
206
215
 
207
- # train a synthetic data generator
208
- g = mostly.train(
209
- config={
210
- "name": "US Census Income",
211
- "tables": [
212
- {
213
- "name": "census",
214
- "data": df_original,
215
- "tabular_model_configuration": { # tabular model configuration (optional)
216
- "max_training_time": 1, # - cap time to 1 min for demo; increase for max accuracy
217
- # model, max_epochs,,.. # further model configurations (optional)
218
- # 'differential_privacy': { # differential privacy configuration (optional)
219
- # 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
220
- # 'delta': 1e-5, # - delta value
221
- # }
222
- },
223
- # columns, keys, compute,.. # further table configurations (optional)
224
- }
225
- ],
226
- },
227
- start=True, # start training immediately (default: True)
228
- wait=True, # wait for completion (default: True)
229
- )
216
+ # train a synthetic data generator, with default configs
217
+ g = mostly.train(name="Quick Start Demo", data=df_original)
230
218
 
231
219
  # display the quality assurance report
232
220
  g.reports(display=True)
@@ -264,7 +252,13 @@ df_samples
264
252
 
265
253
  ## Installation
266
254
 
267
- Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required. It is recommended to install the package within a dedicated virtual environment.
255
+ Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
256
+
257
+ It is highly recommended to install the package within a dedicated virtual environment, such as **venv**, **uv**, or **conda**. E.g.
258
+ ```shell
259
+ conda create -n mostlyai python=3.12
260
+ conda activate mostlyai
261
+ ```
268
262
 
269
263
  ### CLIENT mode
270
264
 
@@ -287,6 +281,8 @@ pip install -U 'mostlyai[local-cpu]' --extra-index-url https://download.pytorch.
287
281
  pip install -U 'mostlyai[local-gpu]'
288
282
  ```
289
283
 
284
+ > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, or `mostlyai[local-gpu]`) will downgrade PyTorch from 2.6.0 to 2.5.1. You'll need to restart the runtime after installation for the changes to take effect.
285
+
290
286
  Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
291
287
 
292
288
  ```shell
@@ -76,33 +76,13 @@ from mostlyai.sdk import MostlyAI
76
76
  # load original data
77
77
  repo_url = "https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev"
78
78
  df_original = pd.read_csv(f"{repo_url}/census/census.csv.gz")
79
+ df_original = df_original.sample(n=10_000) # sub-sample to speed up demo
79
80
 
80
81
  # initialize the SDK
81
82
  mostly = MostlyAI()
82
83
 
83
- # train a synthetic data generator
84
- g = mostly.train(
85
- config={
86
- "name": "US Census Income",
87
- "tables": [
88
- {
89
- "name": "census",
90
- "data": df_original,
91
- "tabular_model_configuration": { # tabular model configuration (optional)
92
- "max_training_time": 1, # - cap time to 1 min for demo; increase for max accuracy
93
- # model, max_epochs,,.. # further model configurations (optional)
94
- # 'differential_privacy': { # differential privacy configuration (optional)
95
- # 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
96
- # 'delta': 1e-5, # - delta value
97
- # }
98
- },
99
- # columns, keys, compute,.. # further table configurations (optional)
100
- }
101
- ],
102
- },
103
- start=True, # start training immediately (default: True)
104
- wait=True, # wait for completion (default: True)
105
- )
84
+ # train a synthetic data generator, with default configs
85
+ g = mostly.train(name="Quick Start Demo", data=df_original)
106
86
 
107
87
  # display the quality assurance report
108
88
  g.reports(display=True)
@@ -140,7 +120,13 @@ df_samples
140
120
 
141
121
  ## Installation
142
122
 
143
- Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required. It is recommended to install the package within a dedicated virtual environment.
123
+ Use `pip` (or better `uv pip`) to install the official `mostlyai` package via PyPI. Python 3.10 or higher is required.
124
+
125
+ It is highly recommended to install the package within a dedicated virtual environment, such as **venv**, **uv**, or **conda**. E.g.
126
+ ```shell
127
+ conda create -n mostlyai python=3.12
128
+ conda activate mostlyai
129
+ ```
144
130
 
145
131
  ### CLIENT mode
146
132
 
@@ -163,6 +149,8 @@ pip install -U 'mostlyai[local-cpu]' --extra-index-url https://download.pytorch.
163
149
  pip install -U 'mostlyai[local-gpu]'
164
150
  ```
165
151
 
152
+ > **Note for Google Colab users**: Installing any of the local extras (`mostlyai[local]`, `mostlyai[local-cpu]`, or `mostlyai[local-gpu]`) will downgrade PyTorch from 2.6.0 to 2.5.1. You'll need to restart the runtime after installation for the changes to take effect.
153
+
166
154
  Add any of the following extras for further data connectors support in LOCAL mode: `databricks`, `googlebigquery`, `hive`, `mssql`, `mysql`, `oracle`, `postgres`, `snowflake`. E.g.
167
155
 
168
156
  ```shell
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.3.2" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.3.4" # Do not set this manually. Use poetry version [params].
@@ -58,7 +58,9 @@ def check_local_mode_available() -> None:
58
58
 
59
59
  return
60
60
  except ImportError:
61
- raise APIError("LOCAL mode requires additional packages to be installed. Run `pip install 'mostlyai[local]'`.")
61
+ raise APIError(
62
+ "LOCAL mode requires additional packages to be installed. Run `pip install -U 'mostlyai[local]'`."
63
+ )
62
64
 
63
65
 
64
66
  def validate_base_url(base_url: str) -> None:
@@ -55,14 +55,14 @@ class MostlyAI(_MostlyBaseClient):
55
55
  Instantiate an SDK instance, either in CLIENT or in LOCAL mode.
56
56
 
57
57
  Args:
58
- base_url: The base URL. If not provided, a default value is used.
59
- api_key: The API key for authenticating. If not provided, it would rely on environment variables.
60
- local: Whether to run in local mode or not.
61
- local_dir: The directory to use for local mode. If not provided, `~/mostlyai` will be used.
62
- local_port: The port to use for local mode with TCP transport. If not provided, UDS transport is used by default.
63
- timeout: Timeout for HTTPS requests in seconds.
64
- ssl_verify: Whether to verify SSL certificates.
65
- quiet: Whether to suppress rich output.
58
+ base_url (str | None): The base URL. If not provided, env var `MOSTLY_BASE_URL` is used if available, otherwise `https://app.mostly.ai`.
59
+ api_key (str | None): The API key for authenticating. If not provided, env var `MOSTLY_API_KEY` is used if available.
60
+ local (bool | None): Whether to run in local mode or not. If not provided, user is prompted to choose between CLIENT and LOCAL mode.
61
+ local_dir (str | Path | None): The directory to use for local mode. If not provided, `~/mostlyai` is used.
62
+ local_port (int | None): The port to use for local mode with TCP transport. If not provided, UDS transport is used.
63
+ timeout (float): Timeout for HTTPS requests in seconds. Default is 60 seconds.
64
+ ssl_verify (bool): Whether to verify SSL certificates. Default is True.
65
+ quiet (bool): Whether to suppress rich output. Default is False.
66
66
 
67
67
  Example for SDK in CLIENT mode with explicit arguments:
68
68
  ```python
@@ -241,14 +241,12 @@ class MostlyAI(_MostlyBaseClient):
241
241
  """
242
242
  Create a connector and optionally validate the connection before saving.
243
243
 
244
- See [ConnectorConfig](api_domain.md#mostlyai.sdk.domain.ConnectorConfig) for more information on the available configuration parameters.
245
-
246
244
  Args:
247
- config: Configuration for the connector. Can be either a ConnectorConfig object or an equivalent dictionary.
248
- test_connection: Whether to validate the connection before saving.
245
+ config (ConnectorConfig | dict[str, Any]): Configuration for the connector. Can be either a ConnectorConfig object or an equivalent dictionary.
246
+ test_connection (bool | None): Whether to validate the connection before saving. Default is True.
249
247
 
250
248
  Returns:
251
- The created connector.
249
+ Connector: The created connector.
252
250
 
253
251
  Example for creating a connector to a AWS S3 storage:
254
252
  ```python
@@ -399,86 +397,154 @@ class MostlyAI(_MostlyBaseClient):
399
397
  """
400
398
  Train a generator.
401
399
 
402
- See [GeneratorConfig](api_domain.md#mostlyai.sdk.domain.GeneratorConfig) for more information on the available configuration parameters.
403
-
404
400
  Args:
405
- config: The configuration parameters of the generator to be created. Either `config` or `data` must be provided.
406
- data: A single pandas DataFrame, or a path to a CSV or PARQUET file. Either `config` or `data` must be provided.
407
- name: Name of the generator.
408
- start: Whether to start training immediately.
409
- wait: Whether to wait for training to finish.
410
- progress_bar: Whether to display a progress bar during training.
401
+ config (GeneratorConfig | dict | None): The configuration parameters of the generator to be created. Either `config` or `data` must be provided.
402
+ data (pd.DataFrame | str | Path | None): A single pandas DataFrame, or a path to a CSV or PARQUET file. Either `config` or `data` must be provided.
403
+ name (str | None): Name of the generator.
404
+ start (bool): Whether to start training immediately. Default is True.
405
+ wait (bool): Whether to wait for training to finish. Default is True.
406
+ progress_bar (bool): Whether to display a progress bar during training. Default is True.
411
407
 
412
408
  Returns:
413
- The created generator.
409
+ Generator: The created generator.
414
410
 
415
- Example of short-hand notation reading data from path:
411
+ Example of single table with default configurations:
416
412
  ```python
413
+ # read original data
414
+ import pandas as pd
415
+ df = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/census/census.csv.gz')
416
+ # instantiate client
417
417
  from mostlyai.sdk import MostlyAI
418
418
  mostly = MostlyAI()
419
+ # train generator
419
420
  g = mostly.train(
420
- data='https://github.com/mostly-ai/public-demo-data/raw/dev/census/census.csv.gz',
421
+ name='census',
422
+ data=df, # alternatively, pass a path to a CSV or PARQUET file
423
+ start=True, # start training immediately
424
+ wait=True, # wait for training to finish
421
425
  )
422
426
  ```
423
427
 
424
- Example of short-hand notation passing data as DataFrame:
428
+ Example of single table with custom configurations:
425
429
  ```python
426
430
  # read original data
427
431
  import pandas as pd
428
- df_original = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/titanic/titanic.csv')
432
+ df = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/baseball/players.csv.gz')
429
433
  # instantiate client
430
434
  from mostlyai.sdk import MostlyAI
431
435
  mostly = MostlyAI()
432
- # train generator
436
+ # configure generator via dictionary
433
437
  g = mostly.train(
434
- name='census',
435
- data=df_original,
438
+ config={ # see `mostlyai.sdk.domain.GeneratorConfig`
439
+ 'name': 'Baseball Players',
440
+ 'tables': [
441
+ { # see `mostlyai.sdk.domain.SourceTableConfig`
442
+ 'name': 'players', # name of the table (required)
443
+ 'data': df, # either provide data as a pandas DataFrame
444
+ 'source_connector_id': None, # - or pass a source_connector_id
445
+ 'location': None, # - together with a table location
446
+ 'primary_key': 'id', # specify the primary key column, if one is present
447
+ 'tabular_model_configuration': { # see `mostlyai.sdk.domain.ModelConfiguration`; all settings are optional!
448
+ 'model': 'MOSTLY_AI/Medium', # check `mostly.models()` for available models
449
+ 'batch_size': None, # set a custom physical training batch size
450
+ 'max_sample_size': 10_000, # cap sample size to 10k; set to None for max accuracy
451
+ 'max_epochs': 20, # cap training to 20 epochs; set to None for max accuracy
452
+ 'max_training_time': 10, # cap runtime to 10min; set to None for max accuracy
453
+ 'enable_flexible_generation': True, # allow seed, imputation, rebalancing and fairness; set to False for max accuracy
454
+ 'value_protection': True, # privacy protect value ranges; set to False for allowing all seen values
455
+ 'differential_privacy': { # set DP configs if explicitly requested
456
+ 'max_epsilon': 5.0, # - max epsilon value, used as stopping criterion
457
+ 'noise_multiplier': 0.8, # - DP noise multiplier
458
+ 'max_grad_norm': 1.0, # - DP max grad norm
459
+ 'delta': 1e-5, # - DP delta value
460
+ },
461
+ 'enable_model_report': True, # generate a model report, including quality metrics
462
+ },
463
+ 'columns': [ # list columns (optional); see `mostlyai.sdk.domain.ModelEncodingType`
464
+ {'name': 'id', 'model_encoding_type': 'TABULAR_CATEGORICAL'},
465
+ {'name': 'bats', 'model_encoding_type': 'TABULAR_CATEGORICAL'},
466
+ {'name': 'throws', 'model_encoding_type': 'TABULAR_CATEGORICAL'},
467
+ {'name': 'birthDate', 'model_encoding_type': 'TABULAR_DATETIME'},
468
+ {'name': 'weight', 'model_encoding_type': 'TABULAR_NUMERIC_AUTO'},
469
+ {'name': 'height', 'model_encoding_type': 'TABULAR_NUMERIC_AUTO'},
470
+ ],
471
+ }
472
+ ]
473
+ },
474
+ start=True, # start training immediately
475
+ wait=True, # wait for training to finish
436
476
  )
437
477
  ```
438
478
 
439
- Example configuration using GeneratorConfig:
479
+ Example of multi-table with custom configurations:
440
480
  ```python
441
481
  # read original data
442
482
  import pandas as pd
443
- df_original = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/titanic/titanic.csv')
483
+ df_purchases = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/cdnow/purchases.csv.gz')
484
+ df_users = df_purchases[['users_id']].drop_duplicates()
444
485
  # instantiate client
445
486
  from mostlyai.sdk import MostlyAI
446
487
  mostly = MostlyAI()
447
- # configure generator via GeneratorConfig
448
- from mostlyai.sdk.domain import GeneratorConfig, SourceTableConfig
449
- g = mostly.train(
450
- config=GeneratorConfig(
451
- name='census',
452
- tables=[
453
- SourceTableConfig(
454
- name='data',
455
- data=df_original
456
- )
457
- ]
458
- )
459
- )
488
+ # train generator
489
+ g = mostly.train(config={
490
+ 'name': 'CDNOW', # name of the generator
491
+ 'tables': [{ # provide list of all tables
492
+ 'name': 'users',
493
+ 'data': df_users,
494
+ 'primary_key': 'users_id', # define PK column
495
+ }, {
496
+ 'name': 'purchases',
497
+ 'data': df_purchases,
498
+ 'foreign_keys': [{ # define FK columns, with one providing the context
499
+ 'column': 'users_id',
500
+ 'referenced_table': 'users',
501
+ 'is_context': True
502
+ }],
503
+ 'tabular_model_configuration': {
504
+ 'max_sample_size': 1000, # cap sample size to 1k users; set to None for max accuracy
505
+ 'max_training_time': 1, # cap runtime to 1min; set to None for max accuracy
506
+ 'max_sequence_window': 10, # optionally limit the sequence window
507
+ },
508
+ }],
509
+ }, start=True, wait=True)
460
510
  ```
461
511
 
462
- Example configuration using a dictionary:
512
+ Example of multi-model with TABULAR and LANGUAGE models:
463
513
  ```python
464
514
  # read original data
465
515
  import pandas as pd
466
- df_original = pd.read_csv('https://github.com/mostly-ai/public-demo-data/raw/dev/titanic/titanic.csv')
467
- # instantiate client
516
+ df = pd.read_parquet('https://github.com/mostly-ai/public-demo-data/raw/refs/heads/dev/headlines/headlines.parquet')
517
+
518
+ # instantiate SDK
468
519
  from mostlyai.sdk import MostlyAI
469
520
  mostly = MostlyAI()
470
- # configure generator via dictionary
471
- g = mostly.train(
472
- config={
473
- 'name': 'census',
474
- 'tables': [
475
- {
476
- 'name': 'data',
477
- 'data': df_original
478
- }
479
- ]
480
- }
481
- )
521
+
522
+ # print out available LANGUAGE models
523
+ print(mostly.models()["LANGUAGE"])
524
+
525
+ # train a generator; increase max_training_time to improve quality
526
+ g = mostly.train(config={
527
+ 'name': 'Headlines',
528
+ 'tables': [{
529
+ 'name': 'headlines',
530
+ 'data': df,
531
+ 'columns': [ # configure TABULAR + LANGUAGE cols
532
+ {'name': 'category', 'model_encoding_type': 'TABULAR_CATEGORICAL'},
533
+ {'name': 'date', 'model_encoding_type': 'TABULAR_DATETIME'},
534
+ {'name': 'headline', 'model_encoding_type': 'LANGUAGE_TEXT'},
535
+ ],
536
+ 'tabular_model_configuration': { # tabular model configuration (optional)
537
+ 'max_sample_size': 2000, # cap sample size to 2k; set None for max accuracy
538
+ 'max_training_time': 1, # cap runtime to 1min; set None for max accuracy
539
+ },
540
+ 'language_model_configuration': { # language model configuration (optional)
541
+ 'max_sample_size': 1000, # cap sample size to 1k; set None for max accuracy
542
+ 'max_training_time': 5, # cap runtime to 5min; set None for max accuracy
543
+ 'model': 'MOSTLY_AI/LSTMFromScratch-3m', # use a light-weight LSTM model, trained from scratch (GPU recommended)
544
+ #'model': 'microsoft/phi-1.5', # alternatively use a pre-trained HF-hosted LLM model (GPU required)
545
+ }
546
+ }],
547
+ }, start=True, wait=True)
482
548
  ```
483
549
  """
484
550
  if data is None and config is None:
@@ -514,7 +580,7 @@ class MostlyAI(_MostlyBaseClient):
514
580
 
515
581
  def generate(
516
582
  self,
517
- generator: Generator | str | None = None,
583
+ generator: Generator | str,
518
584
  config: SyntheticDatasetConfig | dict | None = None,
519
585
  size: int | dict[str, int] | None = None,
520
586
  seed: Seed | dict[str, Seed] | None = None,
@@ -526,20 +592,18 @@ class MostlyAI(_MostlyBaseClient):
526
592
  """
527
593
  Generate synthetic data.
528
594
 
529
- See [SyntheticDatasetConfig](api_domain.md#mostlyai.sdk.domain.SyntheticDatasetConfig) for more information on the available configuration parameters.
530
-
531
595
  Args:
532
- generator: The generator instance or its UUID.
533
- config: Configuration for the synthetic dataset.
534
- size : Sample size(s) for the subject table(s).
535
- seed: Seed data for the subject table(s).
536
- name: Name of the synthetic dataset.
537
- start: Whether to start generation immediately.
538
- wait: Whether to wait for generation to finish.
539
- progress_bar: Whether to display a progress bar during generation.
596
+ generator (Generator | str): The generator instance or its UUID.
597
+ config (SyntheticDatasetConfig | dict | None): Configuration for the synthetic dataset.
598
+ size (int | dict[str, int] | None): Sample size(s) for the subject table(s).
599
+ seed (Seed | dict[str, Seed] | None): Seed data for the subject table(s).
600
+ name (str | None): Name of the synthetic dataset.
601
+ start (bool): Whether to start generation immediately. Default is True.
602
+ wait (bool): Whether to wait for generation to finish. Default is True.
603
+ progress_bar (bool): Whether to display a progress bar during generation. Default is True.
540
604
 
541
605
  Returns:
542
- The created synthetic dataset.
606
+ SyntheticDataset: The created synthetic dataset.
543
607
 
544
608
  Example configuration using short-hand notation:
545
609
  ```python
@@ -606,7 +670,7 @@ class MostlyAI(_MostlyBaseClient):
606
670
 
607
671
  def probe(
608
672
  self,
609
- generator: Generator | str | None = None,
673
+ generator: Generator | str,
610
674
  size: int | dict[str, int] | None = None,
611
675
  seed: Seed | dict[str, Seed] | None = None,
612
676
  config: SyntheticProbeConfig | dict | None = None,
@@ -615,17 +679,15 @@ class MostlyAI(_MostlyBaseClient):
615
679
  """
616
680
  Probe a generator.
617
681
 
618
- See [SyntheticProbeConfig](api_domain.md#mostlyai.sdk.domain.SyntheticProbeConfig) for more information on the available configuration parameters.
619
-
620
682
  Args:
621
- generator: The generator instance or its UUID.
622
- size: Sample size(s) for the subject table(s).
623
- seed: Seed data for the subject table(s).
624
- config: Configuration for the probe.
625
- return_type: Format of the return value. "auto" for pandas DataFrame if a single table, otherwise a dictionary.
683
+ generator (Generator | str): The generator instance or its UUID.
684
+ size (int | dict[str, int] | None): Sample size(s) for the subject table(s). Default is 1, if no seed is provided.
685
+ seed (Seed | dict[str, Seed] | None): Seed data for the subject table(s).
686
+ config (SyntheticProbeConfig | dict | None): Configuration for the probe.
687
+ return_type (Literal["auto", "dict"]): Format of the return value. "auto" for pandas DataFrame if a single table, otherwise a dictionary. Default is "auto".
626
688
 
627
689
  Returns:
628
- The created synthetic probe.
690
+ pd.DataFrame | dict[str, pd.DataFrame]: The created synthetic probe.
629
691
 
630
692
  Example for probing a generator for 10 synthetic samples:
631
693
  ```python
@@ -677,7 +739,7 @@ class MostlyAI(_MostlyBaseClient):
677
739
  Retrieve information about the current user.
678
740
 
679
741
  Returns:
680
- Information about the current user.
742
+ CurrentUser: Information about the current user.
681
743
 
682
744
  Example for retrieving information about the current user:
683
745
  ```python
@@ -694,7 +756,7 @@ class MostlyAI(_MostlyBaseClient):
694
756
  Retrieve information about the platform.
695
757
 
696
758
  Returns:
697
- Information about the platform.
759
+ AboutService: Information about the platform.
698
760
 
699
761
  Example for retrieving information about the platform:
700
762
  ```python
@@ -711,7 +773,7 @@ class MostlyAI(_MostlyBaseClient):
711
773
  Retrieve a list of available models of a specific type.
712
774
 
713
775
  Returns:
714
- A dictionary with list of available models for each ModelType.
776
+ dict[str, list[str]]: A dictionary with list of available models for each ModelType.
715
777
 
716
778
  Example for retrieving available models:
717
779
  ```python
@@ -729,9 +791,8 @@ class MostlyAI(_MostlyBaseClient):
729
791
  def computes(self) -> list[dict[str, Any]]:
730
792
  """
731
793
  Retrieve a list of available compute resources, that can be used for executing tasks.
732
-
733
794
  Returns:
734
- A list of available compute resources.
795
+ list[dict[str, Any]]: A list of available compute resources.
735
796
 
736
797
  Example for retrieving available compute resources:
737
798
  ```python
@@ -97,19 +97,19 @@ class _MostlyBaseClient:
97
97
  Extended request helper method to send HTTP requests and process the response.
98
98
 
99
99
  Args:
100
- path: A single string or a list of parts of the path to concatenate.
101
- verb: HTTP method (GET, POST, PATCH, DELETE).
102
- response_type: Type to cast the response into. Defaults to `dict`.
103
- raw_response: Whether to return the raw response object. Defaults to `False`.
104
- is_api_call: If `False`, skips prefixing API_SECTION and SECTION. Defaults to `True`.
105
- do_json_camel_case: Convert the provided JSON to camelCase. Defaults to `True`.
106
- do_response_dict_snake_case: Convert the response dictionary to snake_case. Defaults to `True`.
107
- do_include_client: Include the client property in the returned object. Defaults to `True`.
108
- extra_key_values: Additional key-value pairs to include in the response object.
100
+ path (str | list[Any]): A single string or a list of parts of the path to concatenate.
101
+ verb (HttpVerb): HTTP method (GET, POST, PATCH, DELETE).
102
+ response_type (type | None): Type to cast the response into. Defaults to dict.
103
+ raw_response (bool): Whether to return the raw response object. Defaults to False.
104
+ is_api_call (bool): If False, skips prefixing API_SECTION and SECTION. Defaults to True.
105
+ do_json_camel_case (bool): Convert the provided JSON to camelCase. Defaults to True.
106
+ do_response_dict_snake_case (bool): Convert the response dictionary to snake_case. Defaults to True.
107
+ do_include_client (bool): Include the client property in the returned object. Defaults to True.
108
+ extra_key_values (dict | None): Additional key-value pairs to include in the response object.
109
109
  **kwargs: Additional arguments passed to the HTTP request.
110
110
 
111
111
  Returns:
112
- Processed response based on the `response_type`.
112
+ Processed response based on the response_type.
113
113
 
114
114
  Raises:
115
115
  APIStatusError: For HTTP errors (non-2XX responses).
@@ -179,9 +179,9 @@ class Paginator(Generic[T]):
179
179
  Generic paginator for listing objects with pagination.
180
180
 
181
181
  Args:
182
- client: The client instance to use for the requests.
183
- response_class: Class of the objects to be listed.
184
- **kwargs: Additional filter parameters including 'offset' and 'limit'.
182
+ client (_MostlyBaseClient): The client instance to use for the requests.
183
+ response_class (type[T]): Class of the objects to be listed.
184
+ **kwargs (dict): Additional filter parameters including 'offset' and 'limit'.
185
185
  """
186
186
  self.client = client
187
187
  self.response_class = response_class