mostlyai 4.1.7__tar.gz → 4.2.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.
Files changed (84) hide show
  1. {mostlyai-4.1.7 → mostlyai-4.2.1}/PKG-INFO +17 -12
  2. {mostlyai-4.1.7 → mostlyai-4.2.1}/README.md +7 -2
  3. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/dtype.py +3 -0
  5. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/language_model.py +3 -3
  6. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/plan.py +22 -14
  7. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_generate_data.py +2 -1
  8. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/server.py +1 -3
  9. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/_base_utils.py +1 -1
  10. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/api.py +3 -1
  11. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/generators.py +4 -1
  12. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/domain.py +41 -23
  13. {mostlyai-4.1.7 → mostlyai-4.2.1}/pyproject.toml +11 -11
  14. {mostlyai-4.1.7 → mostlyai-4.2.1}/.gitignore +0 -0
  15. {mostlyai-4.1.7 → mostlyai-4.2.1}/LICENSE +0 -0
  16. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/__init__.py +0 -0
  17. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/auto_detect.py +0 -0
  18. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/base.py +0 -0
  19. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/context.py +0 -0
  20. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/conversions.py +0 -0
  21. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/__init__.py +0 -0
  22. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/base.py +0 -0
  23. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  24. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/databricks.py +0 -0
  25. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/hive.py +0 -0
  26. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/mssql.py +0 -0
  27. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/mysql.py +0 -0
  28. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/oracle.py +0 -0
  29. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  30. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  31. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  32. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  33. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/exceptions.py +0 -0
  34. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/__init__.py +0 -0
  35. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/base.py +0 -0
  36. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  37. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  38. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  39. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  40. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  41. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  42. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  43. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  44. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  45. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/table/json.py +0 -0
  46. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  47. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/file/utils.py +0 -0
  48. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  49. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/non_context.py +0 -0
  50. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/progress_callback.py +0 -0
  51. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/pull.py +0 -0
  52. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/pull_context.py +0 -0
  53. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/pull_utils.py +0 -0
  54. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/push.py +0 -0
  55. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/util/__init__.py +0 -0
  56. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/util/common.py +0 -0
  57. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  58. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/__init__.py +0 -0
  59. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/cli.py +0 -0
  60. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/connectors.py +0 -0
  61. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  62. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  63. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  64. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  65. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  66. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  67. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  68. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  69. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  70. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  71. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  72. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  73. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/generators.py +0 -0
  74. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/progress.py +0 -0
  75. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/routes.py +0 -0
  76. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/storage.py +0 -0
  77. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  78. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/__init__.py +0 -0
  79. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  80. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/_utils.py +0 -0
  81. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/base.py +0 -0
  82. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/connectors.py +0 -0
  83. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/exceptions.py +0 -0
  84. {mostlyai-4.1.7 → mostlyai-4.2.1}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.1.7
3
+ Version: 4.2.1
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
@@ -24,12 +24,12 @@ Classifier: Programming Language :: Python :: 3.13
24
24
  Classifier: Topic :: Software Development :: Libraries
25
25
  Classifier: Typing :: Typed
26
26
  Requires-Python: <3.14,>=3.10
27
- Requires-Dist: adlfs<2024,>=2023.4.0
28
- Requires-Dist: azure-storage-blob<13,>=12.16.0
29
- Requires-Dist: cloudpathlib[azure,gs,s3]<0.18,>=0.17.0
27
+ Requires-Dist: adlfs>=2023.4.0
28
+ Requires-Dist: azure-storage-blob>=12.16.0
29
+ Requires-Dist: cloudpathlib[azure,gs,s3]>=0.17.0
30
30
  Requires-Dist: environs>=9.5.0
31
31
  Requires-Dist: filelock>=3.16.1
32
- Requires-Dist: gcsfs<2024,>=2023.1.0
32
+ Requires-Dist: gcsfs>=2023.1.0
33
33
  Requires-Dist: greenlet<4,>=3.1.1
34
34
  Requires-Dist: gunicorn>=23.0.0
35
35
  Requires-Dist: httpx>=0.25.0
@@ -44,11 +44,11 @@ Requires-Dist: pycryptodomex<4,>=3.10.0
44
44
  Requires-Dist: pydantic<3,>=2.4.2
45
45
  Requires-Dist: requests>=2.31.0
46
46
  Requires-Dist: rich>=13.7.0
47
- Requires-Dist: s3fs<2024,>=2023.1.0
47
+ Requires-Dist: s3fs>=2023.1.0
48
48
  Requires-Dist: schema>=0.7.5
49
49
  Requires-Dist: semantic-version>=2.10.0
50
50
  Requires-Dist: smart-open>=6.0.0
51
- Requires-Dist: smart-open[azure,gcs,s3]<7,>=6.3.0
51
+ Requires-Dist: smart-open[azure,gcs,s3]>=6.3.0
52
52
  Requires-Dist: sqlalchemy>=2.0.0
53
53
  Requires-Dist: sshtunnel<0.5,>=0.4.0
54
54
  Requires-Dist: typer>=0.9.0
@@ -64,14 +64,14 @@ Requires-Dist: kerberos<2,>=1.3.1; extra == 'hive'
64
64
  Requires-Dist: pyhive[hive-pure-sasl]<0.8,>=0.7.0; extra == 'hive'
65
65
  Provides-Extra: local
66
66
  Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local'
67
- Requires-Dist: mostlyai-engine==1.0.4; extra == 'local'
67
+ Requires-Dist: mostlyai-engine==1.1.4; extra == 'local'
68
68
  Requires-Dist: mostlyai-qa==1.5.5; extra == 'local'
69
69
  Requires-Dist: python-multipart>=0.0.20; extra == 'local'
70
70
  Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local'
71
71
  Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local'
72
72
  Provides-Extra: local-cpu
73
73
  Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-cpu'
74
- Requires-Dist: mostlyai-engine[cpu]==1.0.4; extra == 'local-cpu'
74
+ Requires-Dist: mostlyai-engine[cpu]==1.1.4; extra == 'local-cpu'
75
75
  Requires-Dist: mostlyai-qa[cpu]==1.5.5; extra == 'local-cpu'
76
76
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-cpu'
77
77
  Requires-Dist: torch<2.6.0,>=2.5.1; (sys_platform != 'linux') and extra == 'local-cpu'
@@ -79,7 +79,7 @@ Requires-Dist: torch==2.5.1+cpu; (sys_platform == 'linux') and extra == 'local-c
79
79
  Requires-Dist: uvicorn<0.35,>=0.34.0; extra == 'local-cpu'
80
80
  Provides-Extra: local-gpu
81
81
  Requires-Dist: fastapi<0.116,>=0.115.6; extra == 'local-gpu'
82
- Requires-Dist: mostlyai-engine[gpu]==1.0.4; extra == 'local-gpu'
82
+ Requires-Dist: mostlyai-engine[gpu]==1.1.4; extra == 'local-gpu'
83
83
  Requires-Dist: mostlyai-qa[gpu]==1.5.5; extra == 'local-gpu'
84
84
  Requires-Dist: python-multipart>=0.0.20; extra == 'local-gpu'
85
85
  Requires-Dist: torch<2.6.0,>=2.5.1; extra == 'local-gpu'
@@ -99,14 +99,19 @@ Description-Content-Type: text/markdown
99
99
 
100
100
  # Synthetic Data SDK ✨
101
101
 
102
- [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai) [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai)
102
+ [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/)
103
+ [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai)
104
+ [![License](https://img.shields.io/github/license/mostly-ai/mostlyai)](https://github.com/mostly-ai/mostlyai/blob/main/LICENSE)
105
+ [![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai)](https://github.com/mostly-ai/mostlyai/releases)
106
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai)](https://pypi.org/project/mostlyai/)
107
+ [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai/stargazers)
103
108
 
104
109
  [SDK Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/usage/)
105
110
 
106
111
  The Synthetic Data SDK is a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
107
112
 
108
- - **Client mode** connects to a remote [MOSTLY AI platform](https://app.mostly.ai/) for training & generating synthetic data there.
109
113
  - **Local mode** trains and generates synthetic data locally on your own compute resources.
114
+ - **Client mode** connects to a remote MOSTLY AI platform for training & generating synthetic data there.
110
115
  - Generators, that were trained locally, can be easily imported to a platform for further sharing.
111
116
 
112
117
  ## Overview
@@ -1,14 +1,19 @@
1
1
 
2
2
  # Synthetic Data SDK ✨
3
3
 
4
- [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/) [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai) ![license](https://img.shields.io/github/license/mostly-ai/mostlyai) ![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai) ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai) [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai)
4
+ [![Documentation](https://img.shields.io/badge/docs-latest-green)](https://mostly-ai.github.io/mostlyai/)
5
+ [![PyPI Downloads](https://static.pepy.tech/badge/mostlyai)](https://pepy.tech/projects/mostlyai)
6
+ [![License](https://img.shields.io/github/license/mostly-ai/mostlyai)](https://github.com/mostly-ai/mostlyai/blob/main/LICENSE)
7
+ [![GitHub Release](https://img.shields.io/github/v/release/mostly-ai/mostlyai)](https://github.com/mostly-ai/mostlyai/releases)
8
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/mostlyai)](https://pypi.org/project/mostlyai/)
9
+ [![GitHub stars](https://img.shields.io/github/stars/mostly-ai/mostlyai?style=social)](https://github.com/mostly-ai/mostlyai/stargazers)
5
10
 
6
11
  [SDK Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/usage/)
7
12
 
8
13
  The Synthetic Data SDK is a Python toolkit for high-fidelity, privacy-safe **Synthetic Data**.
9
14
 
10
- - **Client mode** connects to a remote [MOSTLY AI platform](https://app.mostly.ai/) for training & generating synthetic data there.
11
15
  - **Local mode** trains and generates synthetic data locally on your own compute resources.
16
+ - **Client mode** connects to a remote MOSTLY AI platform for training & generating synthetic data there.
12
17
  - Generators, that were trained locally, can be easily imported to a platform for further sharing.
13
18
 
14
19
  ## Overview
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.1.7" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.2.1" # Do not set this manually. Use poetry version [params].
@@ -282,6 +282,7 @@ def coerce_dtype_by_encoding(
282
282
  ModelEncodingType.tabular_numeric_binned,
283
283
  ModelEncodingType.tabular_numeric_digit,
284
284
  ModelEncodingType.tabular_numeric_discrete,
285
+ ModelEncodingType.language_numeric,
285
286
  ]:
286
287
  if pd.api.types.is_bool_dtype(x):
287
288
  # convert booleans to integer -> True=1, False=0
@@ -303,6 +304,7 @@ def coerce_dtype_by_encoding(
303
304
  elif encoding_type in [
304
305
  ModelEncodingType.tabular_datetime,
305
306
  ModelEncodingType.tabular_datetime_relative,
307
+ ModelEncodingType.language_datetime,
306
308
  ]:
307
309
  # convert all others to pyarrow timestamp; and coerce any errors to NAs
308
310
  x = pd.to_datetime(x, errors="coerce", utc=True)
@@ -315,6 +317,7 @@ def coerce_dtype_by_encoding(
315
317
  ModelEncodingType.tabular_lat_long,
316
318
  ModelEncodingType.tabular_character,
317
319
  ModelEncodingType.language_text,
320
+ ModelEncodingType.language_categorical,
318
321
  ]:
319
322
  x = x.astype(STRING)
320
323
  elif encoding_type is None or encoding_type == ModelEncodingType.auto:
@@ -17,7 +17,7 @@ import uuid
17
17
 
18
18
  import pandas as pd
19
19
 
20
- from mostlyai.sdk.domain import ModelEncodingType
20
+ from mostlyai.sdk.domain import ModelType
21
21
 
22
22
  from mostlyai.sdk._data.base import Schema
23
23
  from mostlyai.sdk._data.util.common import TABLE_COLUMN_INFIX, TEMPORARY_PRIMARY_KEY
@@ -37,7 +37,7 @@ def split_language_model(
37
37
  :return: ctx_data, tgt_data
38
38
  """
39
39
  enctypes = schema.tables[tgt].encoding_types
40
- language_cols = [col for col in enctypes if enctypes[col] == ModelEncodingType.language_text]
40
+ language_cols = [col for col in enctypes if enctypes[col].startswith(ModelType.language)]
41
41
  if len(language_cols) == 0:
42
42
  # if no LANGUAGE columns are present, then leave data as-is
43
43
  return ctx_data, tgt_data
@@ -88,7 +88,7 @@ def drop_language_columns_in_target(
88
88
  tgt_table = schema.tables[tgt]
89
89
  drop_columns = []
90
90
  for col_name, encoding_type in tgt_table.encoding_types.items():
91
- if encoding_type == ModelEncodingType.language_text:
91
+ if encoding_type.startswith(ModelType.language):
92
92
  drop_columns.append(col_name)
93
93
  if drop_columns:
94
94
  _LOG.info(f"drop LANGUAGE columns from target: {drop_columns}")
@@ -14,11 +14,13 @@
14
14
 
15
15
  from pydantic import BaseModel, Field, ConfigDict
16
16
  from collections import deque
17
- from mostlyai.sdk.domain import ModelEncodingType, Generator, SourceTable, StepCode, TaskType
17
+ from mostlyai.sdk.domain import ModelEncodingType, Generator, SourceTable, StepCode, TaskType, ModelType
18
18
  import uuid
19
19
 
20
- TABULAR_MODEL_ENCODING_TYPES = [v for v in ModelEncodingType if v.startswith("TABULAR")] + [ModelEncodingType.auto]
21
- LANGUAGE_MODEL_ENCODING_TYPES = [v for v in ModelEncodingType if v.startswith("LANGUAGE")]
20
+ TABULAR_MODEL_ENCODING_TYPES = [v for v in ModelEncodingType if v.startswith(ModelType.tabular)] + [
21
+ ModelEncodingType.auto
22
+ ]
23
+ LANGUAGE_MODEL_ENCODING_TYPES = [v for v in ModelEncodingType if v.startswith(ModelType.language)]
22
24
 
23
25
  TRAINING_TASK_STEPS: list[StepCode] = [
24
26
  StepCode.pull_training_data,
@@ -39,6 +41,12 @@ FINALIZE_GENERATION_TASK_STEPS: list[StepCode] = [
39
41
  StepCode.finalize_generation,
40
42
  StepCode.deliver_data,
41
43
  ]
44
+ PROBING_TASK_STEPS: list[StepCode] = [
45
+ StepCode.generate_data,
46
+ ]
47
+ FINALIZE_PROBING_TASK_STEPS: list[StepCode] = [
48
+ StepCode.finalize_probing,
49
+ ]
42
50
 
43
51
 
44
52
  def _get_keys(table: SourceTable) -> list[str]:
@@ -70,21 +78,20 @@ class ExecutionPlan(BaseModel):
70
78
  tasks: list[Task]
71
79
 
72
80
  def add_task(self, task_type: TaskType, parent: Task | None = None, target_table_name: str | None = None) -> Task:
73
- def get_steps(task_type: TaskType) -> list[StepCode]:
81
+ def get_steps(task_type: TaskType) -> list[StepCode] | None:
74
82
  match task_type:
75
83
  case TaskType.train_tabular | TaskType.train_language:
76
84
  return TRAINING_TASK_STEPS
77
85
  case TaskType.finalize_training:
78
86
  return FINALIZE_TRAINING_TASK_STEPS
79
- case (
80
- TaskType.generate_tabular
81
- | TaskType.generate_language
82
- | TaskType.probe_tabular
83
- | TaskType.probe_language
84
- ):
87
+ case TaskType.generate_tabular | TaskType.generate_language:
85
88
  return GENERATION_TASK_STEPS
86
- case TaskType.finalize_generation | TaskType.finalize_probing:
89
+ case TaskType.finalize_generation:
87
90
  return FINALIZE_GENERATION_TASK_STEPS
91
+ case TaskType.probe_tabular | TaskType.probe_language:
92
+ return PROBING_TASK_STEPS
93
+ case TaskType.finalize_probing:
94
+ return FINALIZE_PROBING_TASK_STEPS
88
95
  case _:
89
96
  return None
90
97
 
@@ -107,9 +114,10 @@ def make_generator_execution_plan(generator: Generator) -> ExecutionPlan:
107
114
  execution_plan.add_task(TaskType.train_tabular, parent=sync_task, target_table_name=table.name)
108
115
  if has_language_model(table):
109
116
  execution_plan.add_task(TaskType.train_language, parent=sync_task, target_table_name=table.name)
110
- post_training_sync = execution_plan.add_task(TaskType.sync)
111
- finalize_task = execution_plan.add_task(TaskType.finalize_training, parent=post_training_sync)
112
- execution_plan.add_task(TaskType.sync, parent=finalize_task)
117
+ execution_plan.add_task(TaskType.sync)
118
+ # post_training_sync = execution_plan.add_task(TaskType.sync)
119
+ # finalize_task = execution_plan.add_task(TaskType.finalize_training, parent=post_training_sync)
120
+ # execution_plan.add_task(TaskType.sync, parent=finalize_task)
113
121
  return execution_plan
114
122
 
115
123
 
@@ -56,7 +56,8 @@ def execute_step_generate_data(
56
56
  if not ctx_data_dir.exists():
57
57
  ctx_data_dir.mkdir(parents=True)
58
58
  ctx_primary_key = f"{tgt_g_table.name}{TABLE_COLUMN_INFIX}{TEMPORARY_PRIMARY_KEY}"
59
- dummy_ctx = pd.DataFrame({ctx_primary_key: [str(uuid.uuid4()) for _ in range(config.sample_size)]})
59
+ dummy_ctx_length = config.sample_size if sample_seed is None else sample_seed.shape[0]
60
+ dummy_ctx = pd.DataFrame({ctx_primary_key: [str(uuid.uuid4()) for _ in range(dummy_ctx_length)]})
60
61
  dummy_ctx.to_parquet(ctx_data_dir / "part.00000-ctx.parquet")
61
62
  ### TODO: FIX
62
63
 
@@ -33,9 +33,7 @@ class LocalServer:
33
33
  ):
34
34
  self.home_dir = Path(home_dir or "~/mostlyai").expanduser()
35
35
  self.home_dir.mkdir(parents=True, exist_ok=True)
36
- self.uds = tempfile.NamedTemporaryFile(
37
- dir=self.home_dir, prefix=".mostlyai-", suffix=".sock", delete=False
38
- ).name
36
+ self.uds = tempfile.NamedTemporaryFile(prefix=".mostlyai-", suffix=".sock", delete=False).name
39
37
  self.base_url = "http://127.0.0.1"
40
38
  self._app = FastAPI(
41
39
  root_path="/api/v2",
@@ -38,7 +38,7 @@ def convert_to_base64(
38
38
  Returns:
39
39
  The base64 encoded string.
40
40
  """
41
- if df.__class__.__module__ == "pyspark.sql.dataframe":
41
+ if df.__class__.__name__ == "DataFrame" and df.__class__.__module__.startswith("pyspark.sql"):
42
42
  # Convert PySpark DataFrame to Pandas DataFrame (safely)
43
43
  df = pd.DataFrame(df.collect(), columns=df.columns)
44
44
  elif not isinstance(df, pd.DataFrame):
@@ -416,7 +416,9 @@ class MostlyAI(_MostlyBaseClient):
416
416
  name=name,
417
417
  tables=[SourceTableConfig(data=convert_to_base64(df), name=name)],
418
418
  )
419
- elif isinstance(data, pd.DataFrame) or data.__class__.__module__ == "pyspark.sql.dataframe":
419
+ elif isinstance(data, pd.DataFrame) or (
420
+ data.__class__.__name__ == "DataFrame" and data.__class__.__module__.startswith("pyspark.sql")
421
+ ):
420
422
  df = data
421
423
  config = GeneratorConfig(
422
424
  tables=[SourceTableConfig(data=convert_to_base64(df), name="data")],
@@ -161,7 +161,10 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
161
161
  if "name" not in table:
162
162
  table["name"] = name
163
163
  del df
164
- elif isinstance(table["data"], pd.DataFrame):
164
+ elif isinstance(table["data"], pd.DataFrame) or (
165
+ table["data"].__class__.__name__ == "DataFrame"
166
+ and table["data"].__class__.__module__.startswith("pyspark.sql")
167
+ ):
165
168
  table["data"] = convert_to_base64(table["data"])
166
169
  else:
167
170
  raise ValueError("data must be a DataFrame or a file path")
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # generated by datamodel-codegen:
16
- # timestamp: 2025-02-14T06:26:18+00:00
16
+ # timestamp: 2025-02-19T14:55:11+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -29,7 +29,7 @@ from mostlyai.sdk.client._base_utils import convert_to_base64
29
29
  from typing import Any, ClassVar, Literal, Annotated
30
30
 
31
31
  from mostlyai.sdk.client.base import CustomBaseModel
32
- from pydantic import AnyUrl, Field, RootModel
32
+ from pydantic import Field, RootModel
33
33
 
34
34
 
35
35
  class AboutService(CustomBaseModel):
@@ -476,6 +476,10 @@ class RareCategoryReplacementMethod(str, Enum):
476
476
 
477
477
 
478
478
  class TaskType(str, Enum):
479
+ """
480
+ The type of the task.
481
+ """
482
+
479
483
  sync = "SYNC"
480
484
  train_tabular = "TRAIN_TABULAR"
481
485
  train_language = "TRAIN_LANGUAGE"
@@ -489,6 +493,10 @@ class TaskType(str, Enum):
489
493
 
490
494
 
491
495
  class StepCode(str, Enum):
496
+ """
497
+ The unique code for the step.
498
+ """
499
+
492
500
  pull_training_data = "PULL_TRAINING_DATA"
493
501
  analyze_training_data = "ANALYZE_TRAINING_DATA"
494
502
  encode_training_data = "ENCODE_TRAINING_DATA"
@@ -500,6 +508,7 @@ class StepCode(str, Enum):
500
508
  create_data_report = "CREATE_DATA_REPORT"
501
509
  finalize_generation = "FINALIZE_GENERATION"
502
510
  deliver_data = "DELIVER_DATA"
511
+ finalize_probing = "FINALIZE_PROBING"
503
512
 
504
513
 
505
514
  class ProgressValue(CustomBaseModel):
@@ -841,7 +850,7 @@ class OrganizationListItem(CustomBaseModel):
841
850
  )
842
851
  display_name: str = Field(..., alias="displayName", description="The display name of an organization.")
843
852
  description: str | None = Field(None, description="The description of an organization. Supports markdown.")
844
- logo: AnyUrl | None = Field(None, description="The URL of the organization's logo.")
853
+ logo: str | None = Field(None, description="The URL of the organization's logo.")
845
854
 
846
855
 
847
856
  class MemberRole(str, Enum):
@@ -912,7 +921,7 @@ class OrganizationConfig(CustomBaseModel):
912
921
  description="The base64-encoded image of the organization's logo.",
913
922
  )
914
923
  email: str | None = Field(None, description="The email address of the organization.")
915
- website: AnyUrl | None = Field(None, description="The URL of the organization's website.")
924
+ website: str | None = Field(None, description="The URL of the organization's website.")
916
925
 
917
926
 
918
927
  class OrganizationPatchConfig(CustomBaseModel):
@@ -933,7 +942,7 @@ class OrganizationPatchConfig(CustomBaseModel):
933
942
  description="The base64-encoded image of the organization's logo.",
934
943
  )
935
944
  email: str | None = Field(None, description="The email address of the organization.")
936
- website: AnyUrl | None = Field(None, description="The URL of the organization's website.")
945
+ website: str | None = Field(None, description="The URL of the organization's website.")
937
946
 
938
947
 
939
948
  class MemberRolePatchConfig(CustomBaseModel):
@@ -1008,9 +1017,10 @@ class ModelEncodingType(str, Enum):
1008
1017
  - `TABULAR_DATETIME`: Model samples each part of a datetime value.
1009
1018
  - `TABULAR_DATETIME_RELATIVE`: Model samples the relative difference between datetimes within a sequence.
1010
1019
  - `TABULAR_LAT_LONG`: Model samples a latitude-longitude column. The format is "latitude,longitude".
1011
- - `LANGUAGE_TEXT`: Model will train a distinct LANGUAGE model for this column, to then generate free text.
1012
-
1013
- Encoding types, that are not being prefixed with either `TABULAR` or `LANGUAGE` have been deprecated.
1020
+ - `LANGUAGE_TEXT`: Model will sample free text, using a LANGUAGE model.
1021
+ - `LANGUAGE_CATEGORICAL`: Model samples from existing (non-rare) categories, using a LANGUAGE model.
1022
+ - `LANGUAGE_NUMERIC`: Model samples from the valid numeric value range, using a LANGUAGE model.
1023
+ - `LANGUAGE_DATETIME`: Model samples from the valid datetime value range, using a LANGUAGE model.
1014
1024
 
1015
1025
  """
1016
1026
 
@@ -1025,6 +1035,9 @@ class ModelEncodingType(str, Enum):
1025
1035
  tabular_datetime_relative = "TABULAR_DATETIME_RELATIVE"
1026
1036
  tabular_lat_long = "TABULAR_LAT_LONG"
1027
1037
  language_text = "LANGUAGE_TEXT"
1038
+ language_categorical = "LANGUAGE_CATEGORICAL"
1039
+ language_numeric = "LANGUAGE_NUMERIC"
1040
+ language_datetime = "LANGUAGE_DATETIME"
1028
1041
 
1029
1042
 
1030
1043
  class RebalancingConfig(CustomBaseModel):
@@ -1316,7 +1329,7 @@ class User(CustomBaseModel):
1316
1329
  first_name: str | None = Field(None, alias="firstName", description="First name of a user", max_length=30)
1317
1330
  last_name: str | None = Field(None, alias="lastName", description="Last name of a user", max_length=30)
1318
1331
  email: str | None = Field(None, description="The email of a user")
1319
- avatar: AnyUrl | None = Field(None, description="The URL of the user's avatar")
1332
+ avatar: str | None = Field(None, description="The URL of the user's avatar")
1320
1333
 
1321
1334
 
1322
1335
  class UserListItem(CustomBaseModel):
@@ -1329,7 +1342,7 @@ class UserListItem(CustomBaseModel):
1329
1342
  None,
1330
1343
  description="The name of a user. As of now, it is the concatenation of the first name and last name.",
1331
1344
  )
1332
- avatar: AnyUrl | None = Field(None, description="The URL of the user's avatar")
1345
+ avatar: str | None = Field(None, description="The URL of the user's avatar")
1333
1346
 
1334
1347
 
1335
1348
  class CurrentUser(CustomBaseModel):
@@ -1341,7 +1354,7 @@ class CurrentUser(CustomBaseModel):
1341
1354
  first_name: str | None = Field(None, alias="firstName", description="First name of a user", max_length=30)
1342
1355
  last_name: str | None = Field(None, alias="lastName", description="Last name of a user", max_length=30)
1343
1356
  email: str | None = Field(None, description="The email of a user")
1344
- avatar: AnyUrl | None = Field(None, description="The URL of the user's avatar")
1357
+ avatar: str | None = Field(None, description="The URL of the user's avatar")
1345
1358
  settings: dict[str, Any] | None = None
1346
1359
  usage: UserUsage | None = None
1347
1360
  unread_notifications: int | None = Field(
@@ -1427,7 +1440,7 @@ class Metadata(CustomBaseModel):
1427
1440
  description="The name of an account (either a user or an organization).",
1428
1441
  )
1429
1442
  owner_type: AccountType | None = Field(None, alias="ownerType")
1430
- owner_image: AnyUrl | None = Field(None, alias="ownerImage", description="The URL of the account's image.")
1443
+ owner_image: str | None = Field(None, alias="ownerImage", description="The URL of the account's image.")
1431
1444
  visibility: Visibility | None = None
1432
1445
  current_user_permission_level: PermissionLevel | None = Field(None, alias="currentUserPermissionLevel")
1433
1446
  current_user_like_status: bool | None = Field(
@@ -1913,7 +1926,8 @@ class SyntheticTableConfiguration(CustomBaseModel):
1913
1926
  def convert_data_before(cls, value):
1914
1927
  return (
1915
1928
  convert_to_base64(value)
1916
- if isinstance(value, pd.DataFrame) or value.__class__.__module__ == "pyspark.sql.dataframe"
1929
+ if isinstance(value, pd.DataFrame)
1930
+ or (value.__class__.__name__ == "DataFrame" and value.__class__.__module__.startswith("pyspark.sql"))
1917
1931
  else value
1918
1932
  )
1919
1933
 
@@ -2010,9 +2024,9 @@ class Organization(CustomBaseModel):
2010
2024
  )
2011
2025
  display_name: str = Field(..., alias="displayName", description="The display name of an organization.")
2012
2026
  description: str | None = Field(None, description="The description of an organization. Supports markdown.")
2013
- logo: AnyUrl | None = Field(None, description="The URL of the organization's logo.")
2027
+ logo: str | None = Field(None, description="The URL of the organization's logo.")
2014
2028
  email: str | None = Field(None, description="The email address of the organization.")
2015
- website: AnyUrl | None = Field(None, description="The URL of the organization's website.")
2029
+ website: str | None = Field(None, description="The URL of the organization's website.")
2016
2030
  members: list[UserListItem] | None = None
2017
2031
 
2018
2032
 
@@ -2129,7 +2143,12 @@ class SourceTableConfig(CustomBaseModel):
2129
2143
  @field_validator("data", mode="before")
2130
2144
  @classmethod
2131
2145
  def convert_data_before(cls, value):
2132
- return convert_to_base64(value) if isinstance(value, pd.DataFrame) else value
2146
+ return (
2147
+ convert_to_base64(value)
2148
+ if isinstance(value, pd.DataFrame)
2149
+ or (value.__class__.__name__ == "DataFrame" and value.__class__.__module__.startswith("pyspark.sql"))
2150
+ else value
2151
+ )
2133
2152
 
2134
2153
  @field_validator("columns", mode="before")
2135
2154
  @classmethod
@@ -2158,8 +2177,8 @@ class SourceTableConfig(CustomBaseModel):
2158
2177
  keys.append(values.primary_key)
2159
2178
  model_columns = [c for c in values.columns if c.name not in keys]
2160
2179
  enc_types = [c.model_encoding_type or ModelEncodingType.auto for c in model_columns]
2161
- has_tabular_model = any(not enc_type.startswith("LANGUAGE_") for enc_type in enc_types)
2162
- has_language_model = any(enc_type.startswith("LANGUAGE_") for enc_type in enc_types)
2180
+ has_tabular_model = any(not enc_type.startswith(ModelType.language) for enc_type in enc_types)
2181
+ has_language_model = any(enc_type.startswith(ModelType.language) for enc_type in enc_types)
2163
2182
  else:
2164
2183
  has_tabular_model = True
2165
2184
  has_language_model = False
@@ -2955,11 +2974,6 @@ class _SyntheticTableConfigValidation(CustomBaseModel):
2955
2974
  def validate_rebalancing_config(cls, validation):
2956
2975
  config = validation.synthetic_table.configuration
2957
2976
  if config and config.rebalancing:
2958
- has_tabular_model = validation.source_table.tabular_model_configuration is not None
2959
- if not has_tabular_model:
2960
- raise ValueError(
2961
- f"Table '{validation.source_table.name}' specifies rebalancing but has no tabular model"
2962
- )
2963
2977
  rebalancing_column = config.rebalancing.column
2964
2978
  rebalancing_col = next(
2965
2979
  (col for col in validation.source_table.columns or [] if col.name == rebalancing_column), None
@@ -2972,6 +2986,10 @@ class _SyntheticTableConfigValidation(CustomBaseModel):
2972
2986
  raise ValueError(
2973
2987
  f"Rebalancing column '{rebalancing_column}' in table '{validation.source_table.name}' must be categorical"
2974
2988
  )
2989
+ if not rebalancing_col.included:
2990
+ raise ValueError(
2991
+ f"Rebalancing column '{rebalancing_column}' in table '{validation.source_table.name}' must have `included=True`"
2992
+ )
2975
2993
  for value in config.rebalancing.probabilities.keys():
2976
2994
  if value not in rebalancing_col.value_range.values:
2977
2995
  raise ValueError(
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.1.7"
3
+ version = "4.2.1"
4
4
  description = "Synthetic Data SDK"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
6
  requires-python = ">=3.10,<3.14"
@@ -47,20 +47,20 @@ dependencies = [
47
47
  "openpyxl>=3.1.5",
48
48
  "networkx>=3.0,<4",
49
49
  "ipywidgets>=8.1.0",
50
- # cloud-based connectors
51
- "s3fs>=2023.1.0,<2024",
52
- "gcsfs>=2023.1.0,<2024",
53
- "cloudpathlib[gs, s3, azure]>=0.17.0,<0.18",
54
- "smart-open[gcs, s3, azure]>=6.3.0,<7",
55
- "azure-storage-blob>=12.16.0,<13",
56
- "adlfs>=2023.4.0,<2024",
57
50
  "filelock>=3.16.1",
51
+ # cloud-based connectors
52
+ "s3fs>=2023.1.0",
53
+ "gcsfs>=2023.1.0",
54
+ "cloudpathlib[gs, s3, azure]>=0.17.0",
55
+ "smart-open[gcs, s3, azure]>=6.3.0",
56
+ "azure-storage-blob>=12.16.0",
57
+ "adlfs>=2023.4.0",
58
58
  ]
59
59
 
60
60
  [project.optional-dependencies]
61
61
  local = [
62
62
  # local
63
- "mostlyai-engine==1.0.4",
63
+ "mostlyai-engine==1.1.4",
64
64
  "mostlyai-qa==1.5.5",
65
65
  "fastapi>=0.115.6,<0.116",
66
66
  "uvicorn>=0.34.0,<0.35",
@@ -68,7 +68,7 @@ local = [
68
68
  "torch>=2.5.1,<2.6.0",
69
69
  ]
70
70
  local-gpu = [
71
- "mostlyai-engine[gpu]==1.0.4",
71
+ "mostlyai-engine[gpu]==1.1.4",
72
72
  "mostlyai-qa[gpu]==1.5.5",
73
73
  "fastapi>=0.115.6,<0.116",
74
74
  "uvicorn>=0.34.0,<0.35",
@@ -76,7 +76,7 @@ local-gpu = [
76
76
  "torch>=2.5.1,<2.6.0",
77
77
  ]
78
78
  local-cpu = [
79
- "mostlyai-engine[cpu]==1.0.4",
79
+ "mostlyai-engine[cpu]==1.1.4",
80
80
  "mostlyai-qa[cpu]==1.5.5",
81
81
  "fastapi>=0.115.6,<0.116",
82
82
  "uvicorn>=0.34.0,<0.35",
File without changes
File without changes