mostlyai 0.4.2__tar.gz → 0.4.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mostlyai-0.4.2 → mostlyai-0.4.4}/PKG-INFO +7 -1
- {mostlyai-0.4.2 → mostlyai-0.4.4}/README.md +4 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/__init__.py +1 -1
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/base.py +15 -6
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/generators.py +9 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/model.py +72 -11
- mostlyai-0.4.4/mostlyai/naming_conventions.py +39 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/shares.py +2 -2
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/utils.py +28 -23
- {mostlyai-0.4.2 → mostlyai-0.4.4}/pyproject.toml +6 -1
- {mostlyai-0.4.2 → mostlyai-0.4.4}/LICENSE +0 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/api.py +0 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/connectors.py +0 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.4.2 → mostlyai-0.4.4}/mostlyai/synthetic_datasets.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
4
4
|
Summary: The official Python client for the MOSTLY AI platform.
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Proprietary
|
|
@@ -18,6 +18,8 @@ Requires-Dist: pandas (>=1.5.3,<3.0.0)
|
|
|
18
18
|
Requires-Dist: pyarrow (>=14.0.0)
|
|
19
19
|
Requires-Dist: pydantic (>=2.4.2,<3.0.0)
|
|
20
20
|
Requires-Dist: rich (>=13.7.0)
|
|
21
|
+
Project-URL: Documentation, https://mostly-ai.github.io/mostly-python/
|
|
22
|
+
Project-URL: Source, https://github.com/mostly-ai/mostly-python
|
|
21
23
|
Description-Content-Type: text/markdown
|
|
22
24
|
|
|
23
25
|
# MOSTLY AI - GenAI for Tabular Data
|
|
@@ -97,6 +99,10 @@ g.training.wait()
|
|
|
97
99
|
# import / export
|
|
98
100
|
g.export_to_file(file_path)
|
|
99
101
|
mostly.generators.import_from_file(file_path)
|
|
102
|
+
|
|
103
|
+
# clone
|
|
104
|
+
cloned_g = g.clone(training_status="NEW") # clone the generator for new training
|
|
105
|
+
cloned_g = g.clone(training_status="CONTINUE") # clone the generator and reuse its weights for continued training
|
|
100
106
|
```
|
|
101
107
|
|
|
102
108
|
### Synthetic Datasets
|
|
@@ -75,6 +75,10 @@ g.training.wait()
|
|
|
75
75
|
# import / export
|
|
76
76
|
g.export_to_file(file_path)
|
|
77
77
|
mostly.generators.import_from_file(file_path)
|
|
78
|
+
|
|
79
|
+
# clone
|
|
80
|
+
cloned_g = g.clone(training_status="NEW") # clone the generator for new training
|
|
81
|
+
cloned_g = g.clone(training_status="CONTINUE") # clone the generator and reuse its weights for continued training
|
|
78
82
|
```
|
|
79
83
|
|
|
80
84
|
### Synthetic Datasets
|
|
@@ -20,6 +20,11 @@ from pydantic import BaseModel, ConfigDict, Field
|
|
|
20
20
|
from rich.console import Console
|
|
21
21
|
|
|
22
22
|
from mostlyai.exceptions import APIError, APIStatusError
|
|
23
|
+
from mostlyai.naming_conventions import (
|
|
24
|
+
snake_to_camel,
|
|
25
|
+
map_snake_to_camel_case,
|
|
26
|
+
map_camel_to_snake_case,
|
|
27
|
+
)
|
|
23
28
|
|
|
24
29
|
GET = "GET"
|
|
25
30
|
POST = "POST"
|
|
@@ -73,6 +78,8 @@ class _MostlyBaseClient:
|
|
|
73
78
|
response_type: type = dict,
|
|
74
79
|
raw_response: bool = False,
|
|
75
80
|
is_api_call: bool = True,
|
|
81
|
+
do_json_camel_case: bool = True,
|
|
82
|
+
do_response_dict_snake_case: bool = True,
|
|
76
83
|
do_include_client: bool = True,
|
|
77
84
|
extra_key_values: Optional[dict] = None,
|
|
78
85
|
**kwargs,
|
|
@@ -88,6 +95,8 @@ class _MostlyBaseClient:
|
|
|
88
95
|
:param response_type: a specific type to return (e.g. Pydantic class)
|
|
89
96
|
:param raw_response: whether to just return a raw response (e.g. content)
|
|
90
97
|
:param is_api_call: True by default; if False, API_SECTION and SECTION won't be prefixed
|
|
98
|
+
:param do_json_camel_case: ensure a provided json follows camelCase conventions
|
|
99
|
+
:param do_response_dict_snake_case: ensure the returned dict follows snake_case conventions
|
|
91
100
|
:param do_include_client: True by default; if True, client property will be included in the returned instance
|
|
92
101
|
:param extra_key_values: Any extra information storage to include in the returned object
|
|
93
102
|
:param kwargs: httpx's request function's kwargs
|
|
@@ -105,6 +114,9 @@ class _MostlyBaseClient:
|
|
|
105
114
|
f"The overall {request_size=} exceeds {MAX_REQUEST_SIZE}.", UserWarning
|
|
106
115
|
)
|
|
107
116
|
|
|
117
|
+
if "json" in kwargs and do_json_camel_case:
|
|
118
|
+
kwargs["json"] = map_snake_to_camel_case(kwargs["json"])
|
|
119
|
+
|
|
108
120
|
try:
|
|
109
121
|
with httpx.Client(timeout=self.timeout, verify=self.ssl_verify) as client:
|
|
110
122
|
response = client.request(method=verb, url=full_url, **kwargs)
|
|
@@ -135,6 +147,8 @@ class _MostlyBaseClient:
|
|
|
135
147
|
response_json["client"] = self
|
|
136
148
|
if isinstance(extra_key_values, dict):
|
|
137
149
|
response_json["extra_key_values"] = extra_key_values
|
|
150
|
+
elif response_type == dict and do_response_dict_snake_case:
|
|
151
|
+
response_json = map_camel_to_snake_case(response_json)
|
|
138
152
|
return (
|
|
139
153
|
response_type(**response_json)
|
|
140
154
|
if isinstance(response_json, dict)
|
|
@@ -157,7 +171,7 @@ class Paginator(Generic[T]):
|
|
|
157
171
|
self.object_class = object_class
|
|
158
172
|
self.offset = kwargs.pop("offset", 0)
|
|
159
173
|
self.limit = kwargs.pop("limit", 50)
|
|
160
|
-
self.params = {
|
|
174
|
+
self.params = {snake_to_camel(k): v for k, v in kwargs.items()}
|
|
161
175
|
self.current_items = []
|
|
162
176
|
self.current_index = 0
|
|
163
177
|
self.is_last_page = False
|
|
@@ -233,11 +247,6 @@ class CustomBaseModel(BaseModel):
|
|
|
233
247
|
setattr(self, key, value)
|
|
234
248
|
|
|
235
249
|
|
|
236
|
-
def _snake_to_camel(snake_str: str) -> str:
|
|
237
|
-
components = snake_str.split("_")
|
|
238
|
-
return components[0] + "".join(x.title() for x in components[1:])
|
|
239
|
-
|
|
240
|
-
|
|
241
250
|
def _get_total_size(obj, seen=None):
|
|
242
251
|
"""Recursively finds size of objects in bytes."""
|
|
243
252
|
size = sys.getsizeof(obj)
|
|
@@ -143,6 +143,15 @@ class _MostlyGeneratorsClient(_MostlyBaseClient, _MostlySharesMixin):
|
|
|
143
143
|
response = self.request(verb=DELETE, path=[generator_id])
|
|
144
144
|
return response
|
|
145
145
|
|
|
146
|
+
def _clone(self, generator_id: str, training_status: str) -> Generator:
|
|
147
|
+
response = self.request(
|
|
148
|
+
verb=POST,
|
|
149
|
+
path=[generator_id, "clone"],
|
|
150
|
+
json={"trainingStatus": training_status},
|
|
151
|
+
response_type=Generator,
|
|
152
|
+
)
|
|
153
|
+
return response
|
|
154
|
+
|
|
146
155
|
def _config(self, generator_id: str) -> Generator:
|
|
147
156
|
response = self.request(verb=GET, path=[generator_id, "config"])
|
|
148
157
|
return response
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
|
-
# timestamp: 2024-
|
|
2
|
+
# timestamp: 2024-10-21T10:19:52+00:00
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -511,7 +511,8 @@ class Distances(CustomBaseModel):
|
|
|
511
511
|
Field(
|
|
512
512
|
None,
|
|
513
513
|
alias="dcrTraining",
|
|
514
|
-
description="The average
|
|
514
|
+
description="The average distance to closest record (L2) between synthetic and training samples within the embedding space.",
|
|
515
|
+
ge=0.0,
|
|
515
516
|
),
|
|
516
517
|
] = None
|
|
517
518
|
dcr_holdout: Annotated[
|
|
@@ -519,7 +520,8 @@ class Distances(CustomBaseModel):
|
|
|
519
520
|
Field(
|
|
520
521
|
None,
|
|
521
522
|
alias="dcrHoldout",
|
|
522
|
-
description="The average
|
|
523
|
+
description="The average distance to closest record (L2) between synthetic and holdout samples within the embedding space.",
|
|
524
|
+
ge=0.0,
|
|
523
525
|
),
|
|
524
526
|
] = None
|
|
525
527
|
dcr_original: Annotated[
|
|
@@ -528,6 +530,7 @@ class Distances(CustomBaseModel):
|
|
|
528
530
|
None,
|
|
529
531
|
alias="dcrOriginal",
|
|
530
532
|
description="(DEPRECATED) The average DCR between the original records.",
|
|
533
|
+
ge=0.0,
|
|
531
534
|
),
|
|
532
535
|
] = None
|
|
533
536
|
dcr_synthetic: Annotated[
|
|
@@ -536,6 +539,50 @@ class Distances(CustomBaseModel):
|
|
|
536
539
|
None,
|
|
537
540
|
alias="dcrSynthetic",
|
|
538
541
|
description="(DEPRECATED) The average DCR between the synthetic and the original records.",
|
|
542
|
+
ge=0.0,
|
|
543
|
+
),
|
|
544
|
+
] = None
|
|
545
|
+
|
|
546
|
+
|
|
547
|
+
class Similarity(CustomBaseModel):
|
|
548
|
+
cosine_similarity_training_synthetic: Annotated[
|
|
549
|
+
Optional[float],
|
|
550
|
+
Field(
|
|
551
|
+
None,
|
|
552
|
+
alias="cosineSimilarityTrainingSynthetic",
|
|
553
|
+
description="The cosine similarity between the training samples centroid and the synthetic samples centroid within the embedding space.",
|
|
554
|
+
ge=-1.0,
|
|
555
|
+
le=1.0,
|
|
556
|
+
),
|
|
557
|
+
] = None
|
|
558
|
+
cosine_similarity_training_holdout: Annotated[
|
|
559
|
+
Optional[float],
|
|
560
|
+
Field(
|
|
561
|
+
None,
|
|
562
|
+
alias="cosineSimilarityTrainingHoldout",
|
|
563
|
+
description="The cosine similarity between the training samples centroid and the holdout samples centroid within the embedding space.",
|
|
564
|
+
ge=-1.0,
|
|
565
|
+
le=1.0,
|
|
566
|
+
),
|
|
567
|
+
] = None
|
|
568
|
+
discriminator_auc_training_synthetic: Annotated[
|
|
569
|
+
Optional[float],
|
|
570
|
+
Field(
|
|
571
|
+
None,
|
|
572
|
+
alias="discriminatorAUCTrainingSynthetic",
|
|
573
|
+
description="The cross-validated average AUC of discriminating between training embeddings ans synthetic embeddings.",
|
|
574
|
+
ge=0.0,
|
|
575
|
+
le=1.0,
|
|
576
|
+
),
|
|
577
|
+
] = None
|
|
578
|
+
discriminator_auc_training_holdout: Annotated[
|
|
579
|
+
Optional[float],
|
|
580
|
+
Field(
|
|
581
|
+
None,
|
|
582
|
+
alias="discriminatorAUCTrainingHoldout",
|
|
583
|
+
description="The cross-validated average AUC of discriminating between training embeddings ans holdout embeddings.",
|
|
584
|
+
ge=0.0,
|
|
585
|
+
le=1.0,
|
|
539
586
|
),
|
|
540
587
|
] = None
|
|
541
588
|
|
|
@@ -543,6 +590,7 @@ class Distances(CustomBaseModel):
|
|
|
543
590
|
class ModelMetrics(CustomBaseModel):
|
|
544
591
|
accuracy: Optional[Accuracy] = None
|
|
545
592
|
distances: Optional[Distances] = None
|
|
593
|
+
similarity: Optional[Similarity] = None
|
|
546
594
|
|
|
547
595
|
|
|
548
596
|
class StepCode(str, Enum):
|
|
@@ -569,6 +617,7 @@ class ProgressStatus(str, Enum):
|
|
|
569
617
|
"""
|
|
570
618
|
The status of a job or a step.
|
|
571
619
|
NEW: The job/step is being configured, and has not started yet
|
|
620
|
+
CONTINUE: The job/step is being configured, but has existing artefacts
|
|
572
621
|
ON_HOLD: The job/step has been started, but is kept on hold
|
|
573
622
|
QUEUED: The job/step has been started, and is awaiting for resources to execute
|
|
574
623
|
IN_PROGRESS: The job/step is currently running
|
|
@@ -579,6 +628,7 @@ class ProgressStatus(str, Enum):
|
|
|
579
628
|
"""
|
|
580
629
|
|
|
581
630
|
new = "NEW"
|
|
631
|
+
continue_ = "CONTINUE"
|
|
582
632
|
on_hold = "ON_HOLD"
|
|
583
633
|
queued = "QUEUED"
|
|
584
634
|
in_progress = "IN_PROGRESS"
|
|
@@ -1089,13 +1139,6 @@ class GeneratorListItem(CustomBaseModel):
|
|
|
1089
1139
|
] = None
|
|
1090
1140
|
usage: Optional[GeneratorUsage] = None
|
|
1091
1141
|
metadata: Metadata
|
|
1092
|
-
accuracy: Annotated[
|
|
1093
|
-
Optional[float],
|
|
1094
|
-
Field(
|
|
1095
|
-
None,
|
|
1096
|
-
description="The overall accuracy of the trained generator.\nThis is the average of the overall accuracy scores of all trained models.\n",
|
|
1097
|
-
),
|
|
1098
|
-
] = None
|
|
1099
1142
|
|
|
1100
1143
|
|
|
1101
1144
|
class Probe(CustomBaseModel):
|
|
@@ -1122,7 +1165,6 @@ class ModelConfiguration(CustomBaseModel):
|
|
|
1122
1165
|
"MOSTLY_AI/Large",
|
|
1123
1166
|
"MOSTLY_AI/LSTMFromScratch-3m",
|
|
1124
1167
|
"microsoft/phi-1_5",
|
|
1125
|
-
"Locutusque/TinyMistral-248M",
|
|
1126
1168
|
]
|
|
1127
1169
|
],
|
|
1128
1170
|
),
|
|
@@ -1216,6 +1258,12 @@ class ProgressStep(CustomBaseModel):
|
|
|
1216
1258
|
),
|
|
1217
1259
|
] = None
|
|
1218
1260
|
compute_name: Annotated[Optional[str], Field(None, alias="computeName")] = None
|
|
1261
|
+
restarts: Annotated[
|
|
1262
|
+
Optional[int],
|
|
1263
|
+
Field(
|
|
1264
|
+
None, description="Number of previous restarts for the corresponding task."
|
|
1265
|
+
),
|
|
1266
|
+
] = None
|
|
1219
1267
|
step_code: Annotated[Optional[StepCode], Field(None, alias="stepCode")] = None
|
|
1220
1268
|
start_date: Annotated[
|
|
1221
1269
|
Optional[AwareDatetime],
|
|
@@ -1747,6 +1795,19 @@ class Generator(CustomBaseModel):
|
|
|
1747
1795
|
file_path.write_bytes(bytes)
|
|
1748
1796
|
return file_path
|
|
1749
1797
|
|
|
1798
|
+
def clone(self, training_status: Literal["NEW", "CONTINUE"] = "NEW") -> "Generator":
|
|
1799
|
+
"""
|
|
1800
|
+
Create a new generator, re-using existing data and model configurations. By setting trainingStatus
|
|
1801
|
+
to CONTINUE, the model weights are copied as well, and training will continue from there. Note, that
|
|
1802
|
+
in that case, only the training parameters (maxSampleSize, maxEpochs, batchSize, compute, etc.) of
|
|
1803
|
+
the model configuration can still be modified. Other configurations, like columns, model, and
|
|
1804
|
+
valueProtection cannot be changed anymore, as these would break compatibility with the existing model
|
|
1805
|
+
weights.
|
|
1806
|
+
|
|
1807
|
+
:param training_status: The training status of the new generator.
|
|
1808
|
+
"""
|
|
1809
|
+
return self.client._clone(generator_id=self.id, training_status=training_status)
|
|
1810
|
+
|
|
1750
1811
|
class Training:
|
|
1751
1812
|
def __init__(self, _generator: "Generator"):
|
|
1752
1813
|
self.generator = _generator
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import re
|
|
2
|
+
from typing import Callable
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def snake_to_camel(snake_str: str) -> str:
|
|
6
|
+
components = snake_str.split("_")
|
|
7
|
+
return components[0] + "".join(x.title() for x in components[1:])
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def camel_to_snake(camel_str: str) -> str:
|
|
11
|
+
return re.sub(r"(?<!^)(?=[A-Z])", "_", camel_str).lower()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def convert_case(input_data: dict, conv_func: Callable[[str], str]) -> dict:
|
|
15
|
+
if not isinstance(input_data, dict):
|
|
16
|
+
return input_data
|
|
17
|
+
|
|
18
|
+
new_dict = {}
|
|
19
|
+
for key, value in input_data.items():
|
|
20
|
+
new_key = conv_func(key)
|
|
21
|
+
# recursively convert nested dictionaries or lists
|
|
22
|
+
if isinstance(value, dict):
|
|
23
|
+
new_dict[new_key] = convert_case(value, conv_func)
|
|
24
|
+
elif isinstance(value, list):
|
|
25
|
+
new_dict[new_key] = [
|
|
26
|
+
convert_case(item, conv_func) if isinstance(item, dict) else item
|
|
27
|
+
for item in value
|
|
28
|
+
]
|
|
29
|
+
else:
|
|
30
|
+
new_dict[new_key] = value
|
|
31
|
+
return new_dict
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def map_snake_to_camel_case(input_dict: dict) -> dict:
|
|
35
|
+
return convert_case(input_dict, snake_to_camel)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def map_camel_to_snake_case(input_dict: dict) -> dict:
|
|
39
|
+
return convert_case(input_dict, camel_to_snake)
|
|
@@ -31,12 +31,12 @@ class _MostlySharesClient(_MostlyBaseClient):
|
|
|
31
31
|
user_email: str,
|
|
32
32
|
permission_level: PermissionLevel,
|
|
33
33
|
):
|
|
34
|
-
config = {"
|
|
34
|
+
config = {"user_email": user_email, "permission_level": permission_level}
|
|
35
35
|
resource_type = self.RESOURCE_TYPE.get(type(resource))
|
|
36
36
|
self.request(verb=POST, path=[resource_type, resource.id], json=config)
|
|
37
37
|
|
|
38
38
|
def _unshare(self, resource: ShareableResource, user_email: str):
|
|
39
|
-
config = {"
|
|
39
|
+
config = {"user_email": user_email}
|
|
40
40
|
resource_type = self.RESOURCE_TYPE.get(type(resource))
|
|
41
41
|
self.request(verb=DELETE, path=[resource_type, resource.id], json=config)
|
|
42
42
|
|
|
@@ -23,6 +23,7 @@ from mostlyai.model import (
|
|
|
23
23
|
StepCode,
|
|
24
24
|
SyntheticDataset,
|
|
25
25
|
)
|
|
26
|
+
from mostlyai.naming_conventions import map_camel_to_snake_case
|
|
26
27
|
|
|
27
28
|
warnings.simplefilter("always", DeprecationWarning)
|
|
28
29
|
|
|
@@ -173,13 +174,15 @@ def _harmonize_sd_config(
|
|
|
173
174
|
size = size if size is not None else {}
|
|
174
175
|
seed = seed if seed is not None else {}
|
|
175
176
|
|
|
177
|
+
config = map_camel_to_snake_case(config)
|
|
178
|
+
|
|
176
179
|
if isinstance(generator, Generator):
|
|
177
180
|
generator_id = str(generator.id)
|
|
178
181
|
elif generator is not None:
|
|
179
182
|
generator_id = str(generator)
|
|
180
|
-
elif "
|
|
183
|
+
elif "generator_id" not in config:
|
|
181
184
|
raise ValueError(
|
|
182
|
-
"Either a generator or a configuration with a
|
|
185
|
+
"Either a generator or a configuration with a generator_id must be provided."
|
|
183
186
|
)
|
|
184
187
|
|
|
185
188
|
if (
|
|
@@ -193,8 +196,8 @@ def _harmonize_sd_config(
|
|
|
193
196
|
else:
|
|
194
197
|
subject_tables = []
|
|
195
198
|
|
|
196
|
-
# insert
|
|
197
|
-
config["
|
|
199
|
+
# insert generator_id into config
|
|
200
|
+
config["generator_id"] = generator_id
|
|
198
201
|
|
|
199
202
|
# normalize size
|
|
200
203
|
if not isinstance(size, dict):
|
|
@@ -213,18 +216,18 @@ def _harmonize_sd_config(
|
|
|
213
216
|
config["tables"] = []
|
|
214
217
|
for table in generator.tables:
|
|
215
218
|
configuration = {
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
+
"sample_size": None,
|
|
220
|
+
"sample_seed_data": None,
|
|
221
|
+
"sample_seed_dict": None,
|
|
219
222
|
}
|
|
220
223
|
if table.name in subject_tables:
|
|
221
|
-
configuration["
|
|
222
|
-
configuration["
|
|
224
|
+
configuration["sample_size"] = size.get(table.name)
|
|
225
|
+
configuration["sample_seed_data"] = (
|
|
223
226
|
seed.get(table.name)
|
|
224
227
|
if not isinstance(seed.get(table.name), list)
|
|
225
228
|
else None
|
|
226
229
|
)
|
|
227
|
-
configuration["
|
|
230
|
+
configuration["sample_seed_dict"] = (
|
|
228
231
|
seed.get(table.name)
|
|
229
232
|
if isinstance(seed.get(table.name), list)
|
|
230
233
|
else None
|
|
@@ -238,25 +241,27 @@ def _harmonize_sd_config(
|
|
|
238
241
|
tables = config["tables"] if "tables" in config else []
|
|
239
242
|
for table in tables:
|
|
240
243
|
if (
|
|
241
|
-
"
|
|
242
|
-
and table["configuration"]["
|
|
244
|
+
"sample_seed_data" in table["configuration"]
|
|
245
|
+
and table["configuration"]["sample_seed_data"] is not None
|
|
243
246
|
):
|
|
244
|
-
if isinstance(table["configuration"]["
|
|
245
|
-
table["configuration"]["
|
|
246
|
-
table["configuration"]["
|
|
247
|
+
if isinstance(table["configuration"]["sample_seed_data"], pd.DataFrame):
|
|
248
|
+
table["configuration"]["sample_seed_data"] = _convert_to_base64(
|
|
249
|
+
table["configuration"]["sample_seed_data"]
|
|
250
|
+
)
|
|
251
|
+
elif isinstance(table["configuration"]["sample_seed_data"], (Path, str)):
|
|
252
|
+
_, df = _read_table_from_path(
|
|
253
|
+
table["configuration"]["sample_seed_data"]
|
|
247
254
|
)
|
|
248
|
-
|
|
249
|
-
_, df = _read_table_from_path(table["configuration"]["sampleSeedData"])
|
|
250
|
-
table["configuration"]["sampleSeedData"] = _convert_to_base64(df)
|
|
255
|
+
table["configuration"]["sample_seed_data"] = _convert_to_base64(df)
|
|
251
256
|
del df
|
|
252
257
|
else:
|
|
253
|
-
raise ValueError("
|
|
258
|
+
raise ValueError("sample_seed_data must be a DataFrame or a file path")
|
|
254
259
|
if (
|
|
255
|
-
"
|
|
256
|
-
and table["configuration"]["
|
|
260
|
+
"sample_seed_dict" in table["configuration"]
|
|
261
|
+
and table["configuration"]["sample_seed_dict"] is not None
|
|
257
262
|
):
|
|
258
|
-
table["configuration"]["
|
|
259
|
-
table["configuration"]["
|
|
263
|
+
table["configuration"]["sample_seed_dict"] = _convert_to_base64(
|
|
264
|
+
table["configuration"]["sample_seed_dict"], format="jsonl"
|
|
260
265
|
)
|
|
261
266
|
|
|
262
267
|
return config
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "0.4.
|
|
3
|
+
version = "0.4.4"
|
|
4
4
|
description = "The official Python client for the MOSTLY AI platform."
|
|
5
5
|
homepage = "https://app.mostly.ai/"
|
|
6
6
|
authors = ["MOSTLY AI <office@mostly.ai>"]
|
|
@@ -11,6 +11,11 @@ packages = [
|
|
|
11
11
|
]
|
|
12
12
|
exclude = ["tools/", "tools/**/*"]
|
|
13
13
|
|
|
14
|
+
[tool.poetry.urls]
|
|
15
|
+
"Homepage" = "https://app.mostly.ai/"
|
|
16
|
+
"Documentation" = "https://mostly-ai.github.io/mostly-python/"
|
|
17
|
+
"Source" = "https://github.com/mostly-ai/mostly-python"
|
|
18
|
+
|
|
14
19
|
[tool.poetry.dependencies]
|
|
15
20
|
python = "^3.9"
|
|
16
21
|
pydantic = "^2.4.2"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|