mostlyai 4.9.0__tar.gz → 4.9.2__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 (88) hide show
  1. {mostlyai-4.9.0 → mostlyai-4.9.2}/PKG-INFO +3 -3
  2. {mostlyai-4.9.0 → mostlyai-4.9.2}/README.md +2 -2
  3. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/base.py +2 -2
  5. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/base.py +2 -1
  6. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/utils.py +4 -2
  7. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/pull_utils.py +2 -2
  8. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_pull_training_data.py +1 -1
  9. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/_utils.py +2 -1
  10. mostlyai-4.9.2/mostlyai/sdk/client/artifacts.py +98 -0
  11. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/domain.py +158 -6
  12. {mostlyai-4.9.0 → mostlyai-4.9.2}/pyproject.toml +1 -1
  13. {mostlyai-4.9.0 → mostlyai-4.9.2}/.gitignore +0 -0
  14. {mostlyai-4.9.0 → mostlyai-4.9.2}/LICENSE +0 -0
  15. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/__init__.py +0 -0
  16. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/auto_detect.py +0 -0
  17. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/context.py +0 -0
  18. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/conversions.py +0 -0
  19. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/__init__.py +0 -0
  20. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  21. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/databricks.py +0 -0
  22. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/hive.py +0 -0
  23. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/mssql.py +0 -0
  24. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/mysql.py +0 -0
  25. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/oracle.py +0 -0
  26. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  27. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  28. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  29. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  30. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/dtype.py +0 -0
  31. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/exceptions.py +0 -0
  32. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/__init__.py +0 -0
  33. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/base.py +0 -0
  34. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  35. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  36. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  37. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  38. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  39. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  40. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  41. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  42. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  43. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/table/json.py +0 -0
  44. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  45. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/language_model.py +0 -0
  46. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  47. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/non_context.py +0 -0
  48. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/progress_callback.py +0 -0
  49. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/pull.py +0 -0
  50. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/pull_context.py +0 -0
  51. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/push.py +0 -0
  52. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/util/__init__.py +0 -0
  53. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/util/common.py +0 -0
  54. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  55. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/__init__.py +0 -0
  56. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/cli.py +0 -0
  57. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/connectors.py +0 -0
  58. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  59. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  60. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/migration.py +0 -0
  61. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/plan.py +0 -0
  62. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  63. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  64. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  65. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  66. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  67. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  68. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  69. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  70. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  71. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  72. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/generators.py +0 -0
  73. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/progress.py +0 -0
  74. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/routes.py +0 -0
  75. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/server.py +0 -0
  76. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/storage.py +0 -0
  77. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  78. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/__init__.py +0 -0
  79. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/_base_utils.py +0 -0
  80. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  81. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/api.py +0 -0
  82. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/base.py +0 -0
  83. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/connectors.py +0 -0
  84. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/datasets.py +0 -0
  85. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/exceptions.py +0 -0
  86. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/generators.py +0 -0
  87. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  88. {mostlyai-4.9.0 → mostlyai-4.9.2}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.9.0
3
+ Version: 4.9.2
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
@@ -423,10 +423,10 @@ Next, transfer the printed directory to the air-gapped environment's cache direc
423
423
  Please consider citing our project if you find it useful:
424
424
 
425
425
  ```bibtex
426
- @software{mostlyai,
426
+ @misc{mostlyai,
427
427
  author = {{MOSTLY AI}},
428
428
  title = {{MOSTLY AI SDK}},
429
- url = {https://github.com/mostly-ai/mostlyai},
429
+ howpublished = {\url{https://github.com/mostly-ai/mostlyai}},
430
430
  year = {2025}
431
431
  }
432
432
  ```
@@ -314,10 +314,10 @@ Next, transfer the printed directory to the air-gapped environment's cache direc
314
314
  Please consider citing our project if you find it useful:
315
315
 
316
316
  ```bibtex
317
- @software{mostlyai,
317
+ @misc{mostlyai,
318
318
  author = {{MOSTLY AI}},
319
319
  title = {{MOSTLY AI SDK}},
320
- url = {https://github.com/mostly-ai/mostlyai},
320
+ howpublished = {\url{https://github.com/mostly-ai/mostlyai}},
321
321
  year = {2025}
322
322
  }
323
323
  ```
@@ -15,4 +15,4 @@
15
15
  from mostlyai.sdk.client.api import MostlyAI
16
16
 
17
17
  __all__ = ["MostlyAI"]
18
- __version__ = "4.9.0" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.9.2" # Do not set this manually. Use poetry version [params].
@@ -189,7 +189,7 @@ class Schema:
189
189
 
190
190
  def get_primary_key(self, table_name: str) -> DataIdentifier | None:
191
191
  primary_key = None
192
- if self.tables[table_name].primary_key is not None:
192
+ if self.tables[table_name].primary_key:
193
193
  # first, check primary key on table
194
194
  primary_key = DataIdentifier(table_name, self.tables[table_name].primary_key)
195
195
  elif context_relations := self.get_child_context_relations(table_name):
@@ -260,7 +260,7 @@ class Schema:
260
260
 
261
261
  def _update_key_encoding_types(self) -> None:
262
262
  for tbl_name, tbl_table in self.tables.items():
263
- if tbl_table.primary_key is not None:
263
+ if tbl_table.primary_key:
264
264
  if tbl_table.primary_key in tbl_table.encoding_types:
265
265
  del tbl_table.encoding_types[tbl_table.primary_key]
266
266
  for rel in self.get_relations_to_table(tbl_name):
@@ -876,6 +876,7 @@ class SqlAlchemyTable(DBTable, abc.ABC):
876
876
 
877
877
  def __init__(self, *args, **kwargs):
878
878
  self.is_view = kwargs.get("is_view", False)
879
+ self.lazy_fetch_primary_key = kwargs.get("lazy_fetch_primary_key", True)
879
880
  super().__init__(*args, **kwargs)
880
881
 
881
882
  def __repr__(self):
@@ -1065,7 +1066,7 @@ class SqlAlchemyTable(DBTable, abc.ABC):
1065
1066
  if item == "columns":
1066
1067
  self.columns = [c.name for c in self._sa_table.columns]
1067
1068
  elif item == "primary_key":
1068
- self.primary_key = self._get_primary_key()
1069
+ self.primary_key = self._get_primary_key() if self.lazy_fetch_primary_key else None
1069
1070
  elif item == "dtypes":
1070
1071
  self.dtypes = self._get_dtypes()
1071
1072
  else:
@@ -88,7 +88,9 @@ def _fetch_file_data_table(
88
88
  return data_table
89
89
 
90
90
 
91
- def make_data_table_from_container(container: DataContainer, is_output=False) -> DataTable:
91
+ def make_data_table_from_container(
92
+ container: DataContainer, is_output: bool = False, lazy_fetch_primary_key: bool = True
93
+ ) -> DataTable:
92
94
  if isinstance(container, SqlAlchemyContainer):
93
95
  # handle DB containers
94
96
  data_table_class = container.table_class()
@@ -100,4 +102,4 @@ def make_data_table_from_container(container: DataContainer, is_output=False) ->
100
102
  data_table_class = read_data_table_from_path(container, return_class=True)
101
103
  else:
102
104
  raise RuntimeError(f"Unknown container type: {type(container)}")
103
- return data_table_class(container=container, is_output=is_output)
105
+ return data_table_class(container=container, is_output=is_output, lazy_fetch_primary_key=lazy_fetch_primary_key)
@@ -448,7 +448,7 @@ def fetch_table_data(
448
448
  )
449
449
  n_fetched_rows = 0
450
450
  for idx, chunk_df in enumerate(iterator):
451
- if deduplicate_pks and primary_key is not None and primary_key.column in chunk_df.columns:
451
+ if deduplicate_pks and primary_key and primary_key.column in chunk_df.columns:
452
452
  # consider only the first occurrence of each primary key
453
453
  if not chunk_df[primary_key.column].is_unique:
454
454
  drop_idx = chunk_df[primary_key.column].duplicated()
@@ -568,7 +568,7 @@ def fetch_target_table(
568
568
  key_fraction_df[FRACTION] = keys[MAX_TGT_ROWS_PER_CTX_KEY] / schema.tables[tgt].row_count
569
569
  key_fraction_df = key_fraction_df.rename(columns={tgt_context_key.ref_name(): tgt_context_key.column})
570
570
  key_fraction_df = key_fraction_df.drop(columns=[MAX_TGT_ROWS_PER_CTX_KEY])
571
- elif tgt_primary_key is not None:
571
+ elif tgt_primary_key:
572
572
  # flat setup with primary key
573
573
  # sample target table by target primary key
574
574
  # use provided keys to filter and order the target table (max_sample_size=None, do_shuffle=False)
@@ -67,7 +67,7 @@ def _create_training_schema(generator: Generator, connectors: list[Connector]) -
67
67
  container = create_container_from_connector(connector)
68
68
  container.set_location(table.location)
69
69
  # create DataTable
70
- data_table = make_data_table_from_container(container)
70
+ data_table = make_data_table_from_container(container, lazy_fetch_primary_key=False)
71
71
  data_table.name = table.name
72
72
  data_table.primary_key = table.primary_key
73
73
  if table.columns:
@@ -295,7 +295,8 @@ def job_wait(
295
295
  ProgressStatus.failed,
296
296
  ProgressStatus.canceled,
297
297
  ):
298
- live.refresh()
298
+ if progress_bar:
299
+ live.refresh()
299
300
  time.sleep(1) # give the system a moment to update the status
300
301
  return
301
302
  except KeyboardInterrupt:
@@ -0,0 +1,98 @@
1
+ # Copyright 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 typing import Any
16
+
17
+ import rich
18
+
19
+ from mostlyai.sdk.client.base import (
20
+ GET,
21
+ PATCH,
22
+ POST,
23
+ _MostlyBaseClient,
24
+ )
25
+ from mostlyai.sdk.domain import (
26
+ Artifact,
27
+ ArtifactConfig,
28
+ ArtifactPatchConfig,
29
+ )
30
+
31
+
32
+ class _MostlyArtifactsClient(_MostlyBaseClient):
33
+ SECTION = ["artifacts"]
34
+
35
+ def create(self, config: ArtifactConfig | dict[str, Any]) -> Artifact:
36
+ """
37
+ Create a shareable artifact from an assistant message.
38
+
39
+ Args:
40
+ config (ArtifactConfig | dict[str, Any]): Configuration for the artifact (assistant_message_id required).
41
+
42
+ Returns:
43
+ The created Artifact object.
44
+
45
+ Example for creating an artifact:
46
+ ```python
47
+ from mostlyai.sdk import MostlyAI
48
+ mostly = MostlyAI()
49
+ art = mostly.artifacts.create(
50
+ config=ArtifactConfig(
51
+ assistant_message_id="INSERT_YOUR_ASSISTANT_MESSAGE_ID",
52
+ )
53
+ )
54
+ ```
55
+ """
56
+ artifact = self.request(
57
+ verb=POST,
58
+ path=[],
59
+ json=config,
60
+ response_type=Artifact,
61
+ )
62
+ rich.print(f"created artifact [dodger_blue2]{artifact.id}[/]")
63
+ return artifact
64
+
65
+ def get(self, artifact_id: str) -> Artifact:
66
+ """
67
+ Retrieve artifact metadata including the shareable URL where the artifact can be viewed.
68
+ Unauthenticated access is allowed to enable public sharing of artifacts.
69
+
70
+ Args:
71
+ artifact_id: The unique identifier of the artifact.
72
+
73
+ Returns:
74
+ The retrieved Artifact object.
75
+
76
+ Example for retrieving an artifact:
77
+ ```python
78
+ from mostlyai.sdk import MostlyAI
79
+ mostly = MostlyAI()
80
+ art = mostly.artifacts.get("INSERT_YOUR_ARTIFACT_ID")
81
+ art
82
+ ```
83
+ """
84
+ response = self.request(verb=GET, path=[artifact_id], response_type=Artifact)
85
+ return response
86
+
87
+ def _update(
88
+ self,
89
+ artifact_id: str,
90
+ config: ArtifactPatchConfig | dict[str, Any],
91
+ ) -> Artifact:
92
+ response = self.request(
93
+ verb=PATCH,
94
+ path=[artifact_id],
95
+ json=config,
96
+ response_type=Artifact,
97
+ )
98
+ return response
@@ -13,7 +13,7 @@
13
13
  # limitations under the License.
14
14
 
15
15
  # generated by datamodel-codegen:
16
- # timestamp: 2025-07-10T14:44:02+00:00
16
+ # timestamp: 2025-07-22T10:13:45+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -181,11 +181,25 @@ class DatasetUsage(CustomBaseModel):
181
181
  """
182
182
 
183
183
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this dataset.")
184
+ no_of_threads: int | None = Field(
185
+ None,
186
+ alias="noOfThreads",
187
+ description="Number of assistant threads using this dataset.",
188
+ )
189
+
190
+
191
+ class DatasetConnectorLocationsConfig(CustomBaseModel):
192
+ """
193
+ Configuration for adding connector to dataset.
194
+ """
195
+
196
+ locations: list[str] | None = None
184
197
 
185
198
 
186
199
  class DatasetSortField(str, Enum):
187
200
  recency = "RECENCY"
188
201
  no_of_likes = "NO_OF_LIKES"
202
+ no_of_threads = "NO_OF_THREADS"
189
203
 
190
204
 
191
205
  class ConnectorAccessType(str, Enum):
@@ -257,6 +271,11 @@ class ConnectorUsage(CustomBaseModel):
257
271
  description="Number of generators using this connector.",
258
272
  )
259
273
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this connector.")
274
+ no_of_threads: int | None = Field(
275
+ None,
276
+ alias="noOfThreads",
277
+ description="Number of assistant threads using this connector.",
278
+ )
260
279
 
261
280
 
262
281
  class ConnectorConfig(CustomBaseModel):
@@ -479,6 +498,7 @@ class ConnectorSortField(str, Enum):
479
498
  recency = "RECENCY"
480
499
  no_of_generators = "NO_OF_GENERATORS"
481
500
  no_of_likes = "NO_OF_LIKES"
501
+ no_of_threads = "NO_OF_THREADS"
482
502
 
483
503
 
484
504
  class GeneratorUsage(CustomBaseModel):
@@ -517,6 +537,11 @@ class GeneratorUsage(CustomBaseModel):
517
537
  description="Number of synthetic datasets generated by this generator.",
518
538
  )
519
539
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this generator.")
540
+ no_of_threads: int | None = Field(
541
+ None,
542
+ alias="noOfThreads",
543
+ description="Number of assistant threads using this generator.",
544
+ )
520
545
 
521
546
 
522
547
  class SourceColumnValueRange(CustomBaseModel):
@@ -641,6 +666,7 @@ class SourceForeignKeyPatchConfig(CustomBaseModel):
641
666
  class GeneratorSortField(str, Enum):
642
667
  recency = "RECENCY"
643
668
  no_of_likes = "NO_OF_LIKES"
669
+ no_of_threads = "NO_OF_THREADS"
644
670
  no_of_synthetic_datasets = "NO_OF_SYNTHETIC_DATASETS"
645
671
 
646
672
 
@@ -774,6 +800,11 @@ class SyntheticDatasetUsage(CustomBaseModel):
774
800
  alias="noOfDownloads",
775
801
  description="Number of downloads of this synthetic dataset.",
776
802
  )
803
+ no_of_threads: int | None = Field(
804
+ None,
805
+ alias="noOfThreads",
806
+ description="Number of assistant threads using this synthetic dataset.",
807
+ )
777
808
 
778
809
 
779
810
  class SyntheticDatasetFormat(str, Enum):
@@ -809,6 +840,7 @@ class SyntheticDatasetSortField(str, Enum):
809
840
  recency = "RECENCY"
810
841
  no_of_likes = "NO_OF_LIKES"
811
842
  no_of_downloads = "NO_OF_DOWNLOADS"
843
+ no_of_threads = "NO_OF_THREADS"
812
844
 
813
845
 
814
846
  class AssistantLiteLlmExtraItem(CustomBaseModel):
@@ -903,6 +935,7 @@ class AssistantMessageContentType(str, Enum):
903
935
  artifact_synthetic_dataset = "artifact/synthetic-dataset"
904
936
  artifact_connector = "artifact/connector"
905
937
  artifact_dataset = "artifact/dataset"
938
+ artifact_shareable_artifact = "artifact/shareable-artifact"
906
939
 
907
940
 
908
941
  class AssistantMessageDeltaContentType(str, Enum):
@@ -920,6 +953,7 @@ class AssistantMessageDeltaContentType(str, Enum):
920
953
  artifact_generator = "artifact/generator"
921
954
  artifact_synthetic_dataset = "artifact/synthetic-dataset"
922
955
  artifact_connector = "artifact/connector"
956
+ artifact_dataset = "artifact/dataset"
923
957
 
924
958
 
925
959
  class AssistantMessageFile(CustomBaseModel):
@@ -1033,6 +1067,59 @@ class AssistantThreadUsage(CustomBaseModel):
1033
1067
  )
1034
1068
 
1035
1069
 
1070
+ class ArtifactType(str, Enum):
1071
+ """
1072
+ The type of artifact content.
1073
+ """
1074
+
1075
+ image = "image"
1076
+ html = "html"
1077
+
1078
+
1079
+ class ArtifactUsage(CustomBaseModel):
1080
+ """
1081
+ Usage statistics of an artifact.
1082
+ """
1083
+
1084
+ no_of_threads: int | None = Field(
1085
+ None,
1086
+ alias="noOfThreads",
1087
+ description="Number of assistant threads started from this artifact.",
1088
+ )
1089
+
1090
+
1091
+ class ArtifactPreview(CustomBaseModel):
1092
+ """
1093
+ Preview information for an artifact.
1094
+ """
1095
+
1096
+ image: str | None = Field(None, description="URL to a preview image for the artifact.")
1097
+
1098
+
1099
+ class ArtifactConfig(CustomBaseModel):
1100
+ """
1101
+ Configuration for creating an artifact from an assistant message.
1102
+ """
1103
+
1104
+ assistant_message_id: str = Field(
1105
+ ...,
1106
+ alias="assistantMessageId",
1107
+ description="The unique identifier of a assistant message.",
1108
+ )
1109
+
1110
+
1111
+ class ArtifactPatchConfig(CustomBaseModel):
1112
+ """
1113
+ Configuration for updating an artifact.
1114
+ """
1115
+
1116
+ name: str | None = Field(None, description="The name/title of an artifact.", max_length=256, min_length=1)
1117
+ description: str | None = Field(
1118
+ None,
1119
+ description="The description/prompt of an artifact that explains how to recreate it.",
1120
+ )
1121
+
1122
+
1036
1123
  class AssistantThreadConfig(CustomBaseModel):
1037
1124
  """
1038
1125
  Configuration for creating a new assistant thread.
@@ -1084,6 +1171,7 @@ class ComputeResources(CustomBaseModel):
1084
1171
  memory: float | None = Field(None, description="The amount of memory in GB")
1085
1172
  gpus: int | None = Field(0, description="The number of GPUs")
1086
1173
  gpu_memory: float | None = Field(0, alias="gpuMemory", description="The amount of GPU memory in GB")
1174
+ storage: float | None = Field(4, description="Ephemeral storage in GiB (Kubernetes only)")
1087
1175
 
1088
1176
 
1089
1177
  class ComputeListItem(CustomBaseModel):
@@ -1808,12 +1896,27 @@ class Metadata(CustomBaseModel):
1808
1896
  )
1809
1897
 
1810
1898
 
1899
+ class DatasetConnectorConfig(CustomBaseModel):
1900
+ """
1901
+ Configuration for a dataset connector.
1902
+ """
1903
+
1904
+ id: str = Field(..., description="The unique identifier of a connector.")
1905
+ locations: list[str] | None = None
1906
+
1907
+
1811
1908
  class DatasetConnector(CustomBaseModel):
1812
1909
  """
1813
1910
  Configuration for a dataset connector.
1814
1911
  """
1815
1912
 
1816
- connector_id: str | None = Field(None, alias="connectorId", description="The unique identifier of a connector.")
1913
+ id: str | None = Field(None, description="The unique identifier of a connector.")
1914
+ name: str | None = Field(None, description="The name of a connector.")
1915
+ description: str | None = Field(None, description="The description of a connector.")
1916
+ type: ConnectorType | None = None
1917
+ access_type: ConnectorAccessType | None = Field(ConnectorAccessType.read_protected, alias="accessType")
1918
+ metadata: Metadata | None = None
1919
+ usage: ConnectorUsage | None = None
1817
1920
  locations: list[str] | None = None
1818
1921
 
1819
1922
 
@@ -1937,7 +2040,7 @@ class DatasetConfig(CustomBaseModel):
1937
2040
 
1938
2041
  name: str | None = Field(None, description="The name of a dataset.")
1939
2042
  description: str | None = Field(None, description="The description of / instructions for a dataset.")
1940
- connectors: list[DatasetConnector] | None = None
2043
+ connectors: list[DatasetConnectorConfig] | None = None
1941
2044
 
1942
2045
 
1943
2046
  class DatasetPatchConfig(CustomBaseModel):
@@ -1947,7 +2050,7 @@ class DatasetPatchConfig(CustomBaseModel):
1947
2050
 
1948
2051
  name: str | None = Field(None, description="The name of a dataset.")
1949
2052
  description: str | None = Field(None, description="The description of / instructions for a dataset.")
1950
- connectors: list[DatasetConnector] | None = None
2053
+ connectors: list[DatasetConnectorConfig] | None = None
1951
2054
 
1952
2055
 
1953
2056
  class ConnectorListItem(CustomBaseModel):
@@ -2651,6 +2754,55 @@ class MessageEvent(CustomBaseModel):
2651
2754
  data: AssistantMessageDelta | None = None
2652
2755
 
2653
2756
 
2757
+ class Artifact(CustomBaseModel):
2758
+ """
2759
+ A shareable artifact generated from an assistant conversation.
2760
+ """
2761
+
2762
+ id: str = Field(..., description="The unique identifier of an artifact.")
2763
+ name: str = Field(..., description="The name/title of an artifact.", max_length=256, min_length=1)
2764
+ description: str = Field(
2765
+ ...,
2766
+ description="The description/prompt of an artifact that explains how to recreate it.",
2767
+ )
2768
+ type: ArtifactType | None = None
2769
+ preview: ArtifactPreview | None = None
2770
+ shareable_url: str = Field(
2771
+ ...,
2772
+ alias="shareableUrl",
2773
+ description="Public URL where the artifact can be viewed and shared.",
2774
+ )
2775
+ usage: ArtifactUsage | None = None
2776
+ metadata: Metadata | None = None
2777
+ OPEN_URL_PARTS: ClassVar[list] = ["d", "artifacts"]
2778
+
2779
+ @model_validator(mode="before")
2780
+ @classmethod
2781
+ def add_required_fields(cls, values):
2782
+ if isinstance(values, dict):
2783
+ if "id" not in values:
2784
+ values["id"] = str(uuid.uuid4())
2785
+ return values
2786
+
2787
+ def update(
2788
+ self,
2789
+ name: str | None = None,
2790
+ description: str | None = None,
2791
+ ) -> None:
2792
+ """
2793
+ Update the artifact.
2794
+
2795
+ Args:
2796
+ name (str | None): The name of the artifact.
2797
+ description (str | None): The description of the artifact.
2798
+ """
2799
+ patch_config = ArtifactPatchConfig(
2800
+ name=name,
2801
+ description=description,
2802
+ )
2803
+ self.client._update(artifact_id=self.id, config=patch_config)
2804
+
2805
+
2654
2806
  class OrganizationMetadata(CustomBaseModel):
2655
2807
  """
2656
2808
  The metadata of an organization.
@@ -2891,7 +3043,7 @@ class SourceTableConfig(CustomBaseModel):
2891
3043
  if values.columns:
2892
3044
  column_names = {col.name for col in values.columns}
2893
3045
  pk = values.primary_key
2894
- if pk is not None and pk not in column_names:
3046
+ if pk and pk not in column_names:
2895
3047
  raise ValueError(f"Primary key column '{pk}' does not exist in the table's columns.")
2896
3048
  for fk in values.foreign_keys or []:
2897
3049
  if fk.column not in column_names:
@@ -2903,7 +3055,7 @@ class SourceTableConfig(CustomBaseModel):
2903
3055
  def validate_pk_and_fks_are_not_overlapping(cls, values):
2904
3056
  primary_key = values.primary_key
2905
3057
  foreign_keys = [fk.column for fk in values.foreign_keys or []]
2906
- if primary_key is not None and primary_key in foreign_keys:
3058
+ if primary_key and primary_key in foreign_keys:
2907
3059
  raise ValueError(f"Column '{primary_key}' is both a primary key and a foreign key.")
2908
3060
  return values
2909
3061
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.9.0"
3
+ version = "4.9.2"
4
4
  description = "Synthetic Data SDK"
5
5
  authors = [{ name = "MOSTLY AI", email = "dev@mostly.ai" }]
6
6
  requires-python = ">=3.10,<3.14"
File without changes
File without changes
File without changes