mostlyai 5.2.7__tar.gz → 5.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. {mostlyai-5.2.7 → mostlyai-5.3.0}/PKG-INFO +1 -1
  2. mostlyai-5.3.0/mostlyai/sdk/__init__.py +52 -0
  3. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/domain.py +134 -121
  4. {mostlyai-5.2.7 → mostlyai-5.3.0}/pyproject.toml +1 -1
  5. mostlyai-5.2.7/mostlyai/sdk/__init__.py +0 -18
  6. {mostlyai-5.2.7 → mostlyai-5.3.0}/.gitignore +0 -0
  7. {mostlyai-5.2.7 → mostlyai-5.3.0}/LICENSE +0 -0
  8. {mostlyai-5.2.7 → mostlyai-5.3.0}/README.md +0 -0
  9. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/__init__.py +0 -0
  10. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/auto_detect.py +0 -0
  11. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/base.py +0 -0
  12. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/context.py +0 -0
  13. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/conversions.py +0 -0
  14. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/__init__.py +0 -0
  15. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/base.py +0 -0
  16. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  17. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/databricks.py +0 -0
  18. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/hive.py +0 -0
  19. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/mssql.py +0 -0
  20. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/mysql.py +0 -0
  21. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/oracle.py +0 -0
  22. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  23. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/redshift.py +0 -0
  24. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  25. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  26. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  27. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/dtype.py +0 -0
  28. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/exceptions.py +0 -0
  29. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/__init__.py +0 -0
  30. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/base.py +0 -0
  31. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  32. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  33. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  34. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  35. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  36. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  37. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  38. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  39. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  40. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/table/json.py +0 -0
  41. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  42. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/file/utils.py +0 -0
  43. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/language_model.py +0 -0
  44. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  45. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/non_context.py +0 -0
  46. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/progress_callback.py +0 -0
  47. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/pull.py +0 -0
  48. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/pull_context.py +0 -0
  49. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/pull_utils.py +0 -0
  50. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/push.py +0 -0
  51. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/util/__init__.py +0 -0
  52. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/util/common.py +0 -0
  53. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  54. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/__init__.py +0 -0
  55. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/cli.py +0 -0
  56. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/connectors.py +0 -0
  57. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  58. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  59. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/migration.py +0 -0
  60. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/plan.py +0 -0
  61. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  62. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  63. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  64. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  65. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  66. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  67. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  68. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  69. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  70. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_pull_training_data.py +0 -0
  71. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  72. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/generators.py +0 -0
  73. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/progress.py +0 -0
  74. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/routes.py +0 -0
  75. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/server.py +0 -0
  76. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/storage.py +0 -0
  77. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  78. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/__init__.py +0 -0
  79. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/_base_utils.py +0 -0
  80. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  81. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/_utils.py +0 -0
  82. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/api.py +0 -0
  83. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/artifacts.py +0 -0
  84. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/base.py +0 -0
  85. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/connectors.py +0 -0
  86. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/datasets.py +0 -0
  87. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/exceptions.py +0 -0
  88. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/generators.py +0 -0
  89. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  90. {mostlyai-5.2.7 → mostlyai-5.3.0}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 5.2.7
3
+ Version: 5.3.0
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
@@ -0,0 +1,52 @@
1
+ # Copyright 2024-2025 MOSTLY AI
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ """Synthetic Data SDK - Python toolkit for high-fidelity, privacy-safe synthetic data.
16
+
17
+ The SDK supports two operating modes:
18
+ - LOCAL mode: Train and generate synthetic data locally on your own compute resources
19
+ - CLIENT mode: Connect to a remote MOSTLY AI platform for training & generation
20
+
21
+ Key Resources
22
+ -------------
23
+ The SDK manages four core resources:
24
+
25
+ 1. **Generators** - Train synthetic data generators on tabular or language data
26
+ 2. **Synthetic Datasets** - Create synthetic samples from trained generators
27
+ 3. **Connectors** - Connect to data sources (databases, cloud storage)
28
+ 4. **Datasets** - Create datasets with instructions (CLIENT mode only)
29
+
30
+ Core Operations
31
+ ---------------
32
+ - `mostly.train(config)` - Train a generator on tabular or language data
33
+ - `mostly.generate(g, config)` - Generate synthetic data records
34
+ - `mostly.probe(g, config)` - Live probe the generator on demand
35
+ - `mostly.connect(config)` - Connect to external data sources
36
+
37
+ Key Features
38
+ ------------
39
+ - Broad data support (mixed-type, single/multi-table, time-series)
40
+ - Multiple model types (TabularARGN, Hugging Face LLMs, LSTM)
41
+ - Advanced training options (GPU/CPU, Differential Privacy)
42
+ - Automated quality assurance with metrics and HTML reports
43
+ - Flexible sampling (up-sampling, conditional simulation, rebalancing)
44
+ - Seamless integration with external data sources
45
+
46
+ For more information, visit: https://mostly-ai.github.io/mostlyai/
47
+ """
48
+
49
+ from mostlyai.sdk.client.api import MostlyAI
50
+
51
+ __all__ = ["MostlyAI"]
52
+ __version__ = "5.3.0" # Do not set this manually. Use poetry version [params].
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # generated by datamodel-codegen:
16
- # timestamp: 2025-10-06T08:16:25+00:00
16
+ # timestamp: 2025-10-08T14:06:22+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -893,6 +893,11 @@ class SyntheticDatasetSortField(str, Enum):
893
893
  no_of_threads = "NO_OF_THREADS"
894
894
 
895
895
 
896
+ class ArtifactSortField(str, Enum):
897
+ recency = "RECENCY"
898
+ no_of_threads = "NO_OF_THREADS"
899
+
900
+
896
901
  class AssistantLiteLlmExtraItem(CustomBaseModel):
897
902
  """
898
903
  Configuration parameter for the selected LiteLLM model.
@@ -2618,15 +2623,14 @@ class ModelConfiguration(CustomBaseModel):
2618
2623
  )
2619
2624
 
2620
2625
  @model_validator(mode="after")
2621
- @classmethod
2622
- def validate_differential_privacy_config(cls, values):
2623
- if values.differential_privacy:
2624
- if not values.value_protection:
2625
- values.differential_privacy.value_protection_epsilon = None
2626
+ def validate_differential_privacy_config(self):
2627
+ if self.differential_privacy:
2628
+ if not self.value_protection:
2629
+ self.differential_privacy.value_protection_epsilon = None
2626
2630
  else:
2627
- if values.differential_privacy.value_protection_epsilon is None:
2628
- values.differential_privacy.value_protection_epsilon = 1.0
2629
- return values
2631
+ if self.differential_privacy.value_protection_epsilon is None:
2632
+ self.differential_privacy.value_protection_epsilon = 1.0
2633
+ return self
2630
2634
 
2631
2635
 
2632
2636
  class ProgressStep(CustomBaseModel):
@@ -2669,15 +2673,14 @@ class ProgressStep(CustomBaseModel):
2669
2673
  status: ProgressStatus | None = None
2670
2674
 
2671
2675
  @model_validator(mode="after")
2672
- @classmethod
2673
- def add_required_fields(cls, values):
2674
- if values.id is None:
2675
- values.id = str(uuid.uuid4())
2676
- if values.status is None:
2677
- values.status = ProgressStatus.new
2678
- if values.compute_name is None:
2679
- values.compute_name = "SDK"
2680
- return values
2676
+ def add_required_fields(self):
2677
+ if self.id is None:
2678
+ self.id = str(uuid.uuid4())
2679
+ if self.status is None:
2680
+ self.status = ProgressStatus.new
2681
+ if self.compute_name is None:
2682
+ self.compute_name = "SDK"
2683
+ return self
2681
2684
 
2682
2685
 
2683
2686
  class SyntheticDatasetListItem(CustomBaseModel):
@@ -2771,13 +2774,12 @@ class SyntheticTableConfiguration(CustomBaseModel):
2771
2774
  )
2772
2775
 
2773
2776
  @model_validator(mode="after")
2774
- @classmethod
2775
- def add_required_fields(cls, values):
2776
- if values.sampling_temperature is None:
2777
- values.sampling_temperature = 1.0
2778
- if values.sampling_top_p is None:
2779
- values.sampling_top_p = 1.0
2780
- return values
2777
+ def add_required_fields(self):
2778
+ if self.sampling_temperature is None:
2779
+ self.sampling_temperature = 1.0
2780
+ if self.sampling_top_p is None:
2781
+ self.sampling_top_p = 1.0
2782
+ return self
2781
2783
 
2782
2784
 
2783
2785
  class SyntheticDatasetPatchConfig(CustomBaseModel):
@@ -2819,11 +2821,10 @@ class SyntheticTableConfig(CustomBaseModel):
2819
2821
  configuration: SyntheticTableConfiguration | None = None
2820
2822
 
2821
2823
  @model_validator(mode="after")
2822
- @classmethod
2823
- def add_configuration(cls, values):
2824
- if values.configuration is None:
2825
- values.configuration = SyntheticTableConfiguration()
2826
- return values
2824
+ def add_configuration(self):
2825
+ if self.configuration is None:
2826
+ self.configuration = SyntheticTableConfiguration()
2827
+ return self
2827
2828
 
2828
2829
  def validate_against_source_table(self, source_table: SourceTable, is_probe: bool) -> None:
2829
2830
  self._maybe_set_sample_size(source_table, is_probe)
@@ -2850,6 +2851,7 @@ class AssistantThreadListItem(CustomBaseModel):
2850
2851
  id: str = Field(..., description="The unique identifier of a assistant thread.")
2851
2852
  metadata: Metadata | None = None
2852
2853
  name: str = Field(..., description="The name of a assistant thread.")
2854
+ session_status: AssistantThreadSessionStatus = Field(..., alias="sessionStatus")
2853
2855
  usage: AssistantThreadUsage | None = None
2854
2856
 
2855
2857
 
@@ -2885,14 +2887,14 @@ class Artifact(CustomBaseModel):
2885
2887
 
2886
2888
  id: str = Field(..., description="The unique identifier of an artifact.")
2887
2889
  name: str = Field(..., description="The name/title of an artifact.", max_length=256, min_length=1)
2888
- file_name: str | None = Field(None, alias="fileName", description="The filename of an artifact.")
2890
+ file_name: str = Field(..., alias="fileName", description="The filename of an artifact.")
2889
2891
  description: str = Field(
2890
2892
  ...,
2891
2893
  description="The description/prompt of an artifact that explains how to recreate it.",
2892
2894
  )
2893
2895
  type: ArtifactType | None = None
2894
2896
  preview: ArtifactPreview | None = None
2895
- download_url: str | None = Field(None, alias="downloadUrl", description="URL to download the artifact.")
2897
+ download_url: str = Field(..., alias="downloadUrl", description="URL to download the artifact.")
2896
2898
  shareable_url: str = Field(
2897
2899
  ...,
2898
2900
  alias="shareableUrl",
@@ -2930,6 +2932,30 @@ class Artifact(CustomBaseModel):
2930
2932
  self.reload()
2931
2933
 
2932
2934
 
2935
+ class ArtifactListItem(CustomBaseModel):
2936
+ """
2937
+ Essential artifact details for listings.
2938
+ """
2939
+
2940
+ id: str = Field(..., description="The unique identifier of an artifact.")
2941
+ name: str = Field(..., description="The name/title of an artifact.", max_length=256, min_length=1)
2942
+ file_name: str = Field(..., alias="fileName", description="The filename of an artifact.")
2943
+ description: str = Field(
2944
+ ...,
2945
+ description="The description/prompt of an artifact that explains how to recreate it.",
2946
+ )
2947
+ type: ArtifactType | None = None
2948
+ preview: ArtifactPreview | None = None
2949
+ download_url: str = Field(..., alias="downloadUrl", description="URL to download the artifact.")
2950
+ shareable_url: str = Field(
2951
+ ...,
2952
+ alias="shareableUrl",
2953
+ description="Public URL where the artifact can be viewed and shared.",
2954
+ )
2955
+ usage: ArtifactUsage | None = None
2956
+ metadata: Metadata | None = None
2957
+
2958
+
2933
2959
  class OrganizationMetadata(CustomBaseModel):
2934
2960
  """
2935
2961
  The metadata of an organization.
@@ -3119,13 +3145,12 @@ class SourceTableConfig(CustomBaseModel):
3119
3145
  return included_columns
3120
3146
 
3121
3147
  @model_validator(mode="after")
3122
- @classmethod
3123
- def add_model_configuration(cls, values):
3148
+ def add_model_configuration(self):
3124
3149
  # Check if the table has a tabular and/or a language model
3125
- columns = values.columns or []
3126
- keys = [fk.column for fk in values.foreign_keys or []]
3127
- if values.primary_key:
3128
- keys.append(values.primary_key)
3150
+ columns = self.columns or []
3151
+ keys = [fk.column for fk in self.foreign_keys or []]
3152
+ if self.primary_key:
3153
+ keys.append(self.primary_key)
3129
3154
  model_columns = [c for c in columns if c.name not in keys]
3130
3155
  if model_columns:
3131
3156
  enc_types = [c.model_encoding_type or ModelEncodingType.auto for c in model_columns]
@@ -3135,24 +3160,24 @@ class SourceTableConfig(CustomBaseModel):
3135
3160
  has_tabular_model = True
3136
3161
  has_language_model = False
3137
3162
  # Always train tabular model for tables with a primary key or linked tables to model sequences
3138
- if values.primary_key or (values.foreign_keys and any(fk.is_context for fk in values.foreign_keys)):
3163
+ if self.primary_key or (self.foreign_keys and any(fk.is_context for fk in self.foreign_keys)):
3139
3164
  has_tabular_model = True
3140
3165
  # Remove model configurations that are not applicable for the model type
3141
- if values.tabular_model_configuration and not has_tabular_model:
3142
- values.tabular_model_configuration = None
3143
- if values.language_model_configuration and not has_language_model:
3144
- values.language_model_configuration = None
3166
+ if self.tabular_model_configuration and not has_tabular_model:
3167
+ self.tabular_model_configuration = None
3168
+ if self.language_model_configuration and not has_language_model:
3169
+ self.language_model_configuration = None
3145
3170
  # Add default model configurations if none were provided
3146
- if has_tabular_model and not values.tabular_model_configuration:
3171
+ if has_tabular_model and not self.tabular_model_configuration:
3147
3172
  default_model = "MOSTLY_AI/Medium"
3148
- values.tabular_model_configuration = ModelConfiguration(model=default_model)
3149
- if has_language_model and not values.language_model_configuration:
3173
+ self.tabular_model_configuration = ModelConfiguration(model=default_model)
3174
+ if has_language_model and not self.language_model_configuration:
3150
3175
  default_model = "MOSTLY_AI/LSTMFromScratch-3m"
3151
- values.language_model_configuration = ModelConfiguration(model=default_model, max_sequence_window=None)
3152
- if has_language_model and values.language_model_configuration:
3176
+ self.language_model_configuration = ModelConfiguration(model=default_model, max_sequence_window=None)
3177
+ if has_language_model and self.language_model_configuration:
3153
3178
  # language models atm do not support max_sequence_window; thus set configuration to None
3154
- values.language_model_configuration.max_sequence_window = None
3155
- return values
3179
+ self.language_model_configuration.max_sequence_window = None
3180
+ return self
3156
3181
 
3157
3182
  @field_validator("columns", mode="after")
3158
3183
  @classmethod
@@ -3164,15 +3189,14 @@ class SourceTableConfig(CustomBaseModel):
3164
3189
  return columns
3165
3190
 
3166
3191
  @model_validator(mode="after")
3167
- @classmethod
3168
- def validate_unique_keys(cls, values):
3169
- pk = values.primary_key or []
3170
- fks = [fk.column for fk in values.foreign_keys or []]
3192
+ def validate_unique_keys(self):
3193
+ pk = self.primary_key or []
3194
+ fks = [fk.column for fk in self.foreign_keys or []]
3171
3195
  if len(fks) != len(set(fks)):
3172
3196
  raise ValueError("Foreign key column names must be unique.")
3173
3197
  if pk in fks:
3174
3198
  raise ValueError("Primary key column name must not be defined as foreign key.")
3175
- return values
3199
+ return self
3176
3200
 
3177
3201
  @field_validator("foreign_keys", mode="after")
3178
3202
  @classmethod
@@ -3184,26 +3208,24 @@ class SourceTableConfig(CustomBaseModel):
3184
3208
  return foreign_keys
3185
3209
 
3186
3210
  @model_validator(mode="after")
3187
- @classmethod
3188
- def validate_keys_exists_in_columns(cls, values):
3189
- if values.columns:
3190
- column_names = {col.name for col in values.columns}
3191
- pk = values.primary_key
3211
+ def validate_keys_exists_in_columns(self):
3212
+ if self.columns:
3213
+ column_names = {col.name for col in self.columns}
3214
+ pk = self.primary_key
3192
3215
  if pk and pk not in column_names:
3193
3216
  raise ValueError(f"Primary key column '{pk}' does not exist in the table's columns.")
3194
- for fk in values.foreign_keys or []:
3217
+ for fk in self.foreign_keys or []:
3195
3218
  if fk.column not in column_names:
3196
3219
  raise ValueError(f"Foreign key column '{fk.column}' does not exist in the table's columns.")
3197
- return values
3220
+ return self
3198
3221
 
3199
3222
  @model_validator(mode="after")
3200
- @classmethod
3201
- def validate_pk_and_fks_are_not_overlapping(cls, values):
3202
- primary_key = values.primary_key
3203
- foreign_keys = [fk.column for fk in values.foreign_keys or []]
3223
+ def validate_pk_and_fks_are_not_overlapping(self):
3224
+ primary_key = self.primary_key
3225
+ foreign_keys = [fk.column for fk in self.foreign_keys or []]
3204
3226
  if primary_key and primary_key in foreign_keys:
3205
3227
  raise ValueError(f"Column '{primary_key}' is both a primary key and a foreign key.")
3206
- return values
3228
+ return self
3207
3229
 
3208
3230
 
3209
3231
  class SourceTablePatchConfig(CustomBaseModel):
@@ -4035,81 +4057,72 @@ class _SyntheticTableConfigValidation(CustomBaseModel):
4035
4057
  source_table: SourceTable
4036
4058
 
4037
4059
  @model_validator(mode="after")
4038
- def validate_rebalancing_config(cls, validation):
4039
- config = validation.synthetic_table.configuration
4060
+ def validate_rebalancing_config(self):
4061
+ config = self.synthetic_table.configuration
4040
4062
  if config and config.rebalancing:
4041
4063
  rebalancing_column = config.rebalancing.column
4042
4064
  rebalancing_col = next(
4043
- (col for col in validation.source_table.columns or [] if col.name == rebalancing_column), None
4065
+ (col for col in self.source_table.columns or [] if col.name == rebalancing_column), None
4044
4066
  )
4045
4067
  if not rebalancing_col:
4046
4068
  raise ValueError(
4047
- f"Rebalancing column '{rebalancing_column}' not found in table '{validation.source_table.name}'"
4069
+ f"Rebalancing column '{rebalancing_column}' not found in table '{self.source_table.name}'"
4048
4070
  )
4049
4071
  if not rebalancing_col.model_encoding_type == ModelEncodingType.tabular_categorical:
4050
4072
  raise ValueError(
4051
- f"Rebalancing column '{rebalancing_column}' in table '{validation.source_table.name}' must be categorical"
4073
+ f"Rebalancing column '{rebalancing_column}' in table '{self.source_table.name}' must be categorical"
4052
4074
  )
4053
4075
  if not rebalancing_col.included:
4054
4076
  raise ValueError(
4055
- f"Rebalancing column '{rebalancing_column}' in table '{validation.source_table.name}' must have `included=True`"
4077
+ f"Rebalancing column '{rebalancing_column}' in table '{self.source_table.name}' must have `included=True`"
4056
4078
  )
4057
4079
  for value in config.rebalancing.probabilities.keys():
4058
4080
  if value not in rebalancing_col.value_range.values:
4059
4081
  raise ValueError(
4060
- f"Rebalancing value '{value}' not found in table '{validation.source_table.name}' column '{rebalancing_column}'"
4082
+ f"Rebalancing value '{value}' not found in table '{self.source_table.name}' column '{rebalancing_column}'"
4061
4083
  )
4062
- return validation
4084
+ return self
4063
4085
 
4064
4086
  @model_validator(mode="after")
4065
- def validate_imputation_config(cls, validation):
4066
- config = validation.synthetic_table.configuration
4087
+ def validate_imputation_config(self):
4088
+ config = self.synthetic_table.configuration
4067
4089
  if config and config.imputation:
4068
- has_tabular_model = validation.source_table.tabular_model_configuration is not None
4090
+ has_tabular_model = self.source_table.tabular_model_configuration is not None
4069
4091
  if not has_tabular_model:
4070
- raise ValueError(
4071
- f"Table '{validation.source_table.name}' specifies imputation but has no tabular model"
4072
- )
4092
+ raise ValueError(f"Table '{self.source_table.name}' specifies imputation but has no tabular model")
4073
4093
  for col in config.imputation.columns:
4074
- if not any(gcol.name == col for gcol in validation.source_table.columns or []):
4075
- raise ValueError(f"Imputation column '{col}' not found in table '{validation.source_table.name}'")
4076
- return validation
4094
+ if not any(gcol.name == col for gcol in self.source_table.columns or []):
4095
+ raise ValueError(f"Imputation column '{col}' not found in table '{self.source_table.name}'")
4096
+ return self
4077
4097
 
4078
4098
  @model_validator(mode="after")
4079
- def validate_fairness_config(cls, validation):
4080
- config = validation.synthetic_table.configuration
4099
+ def validate_fairness_config(self):
4100
+ config = self.synthetic_table.configuration
4081
4101
  if config and config.fairness:
4082
- has_tabular_model = validation.source_table.tabular_model_configuration is not None
4102
+ has_tabular_model = self.source_table.tabular_model_configuration is not None
4083
4103
  if not has_tabular_model:
4084
- raise ValueError(f"Table '{validation.source_table.name}' specifies fairness but has no tabular model")
4104
+ raise ValueError(f"Table '{self.source_table.name}' specifies fairness but has no tabular model")
4085
4105
  target_col = config.fairness.target_column
4086
- if not any(col.name == target_col for col in validation.source_table.columns or []):
4087
- raise ValueError(
4088
- f"Fairness target column '{target_col}' not found in table '{validation.source_table.name}'"
4089
- )
4106
+ if not any(col.name == target_col for col in self.source_table.columns or []):
4107
+ raise ValueError(f"Fairness target column '{target_col}' not found in table '{self.source_table.name}'")
4090
4108
  for col in config.fairness.sensitive_columns:
4091
- if not any(gcol.name == col for gcol in validation.source_table.columns or []):
4092
- raise ValueError(
4093
- f"Fairness sensitive column '{col}' not found in table '{validation.source_table.name}'"
4094
- )
4109
+ if not any(gcol.name == col for gcol in self.source_table.columns or []):
4110
+ raise ValueError(f"Fairness sensitive column '{col}' not found in table '{self.source_table.name}'")
4095
4111
  if target_col in config.fairness.sensitive_columns:
4096
4112
  raise ValueError(f"Target column '{target_col}' cannot be a sensitive column")
4097
- return validation
4113
+ return self
4098
4114
 
4099
4115
  @model_validator(mode="after")
4100
- def validate_data_report_disabled_if_both_model_reports_disabled(cls, validation):
4116
+ def validate_data_report_disabled_if_both_model_reports_disabled(self):
4101
4117
  configs = [
4102
4118
  cfg
4103
- for cfg in [
4104
- validation.source_table.tabular_model_configuration,
4105
- validation.source_table.language_model_configuration,
4106
- ]
4119
+ for cfg in [self.source_table.tabular_model_configuration, self.source_table.language_model_configuration]
4107
4120
  if cfg
4108
4121
  ]
4109
4122
  if all(cfg.enable_model_report is False for cfg in configs):
4110
- if validation.synthetic_table.configuration is not None:
4111
- validation.synthetic_table.configuration.enable_data_report = False
4112
- return validation
4123
+ if self.synthetic_table.configuration is not None:
4124
+ self.synthetic_table.configuration.enable_data_report = False
4125
+ return self
4113
4126
 
4114
4127
 
4115
4128
  class _SyntheticDataConfigValidation(CustomBaseModel):
@@ -4121,38 +4134,38 @@ class _SyntheticDataConfigValidation(CustomBaseModel):
4121
4134
  generator: Generator
4122
4135
 
4123
4136
  @model_validator(mode="after")
4124
- def add_missing_tables(cls, validation):
4125
- generator_table_map = {t.name: t for t in validation.generator.tables}
4126
- if validation.synthetic_config.tables is None:
4127
- validation.synthetic_config.tables = []
4128
- synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables}
4137
+ def add_missing_tables(self):
4138
+ generator_table_map = {t.name: t for t in self.generator.tables}
4139
+ if self.synthetic_config.tables is None:
4140
+ self.synthetic_config.tables = []
4141
+ synthetic_table_map = {t.name: t for t in self.synthetic_config.tables}
4129
4142
  missing_tables = set(generator_table_map.keys()) - set(synthetic_table_map.keys())
4130
4143
  for t in missing_tables:
4131
- validation.synthetic_config.tables.append(SyntheticTableConfig(name=t))
4132
- return validation
4144
+ self.synthetic_config.tables.append(SyntheticTableConfig(name=t))
4145
+ return self
4133
4146
 
4134
4147
  @model_validator(mode="after")
4135
- def validate_no_extra_tables(cls, validation):
4136
- generator_table_map = {t.name: t for t in validation.generator.tables}
4137
- synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
4148
+ def validate_no_extra_tables(self):
4149
+ generator_table_map = {t.name: t for t in self.generator.tables}
4150
+ synthetic_table_map = {t.name: t for t in self.synthetic_config.tables or []}
4138
4151
  generator_tables = set(generator_table_map.keys())
4139
4152
  extra_tables = set(synthetic_table_map.keys()) - generator_tables
4140
4153
  if extra_tables:
4141
4154
  raise ValueError(
4142
4155
  f"Tables {extra_tables} are not present in the generator. Only {generator_tables} are available."
4143
4156
  )
4144
- return validation
4157
+ return self
4145
4158
 
4146
4159
  @model_validator(mode="after")
4147
- def validate_tables(cls, validation):
4148
- generator_table_map = {t.name: t for t in validation.generator.tables}
4149
- synthetic_table_map = {t.name: t for t in validation.synthetic_config.tables or []}
4160
+ def validate_tables(self):
4161
+ generator_table_map = {t.name: t for t in self.generator.tables}
4162
+ synthetic_table_map = {t.name: t for t in self.synthetic_config.tables or []}
4150
4163
  for table_name, synthetic_table in synthetic_table_map.items():
4151
4164
  generator_table = generator_table_map[table_name]
4152
4165
  synthetic_table.validate_against_source_table(
4153
- generator_table, is_probe=isinstance(validation.synthetic_config, SyntheticProbeConfig)
4166
+ generator_table, is_probe=isinstance(self.synthetic_config, SyntheticProbeConfig)
4154
4167
  )
4155
- return validation
4168
+ return self
4156
4169
 
4157
4170
 
4158
4171
  def _add_fields_to_docstring(cls):
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "5.2.7"
3
+ version = "5.3.0"
4
4
  description = "Synthetic Data SDK"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
6
  requires-python = ">=3.10,<3.14"
@@ -1,18 +0,0 @@
1
- # Copyright 2024-2025 MOSTLY AI
2
- #
3
- # Licensed under the Apache License, Version 2.0 (the "License");
4
- # you may not use this file except in compliance with the License.
5
- # You may obtain a copy of the License at
6
- #
7
- # http://www.apache.org/licenses/LICENSE-2.0
8
- #
9
- # Unless required by applicable law or agreed to in writing, software
10
- # distributed under the License is distributed on an "AS IS" BASIS,
11
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- # See the License for the specific language governing permissions and
13
- # limitations under the License.
14
-
15
- from mostlyai.sdk.client.api import MostlyAI
16
-
17
- __all__ = ["MostlyAI"]
18
- __version__ = "5.2.7" # Do not set this manually. Use poetry version [params].
File without changes
File without changes
File without changes
File without changes