mostlyai 4.8.4__tar.gz → 4.9.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 (88) hide show
  1. {mostlyai-4.8.4 → mostlyai-4.9.1}/PKG-INFO +3 -3
  2. {mostlyai-4.8.4 → mostlyai-4.9.1}/README.md +2 -2
  3. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/__init__.py +1 -1
  4. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/base.py +2 -2
  5. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/base.py +2 -1
  6. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/utils.py +4 -2
  7. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/pull_utils.py +2 -2
  8. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_pull_training_data.py +1 -1
  9. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/_utils.py +2 -1
  10. mostlyai-4.9.1/mostlyai/sdk/client/artifacts.py +98 -0
  11. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/domain.py +151 -6
  12. {mostlyai-4.8.4 → mostlyai-4.9.1}/pyproject.toml +1 -1
  13. {mostlyai-4.8.4 → mostlyai-4.9.1}/.gitignore +0 -0
  14. {mostlyai-4.8.4 → mostlyai-4.9.1}/LICENSE +0 -0
  15. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/__init__.py +0 -0
  16. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/auto_detect.py +0 -0
  17. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/context.py +0 -0
  18. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/conversions.py +0 -0
  19. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/__init__.py +0 -0
  20. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/bigquery.py +0 -0
  21. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/databricks.py +0 -0
  22. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/hive.py +0 -0
  23. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/mssql.py +0 -0
  24. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/mysql.py +0 -0
  25. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/oracle.py +0 -0
  26. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/postgresql.py +0 -0
  27. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/snowflake.py +0 -0
  28. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/sqlite.py +0 -0
  29. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/db/types_coercion.py +0 -0
  30. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/dtype.py +0 -0
  31. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/exceptions.py +0 -0
  32. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/__init__.py +0 -0
  33. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/base.py +0 -0
  34. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/__init__.py +0 -0
  35. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/aws.py +0 -0
  36. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/azure.py +0 -0
  37. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/bucket_based.py +0 -0
  38. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/gcs.py +0 -0
  39. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/container/minio.py +0 -0
  40. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/table/__init__.py +0 -0
  41. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/table/csv.py +0 -0
  42. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/table/feather.py +0 -0
  43. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/table/json.py +0 -0
  44. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/file/table/parquet.py +0 -0
  45. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/language_model.py +0 -0
  46. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/metadata_objects.py +0 -0
  47. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/non_context.py +0 -0
  48. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/progress_callback.py +0 -0
  49. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/pull.py +0 -0
  50. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/pull_context.py +0 -0
  51. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/push.py +0 -0
  52. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/util/__init__.py +0 -0
  53. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/util/common.py +0 -0
  54. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_data/util/kerberos.py +0 -0
  55. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/__init__.py +0 -0
  56. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/cli.py +0 -0
  57. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/connectors.py +0 -0
  58. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/__init__.py +0 -0
  59. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/jobs.py +0 -0
  60. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/migration.py +0 -0
  61. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/plan.py +0 -0
  62. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_analyze_training_data.py +0 -0
  63. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_create_data_report.py +0 -0
  64. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_create_model_report.py +0 -0
  65. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_deliver_data.py +0 -0
  66. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_encode_training_data.py +0 -0
  67. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_finalize_generation.py +0 -0
  68. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_finalize_training.py +0 -0
  69. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_generate_data.py +0 -0
  70. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_generate_model_report_data.py +0 -0
  71. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/execution/step_train_model.py +0 -0
  72. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/generators.py +0 -0
  73. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/progress.py +0 -0
  74. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/routes.py +0 -0
  75. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/server.py +0 -0
  76. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/storage.py +0 -0
  77. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/_local/synthetic_datasets.py +0 -0
  78. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/__init__.py +0 -0
  79. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/_base_utils.py +0 -0
  80. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/_naming_conventions.py +0 -0
  81. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/api.py +0 -0
  82. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/base.py +0 -0
  83. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/connectors.py +0 -0
  84. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/datasets.py +0 -0
  85. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/exceptions.py +0 -0
  86. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/generators.py +0 -0
  87. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/client/synthetic_datasets.py +0 -0
  88. {mostlyai-4.8.4 → mostlyai-4.9.1}/mostlyai/sdk/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mostlyai
3
- Version: 4.8.4
3
+ Version: 4.9.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
@@ -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.8.4" # Do not set this manually. Use poetry version [params].
18
+ __version__ = "4.9.1" # 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-22T00:00:00+00:00
17
17
 
18
18
  from __future__ import annotations
19
19
 
@@ -183,9 +183,18 @@ class DatasetUsage(CustomBaseModel):
183
183
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this dataset.")
184
184
 
185
185
 
186
+ class DatasetConnectorLocationsConfig(CustomBaseModel):
187
+ """
188
+ Configuration for adding connector to dataset.
189
+ """
190
+
191
+ locations: list[str] | None = None
192
+
193
+
186
194
  class DatasetSortField(str, Enum):
187
195
  recency = "RECENCY"
188
196
  no_of_likes = "NO_OF_LIKES"
197
+ no_of_threads = "NO_OF_THREADS"
189
198
 
190
199
 
191
200
  class ConnectorAccessType(str, Enum):
@@ -257,6 +266,11 @@ class ConnectorUsage(CustomBaseModel):
257
266
  description="Number of generators using this connector.",
258
267
  )
259
268
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this connector.")
269
+ no_of_threads: int | None = Field(
270
+ None,
271
+ alias="noOfThreads",
272
+ description="Number of assistant threads using this connector.",
273
+ )
260
274
 
261
275
 
262
276
  class ConnectorConfig(CustomBaseModel):
@@ -479,6 +493,7 @@ class ConnectorSortField(str, Enum):
479
493
  recency = "RECENCY"
480
494
  no_of_generators = "NO_OF_GENERATORS"
481
495
  no_of_likes = "NO_OF_LIKES"
496
+ no_of_threads = "NO_OF_THREADS"
482
497
 
483
498
 
484
499
  class GeneratorUsage(CustomBaseModel):
@@ -517,6 +532,11 @@ class GeneratorUsage(CustomBaseModel):
517
532
  description="Number of synthetic datasets generated by this generator.",
518
533
  )
519
534
  no_of_likes: int | None = Field(None, alias="noOfLikes", description="Number of likes of this generator.")
535
+ no_of_threads: int | None = Field(
536
+ None,
537
+ alias="noOfThreads",
538
+ description="Number of assistant threads using this generator.",
539
+ )
520
540
 
521
541
 
522
542
  class SourceColumnValueRange(CustomBaseModel):
@@ -641,6 +661,7 @@ class SourceForeignKeyPatchConfig(CustomBaseModel):
641
661
  class GeneratorSortField(str, Enum):
642
662
  recency = "RECENCY"
643
663
  no_of_likes = "NO_OF_LIKES"
664
+ no_of_threads = "NO_OF_THREADS"
644
665
  no_of_synthetic_datasets = "NO_OF_SYNTHETIC_DATASETS"
645
666
 
646
667
 
@@ -774,6 +795,11 @@ class SyntheticDatasetUsage(CustomBaseModel):
774
795
  alias="noOfDownloads",
775
796
  description="Number of downloads of this synthetic dataset.",
776
797
  )
798
+ no_of_threads: int | None = Field(
799
+ None,
800
+ alias="noOfThreads",
801
+ description="Number of assistant threads using this synthetic dataset.",
802
+ )
777
803
 
778
804
 
779
805
  class SyntheticDatasetFormat(str, Enum):
@@ -809,6 +835,7 @@ class SyntheticDatasetSortField(str, Enum):
809
835
  recency = "RECENCY"
810
836
  no_of_likes = "NO_OF_LIKES"
811
837
  no_of_downloads = "NO_OF_DOWNLOADS"
838
+ no_of_threads = "NO_OF_THREADS"
812
839
 
813
840
 
814
841
  class AssistantLiteLlmExtraItem(CustomBaseModel):
@@ -1033,6 +1060,59 @@ class AssistantThreadUsage(CustomBaseModel):
1033
1060
  )
1034
1061
 
1035
1062
 
1063
+ class ArtifactType(str, Enum):
1064
+ """
1065
+ The type of artifact content.
1066
+ """
1067
+
1068
+ image = "image"
1069
+ html = "html"
1070
+
1071
+
1072
+ class ArtifactUsage(CustomBaseModel):
1073
+ """
1074
+ Usage statistics of an artifact.
1075
+ """
1076
+
1077
+ no_of_threads: int | None = Field(
1078
+ None,
1079
+ alias="noOfThreads",
1080
+ description="Number of assistant threads started from this artifact.",
1081
+ )
1082
+
1083
+
1084
+ class ArtifactPreview(CustomBaseModel):
1085
+ """
1086
+ Preview information for an artifact.
1087
+ """
1088
+
1089
+ image: str | None = Field(None, description="URL to a preview image for the artifact.")
1090
+
1091
+
1092
+ class ArtifactConfig(CustomBaseModel):
1093
+ """
1094
+ Configuration for creating an artifact from an assistant message.
1095
+ """
1096
+
1097
+ assistant_message_id: str = Field(
1098
+ ...,
1099
+ alias="assistantMessageId",
1100
+ description="The unique identifier of a assistant message.",
1101
+ )
1102
+
1103
+
1104
+ class ArtifactPatchConfig(CustomBaseModel):
1105
+ """
1106
+ Configuration for updating an artifact.
1107
+ """
1108
+
1109
+ name: str | None = Field(None, description="The name/title of an artifact.", max_length=256, min_length=1)
1110
+ description: str | None = Field(
1111
+ None,
1112
+ description="The description/prompt of an artifact that explains how to recreate it.",
1113
+ )
1114
+
1115
+
1036
1116
  class AssistantThreadConfig(CustomBaseModel):
1037
1117
  """
1038
1118
  Configuration for creating a new assistant thread.
@@ -1084,6 +1164,7 @@ class ComputeResources(CustomBaseModel):
1084
1164
  memory: float | None = Field(None, description="The amount of memory in GB")
1085
1165
  gpus: int | None = Field(0, description="The number of GPUs")
1086
1166
  gpu_memory: float | None = Field(0, alias="gpuMemory", description="The amount of GPU memory in GB")
1167
+ storage: float | None = Field(4, description="Ephemeral storage in GiB (Kubernetes only)")
1087
1168
 
1088
1169
 
1089
1170
  class ComputeListItem(CustomBaseModel):
@@ -1808,12 +1889,27 @@ class Metadata(CustomBaseModel):
1808
1889
  )
1809
1890
 
1810
1891
 
1892
+ class DatasetConnectorConfig(CustomBaseModel):
1893
+ """
1894
+ Configuration for a dataset connector.
1895
+ """
1896
+
1897
+ id: str = Field(..., description="The unique identifier of a connector.")
1898
+ locations: list[str] | None = None
1899
+
1900
+
1811
1901
  class DatasetConnector(CustomBaseModel):
1812
1902
  """
1813
1903
  Configuration for a dataset connector.
1814
1904
  """
1815
1905
 
1816
- connector_id: str | None = Field(None, alias="connectorId", description="The unique identifier of a connector.")
1906
+ id: str | None = Field(None, description="The unique identifier of a connector.")
1907
+ name: str | None = Field(None, description="The name of a connector.")
1908
+ description: str | None = Field(None, description="The description of a connector.")
1909
+ type: ConnectorType | None = None
1910
+ access_type: ConnectorAccessType | None = Field(ConnectorAccessType.read_protected, alias="accessType")
1911
+ metadata: Metadata | None = None
1912
+ usage: ConnectorUsage | None = None
1817
1913
  locations: list[str] | None = None
1818
1914
 
1819
1915
 
@@ -1937,7 +2033,7 @@ class DatasetConfig(CustomBaseModel):
1937
2033
 
1938
2034
  name: str | None = Field(None, description="The name of a dataset.")
1939
2035
  description: str | None = Field(None, description="The description of / instructions for a dataset.")
1940
- connectors: list[DatasetConnector] | None = None
2036
+ connectors: list[DatasetConnectorConfig] | None = None
1941
2037
 
1942
2038
 
1943
2039
  class DatasetPatchConfig(CustomBaseModel):
@@ -1947,7 +2043,7 @@ class DatasetPatchConfig(CustomBaseModel):
1947
2043
 
1948
2044
  name: str | None = Field(None, description="The name of a dataset.")
1949
2045
  description: str | None = Field(None, description="The description of / instructions for a dataset.")
1950
- connectors: list[DatasetConnector] | None = None
2046
+ connectors: list[DatasetConnectorConfig] | None = None
1951
2047
 
1952
2048
 
1953
2049
  class ConnectorListItem(CustomBaseModel):
@@ -2651,6 +2747,55 @@ class MessageEvent(CustomBaseModel):
2651
2747
  data: AssistantMessageDelta | None = None
2652
2748
 
2653
2749
 
2750
+ class Artifact(CustomBaseModel):
2751
+ """
2752
+ A shareable artifact generated from an assistant conversation.
2753
+ """
2754
+
2755
+ id: str = Field(..., description="The unique identifier of an artifact.")
2756
+ name: str = Field(..., description="The name/title of an artifact.", max_length=256, min_length=1)
2757
+ description: str = Field(
2758
+ ...,
2759
+ description="The description/prompt of an artifact that explains how to recreate it.",
2760
+ )
2761
+ type: ArtifactType | None = None
2762
+ preview: ArtifactPreview | None = None
2763
+ shareable_url: str = Field(
2764
+ ...,
2765
+ alias="shareableUrl",
2766
+ description="Public URL where the artifact can be viewed and shared.",
2767
+ )
2768
+ usage: ArtifactUsage | None = None
2769
+ metadata: Metadata | None = None
2770
+ OPEN_URL_PARTS: ClassVar[list] = ["d", "artifacts"]
2771
+
2772
+ @model_validator(mode="before")
2773
+ @classmethod
2774
+ def add_required_fields(cls, values):
2775
+ if isinstance(values, dict):
2776
+ if "id" not in values:
2777
+ values["id"] = str(uuid.uuid4())
2778
+ return values
2779
+
2780
+ def update(
2781
+ self,
2782
+ name: str | None = None,
2783
+ description: str | None = None,
2784
+ ) -> None:
2785
+ """
2786
+ Update the artifact.
2787
+
2788
+ Args:
2789
+ name (str | None): The name of the artifact.
2790
+ description (str | None): The description of the artifact.
2791
+ """
2792
+ patch_config = ArtifactPatchConfig(
2793
+ name=name,
2794
+ description=description,
2795
+ )
2796
+ self.client._update(artifact_id=self.id, config=patch_config)
2797
+
2798
+
2654
2799
  class OrganizationMetadata(CustomBaseModel):
2655
2800
  """
2656
2801
  The metadata of an organization.
@@ -2891,7 +3036,7 @@ class SourceTableConfig(CustomBaseModel):
2891
3036
  if values.columns:
2892
3037
  column_names = {col.name for col in values.columns}
2893
3038
  pk = values.primary_key
2894
- if pk is not None and pk not in column_names:
3039
+ if pk and pk not in column_names:
2895
3040
  raise ValueError(f"Primary key column '{pk}' does not exist in the table's columns.")
2896
3041
  for fk in values.foreign_keys or []:
2897
3042
  if fk.column not in column_names:
@@ -2903,7 +3048,7 @@ class SourceTableConfig(CustomBaseModel):
2903
3048
  def validate_pk_and_fks_are_not_overlapping(cls, values):
2904
3049
  primary_key = values.primary_key
2905
3050
  foreign_keys = [fk.column for fk in values.foreign_keys or []]
2906
- if primary_key is not None and primary_key in foreign_keys:
3051
+ if primary_key and primary_key in foreign_keys:
2907
3052
  raise ValueError(f"Column '{primary_key}' is both a primary key and a foreign key.")
2908
3053
  return values
2909
3054
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "mostlyai"
3
- version = "4.8.4"
3
+ version = "4.9.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"
File without changes
File without changes
File without changes