mostlyai 0.3.12__tar.gz → 0.3.13__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.3.12 → mostlyai-0.3.13}/PKG-INFO +16 -3
- {mostlyai-0.3.12 → mostlyai-0.3.13}/README.md +15 -2
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/__init__.py +1 -1
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/api.py +2 -0
- mostlyai-0.3.13/mostlyai/computes.py +72 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/model.py +353 -292
- {mostlyai-0.3.12 → mostlyai-0.3.13}/pyproject.toml +1 -1
- {mostlyai-0.3.12 → mostlyai-0.3.13}/LICENSE +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/base.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/connectors.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/generators.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/shares.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/synthetic_datasets.py +0 -0
- {mostlyai-0.3.12 → mostlyai-0.3.13}/mostlyai/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.13
|
|
4
4
|
Summary: The official Python client for the MOSTLY AI platform.
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Proprietary
|
|
@@ -33,7 +33,7 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
|
|
|
33
33
|
| Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
|
|
34
34
|
| Connect to any data source within your org | `mostly.connect(config)` |
|
|
35
35
|
| Info about the current user | `mostly.me()` |
|
|
36
|
-
| Info about the usage | `mostly.
|
|
36
|
+
| Info about the usage | `mostly.usage_report()` |
|
|
37
37
|
| Info about the platform | `mostly.about()` |
|
|
38
38
|
|
|
39
39
|
|
|
@@ -142,11 +142,24 @@ sd.shares()
|
|
|
142
142
|
c.shares()
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
+
### Computes
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
l = mostly.computes.list()
|
|
149
|
+
|
|
150
|
+
cmp = mostly.computes.create(config)
|
|
151
|
+
cmp = mostly.computes.get(id)
|
|
152
|
+
|
|
153
|
+
cmp.update(config)
|
|
154
|
+
cmp.delete()
|
|
155
|
+
```
|
|
156
|
+
|
|
145
157
|
### Info
|
|
146
158
|
|
|
147
159
|
```python
|
|
148
160
|
mostly.me()
|
|
149
|
-
mostly.usage_report(
|
|
161
|
+
mostly.usage_report()
|
|
162
|
+
mostly.usage_report(by_periods=True)
|
|
150
163
|
mostly.about()
|
|
151
164
|
```
|
|
152
165
|
|
|
@@ -11,7 +11,7 @@ A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
|
|
|
11
11
|
| Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
|
|
12
12
|
| Connect to any data source within your org | `mostly.connect(config)` |
|
|
13
13
|
| Info about the current user | `mostly.me()` |
|
|
14
|
-
| Info about the usage | `mostly.
|
|
14
|
+
| Info about the usage | `mostly.usage_report()` |
|
|
15
15
|
| Info about the platform | `mostly.about()` |
|
|
16
16
|
|
|
17
17
|
|
|
@@ -120,10 +120,23 @@ sd.shares()
|
|
|
120
120
|
c.shares()
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
+
### Computes
|
|
124
|
+
|
|
125
|
+
```python
|
|
126
|
+
l = mostly.computes.list()
|
|
127
|
+
|
|
128
|
+
cmp = mostly.computes.create(config)
|
|
129
|
+
cmp = mostly.computes.get(id)
|
|
130
|
+
|
|
131
|
+
cmp.update(config)
|
|
132
|
+
cmp.delete()
|
|
133
|
+
```
|
|
134
|
+
|
|
123
135
|
### Info
|
|
124
136
|
|
|
125
137
|
```python
|
|
126
138
|
mostly.me()
|
|
127
|
-
mostly.usage_report(
|
|
139
|
+
mostly.usage_report()
|
|
140
|
+
mostly.usage_report(by_periods=True)
|
|
128
141
|
mostly.about()
|
|
129
142
|
```
|
|
@@ -7,6 +7,7 @@ import pandas as pd
|
|
|
7
7
|
import rich
|
|
8
8
|
|
|
9
9
|
from mostlyai.base import GET, _MostlyBaseClient
|
|
10
|
+
from mostlyai.computes import _MostlyComputesClient
|
|
10
11
|
from mostlyai.connectors import _MostlyConnectorsClient
|
|
11
12
|
from mostlyai.generators import _MostlyGeneratorsClient
|
|
12
13
|
from mostlyai.model import (
|
|
@@ -61,6 +62,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
61
62
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
62
63
|
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
63
64
|
self.shares = _MostlySharesClient(**client_kwargs)
|
|
65
|
+
self.computes = _MostlyComputesClient(**client_kwargs)
|
|
64
66
|
|
|
65
67
|
def connect(self, config: dict[str, Any]) -> Connector:
|
|
66
68
|
"""
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
from mostlyai.base import DELETE, GET, POST, _MostlyBaseClient, PATCH
|
|
4
|
+
from mostlyai.model import (
|
|
5
|
+
Compute,
|
|
6
|
+
)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _MostlyComputesClient(_MostlyBaseClient):
|
|
10
|
+
SECTION = ["computes"]
|
|
11
|
+
|
|
12
|
+
# PUBLIC METHODS #
|
|
13
|
+
|
|
14
|
+
def list(self) -> list[Compute]:
|
|
15
|
+
"""
|
|
16
|
+
List the available computes, sorted by order index. The first returned compute is the default compute.
|
|
17
|
+
|
|
18
|
+
:return: List the available computes
|
|
19
|
+
"""
|
|
20
|
+
response = self.request(verb=GET, path=[])
|
|
21
|
+
response = [Compute(**compute) for compute in response]
|
|
22
|
+
return response
|
|
23
|
+
|
|
24
|
+
def create(
|
|
25
|
+
self,
|
|
26
|
+
config: dict[str, Any],
|
|
27
|
+
) -> Compute:
|
|
28
|
+
"""
|
|
29
|
+
Create a compute. Only accessible for SuperAdmins.
|
|
30
|
+
The structures of the config and secrets parameters depend on the compute type.
|
|
31
|
+
```yaml
|
|
32
|
+
- type: KUBERNETES
|
|
33
|
+
config:
|
|
34
|
+
toleration: string
|
|
35
|
+
- type: DATABRICKS
|
|
36
|
+
config:
|
|
37
|
+
instanceURL: string
|
|
38
|
+
clusterID: string
|
|
39
|
+
secrets:
|
|
40
|
+
token: string
|
|
41
|
+
```
|
|
42
|
+
"""
|
|
43
|
+
response = self.request(verb=POST, path=[], json=config, response_type=Compute)
|
|
44
|
+
return response
|
|
45
|
+
|
|
46
|
+
def get(self, compute_id: str) -> Compute:
|
|
47
|
+
"""
|
|
48
|
+
Retrieve compute.
|
|
49
|
+
|
|
50
|
+
:param compute_id: The unique identifier of a compute
|
|
51
|
+
:return: The retrieved compute
|
|
52
|
+
"""
|
|
53
|
+
response = self.request(verb=GET, path=[compute_id], response_type=Compute)
|
|
54
|
+
return response
|
|
55
|
+
|
|
56
|
+
# PRIVATE METHODS #
|
|
57
|
+
|
|
58
|
+
def _update(
|
|
59
|
+
self,
|
|
60
|
+
compute_id: str,
|
|
61
|
+
config: dict[str, Any],
|
|
62
|
+
) -> Compute:
|
|
63
|
+
response = self.request(
|
|
64
|
+
verb=PATCH,
|
|
65
|
+
path=[compute_id],
|
|
66
|
+
json=config,
|
|
67
|
+
response_type=Compute,
|
|
68
|
+
)
|
|
69
|
+
return response
|
|
70
|
+
|
|
71
|
+
def _delete(self, compute_id: str) -> None:
|
|
72
|
+
self.request(verb=DELETE, path=[compute_id])
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
|
-
# timestamp: 2024-08-
|
|
2
|
+
# timestamp: 2024-08-16T09:29:18+00:00
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -464,95 +464,6 @@ class RareCategoryReplacementMethod(str, Enum):
|
|
|
464
464
|
sample = "SAMPLE"
|
|
465
465
|
|
|
466
466
|
|
|
467
|
-
class ModelConfiguration(CustomBaseModel):
|
|
468
|
-
"""
|
|
469
|
-
The training configuration for a AI model
|
|
470
|
-
"""
|
|
471
|
-
|
|
472
|
-
max_sample_size: Annotated[
|
|
473
|
-
Optional[int],
|
|
474
|
-
Field(
|
|
475
|
-
None,
|
|
476
|
-
alias="maxSampleSize",
|
|
477
|
-
description="The maximum number of samples to consider for training.\nIf not provided, then all available samples will be taken.\n",
|
|
478
|
-
ge=1,
|
|
479
|
-
le=1000000000,
|
|
480
|
-
),
|
|
481
|
-
] = None
|
|
482
|
-
batch_size: Annotated[
|
|
483
|
-
Optional[int],
|
|
484
|
-
Field(
|
|
485
|
-
None,
|
|
486
|
-
alias="batchSize",
|
|
487
|
-
description="The batch size used for training the model.\nIf not provided, batchSize will be chosen automatically.\n",
|
|
488
|
-
ge=1,
|
|
489
|
-
le=1000000,
|
|
490
|
-
),
|
|
491
|
-
] = None
|
|
492
|
-
model_size: Annotated[
|
|
493
|
-
Optional[ModelSize],
|
|
494
|
-
Field(
|
|
495
|
-
"M",
|
|
496
|
-
alias="modelSize",
|
|
497
|
-
description="The size of the model, with the default being M(edium).\nChoose S(mall) for faster training, or L(arge) for better results for large dataset.\nNote, that larger model sizes will require more memory and more compute.\n",
|
|
498
|
-
),
|
|
499
|
-
] = "M"
|
|
500
|
-
max_training_time: Annotated[
|
|
501
|
-
Optional[int],
|
|
502
|
-
Field(
|
|
503
|
-
10,
|
|
504
|
-
alias="maxTrainingTime",
|
|
505
|
-
description="The maximum number of minutes to train the model.",
|
|
506
|
-
ge=0,
|
|
507
|
-
le=100000,
|
|
508
|
-
),
|
|
509
|
-
] = 10
|
|
510
|
-
max_epochs: Annotated[
|
|
511
|
-
Optional[int],
|
|
512
|
-
Field(
|
|
513
|
-
100,
|
|
514
|
-
alias="maxEpochs",
|
|
515
|
-
description="The maximum number of epochs to train the model.",
|
|
516
|
-
ge=0,
|
|
517
|
-
le=100000,
|
|
518
|
-
),
|
|
519
|
-
] = 100
|
|
520
|
-
max_sequence_window: Annotated[
|
|
521
|
-
Optional[int],
|
|
522
|
-
Field(
|
|
523
|
-
100,
|
|
524
|
-
alias="maxSequenceWindow",
|
|
525
|
-
description="The maximum sequence window to consider for training.",
|
|
526
|
-
ge=1,
|
|
527
|
-
le=100000,
|
|
528
|
-
),
|
|
529
|
-
] = 100
|
|
530
|
-
enable_flexible_generation: Annotated[
|
|
531
|
-
Optional[bool],
|
|
532
|
-
Field(
|
|
533
|
-
True,
|
|
534
|
-
alias="enableFlexibleGeneration",
|
|
535
|
-
description="If true, then the trained generator can be used for rebalancing and imputation.\n",
|
|
536
|
-
),
|
|
537
|
-
] = True
|
|
538
|
-
value_protection: Annotated[
|
|
539
|
-
Optional[bool],
|
|
540
|
-
Field(
|
|
541
|
-
True,
|
|
542
|
-
alias="valueProtection",
|
|
543
|
-
description="Defines if Rare Category, Extreme value, or Sequence length protection will be applied.\n",
|
|
544
|
-
),
|
|
545
|
-
] = True
|
|
546
|
-
rare_category_replacement_method: Annotated[
|
|
547
|
-
Optional[RareCategoryReplacementMethod],
|
|
548
|
-
Field(
|
|
549
|
-
"CONSTANT",
|
|
550
|
-
alias="rareCategoryReplacementMethod",
|
|
551
|
-
description="Specifies, if the rare categories for categoricals will be replaced by a constant\n_RARE_ or by a sample from non-rare categories.\n",
|
|
552
|
-
),
|
|
553
|
-
] = "CONSTANT"
|
|
554
|
-
|
|
555
|
-
|
|
556
467
|
class Accuracy(CustomBaseModel):
|
|
557
468
|
overall: Annotated[
|
|
558
469
|
Optional[float],
|
|
@@ -758,71 +669,6 @@ class SyntheticTableFairness(CustomBaseModel):
|
|
|
758
669
|
sensitive_columns: Annotated[List[str], Field(alias="sensitiveColumns")]
|
|
759
670
|
|
|
760
671
|
|
|
761
|
-
class SyntheticTableConfiguration(CustomBaseModel):
|
|
762
|
-
"""
|
|
763
|
-
The sample configuration for a synthetic table
|
|
764
|
-
"""
|
|
765
|
-
|
|
766
|
-
sample_size: Annotated[
|
|
767
|
-
Optional[int],
|
|
768
|
-
Field(
|
|
769
|
-
None,
|
|
770
|
-
alias="sampleSize",
|
|
771
|
-
description="Number of generated samples. Only applicable for subject tables.\nIf neither size nor seed is provided, then the default behavior for Synthetic Datasets is to generate the\nsame size of samples as the original, and the default behavior for Synthetic Datasets is to generate one\nsubject only.\n",
|
|
772
|
-
ge=1,
|
|
773
|
-
),
|
|
774
|
-
] = None
|
|
775
|
-
sample_seed_connector_id: Annotated[
|
|
776
|
-
Optional[str],
|
|
777
|
-
Field(
|
|
778
|
-
None,
|
|
779
|
-
alias="sampleSeedConnectorId",
|
|
780
|
-
description="The connector id of the seed data for conditional generation.\nOnly applicable for subject tables.\n",
|
|
781
|
-
),
|
|
782
|
-
] = None
|
|
783
|
-
sample_seed_dict: Annotated[
|
|
784
|
-
Optional[str],
|
|
785
|
-
Field(
|
|
786
|
-
None,
|
|
787
|
-
alias="sampleSeedDict",
|
|
788
|
-
description="The base64-encoded string derived from a json line file containing the specified sample seed data.\n",
|
|
789
|
-
),
|
|
790
|
-
] = None
|
|
791
|
-
sample_seed_data: Annotated[
|
|
792
|
-
Optional[str],
|
|
793
|
-
Field(
|
|
794
|
-
None,
|
|
795
|
-
alias="sampleSeedData",
|
|
796
|
-
description="The base64-encoded string derived from a Parquet file containing the specified sample seed data.\n",
|
|
797
|
-
),
|
|
798
|
-
] = None
|
|
799
|
-
sampling_temperature: Annotated[
|
|
800
|
-
Optional[float],
|
|
801
|
-
Field(
|
|
802
|
-
None,
|
|
803
|
-
alias="samplingTemperature",
|
|
804
|
-
description="temperature for sampling",
|
|
805
|
-
ge=0.0,
|
|
806
|
-
le=10.0,
|
|
807
|
-
),
|
|
808
|
-
] = None
|
|
809
|
-
sampling_top_p: Annotated[
|
|
810
|
-
Optional[float],
|
|
811
|
-
Field(
|
|
812
|
-
None, alias="samplingTopP", description="topP for sampling", ge=0.0, le=1.0
|
|
813
|
-
),
|
|
814
|
-
] = None
|
|
815
|
-
rebalancing: Optional[SyntheticTableRebalancing] = None
|
|
816
|
-
imputation: Annotated[
|
|
817
|
-
Optional[List[str]],
|
|
818
|
-
Field(
|
|
819
|
-
None,
|
|
820
|
-
description="Specify a list of column names that are to be imputed.\nImputed columns will suppress the sampling of NULL values.\n",
|
|
821
|
-
),
|
|
822
|
-
] = None
|
|
823
|
-
fairness: Optional[SyntheticTableFairness] = None
|
|
824
|
-
|
|
825
|
-
|
|
826
672
|
class SyntheticTableName(RootModel[str]):
|
|
827
673
|
root: Annotated[
|
|
828
674
|
str,
|
|
@@ -850,52 +696,6 @@ class ForeignKey(CustomBaseModel):
|
|
|
850
696
|
]
|
|
851
697
|
|
|
852
698
|
|
|
853
|
-
class SyntheticTable(CustomBaseModel):
|
|
854
|
-
id: Annotated[
|
|
855
|
-
Optional[str],
|
|
856
|
-
Field(None, description="The unique identifier of a synthetic table"),
|
|
857
|
-
] = None
|
|
858
|
-
name: Annotated[
|
|
859
|
-
Optional[str],
|
|
860
|
-
Field(
|
|
861
|
-
None,
|
|
862
|
-
description="The name of a source table. It must be unique within a generator.",
|
|
863
|
-
),
|
|
864
|
-
] = None
|
|
865
|
-
configuration: Optional[SyntheticTableConfiguration] = None
|
|
866
|
-
model_metrics: Annotated[
|
|
867
|
-
Optional[ModelMetrics], Field(None, alias="modelMetrics")
|
|
868
|
-
] = None
|
|
869
|
-
foreign_keys: Annotated[
|
|
870
|
-
Optional[List[ForeignKey]],
|
|
871
|
-
Field(None, alias="foreignKeys", description="The foreign keys of this table."),
|
|
872
|
-
] = None
|
|
873
|
-
total_rows: Annotated[
|
|
874
|
-
Optional[int],
|
|
875
|
-
Field(
|
|
876
|
-
None,
|
|
877
|
-
alias="totalRows",
|
|
878
|
-
description="The total number of rows for that table in the generated synthetic dataset.\n",
|
|
879
|
-
),
|
|
880
|
-
] = None
|
|
881
|
-
total_datapoints: Annotated[
|
|
882
|
-
Optional[int],
|
|
883
|
-
Field(
|
|
884
|
-
None,
|
|
885
|
-
alias="totalDatapoints",
|
|
886
|
-
description="The total number of datapoints for that table in the generated synthetic dataset.\n",
|
|
887
|
-
),
|
|
888
|
-
] = None
|
|
889
|
-
source_table_total_rows: Annotated[
|
|
890
|
-
Optional[int],
|
|
891
|
-
Field(
|
|
892
|
-
None,
|
|
893
|
-
alias="sourceTableTotalRows",
|
|
894
|
-
description="The total number of rows in the source table while fetching data for training.\n",
|
|
895
|
-
),
|
|
896
|
-
] = None
|
|
897
|
-
|
|
898
|
-
|
|
899
699
|
class SyntheticDatasetDelivery(CustomBaseModel):
|
|
900
700
|
overwrite_tables: Annotated[
|
|
901
701
|
bool,
|
|
@@ -1093,6 +893,60 @@ class AssistantThreadUsage(CustomBaseModel):
|
|
|
1093
893
|
] = None
|
|
1094
894
|
|
|
1095
895
|
|
|
896
|
+
class ComputeResources(CustomBaseModel):
|
|
897
|
+
cpus: Annotated[
|
|
898
|
+
Optional[int], Field(None, description="The number of CPU cores")
|
|
899
|
+
] = None
|
|
900
|
+
memory: Annotated[
|
|
901
|
+
Optional[float], Field(None, description="The amount of memory in GB")
|
|
902
|
+
] = None
|
|
903
|
+
gpus: Annotated[Optional[int], Field(0, description="The number of GPUs")] = 0
|
|
904
|
+
gpu_memory: Annotated[
|
|
905
|
+
Optional[float],
|
|
906
|
+
Field(0, alias="gpuMemory", description="The amount of GPU memory in GB"),
|
|
907
|
+
] = 0
|
|
908
|
+
|
|
909
|
+
|
|
910
|
+
class ComputeListItem(CustomBaseModel):
|
|
911
|
+
id: Optional[str] = None
|
|
912
|
+
type: Optional[Literal["KUBERNETES"]] = None
|
|
913
|
+
name: Optional[str] = None
|
|
914
|
+
resources: Optional[ComputeResources] = None
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
class Compute(CustomBaseModel):
|
|
918
|
+
id: Optional[str] = None
|
|
919
|
+
name: Optional[str] = None
|
|
920
|
+
type: Optional[Literal["KUBERNETES"]] = None
|
|
921
|
+
config: Optional[Dict[str, Any]] = None
|
|
922
|
+
secrets: Optional[Dict[str, Any]] = None
|
|
923
|
+
resources: Optional[ComputeResources] = None
|
|
924
|
+
order_index: Annotated[
|
|
925
|
+
Optional[int],
|
|
926
|
+
Field(
|
|
927
|
+
None,
|
|
928
|
+
alias="orderIndex",
|
|
929
|
+
description="The index for determining the sort order when listing computes",
|
|
930
|
+
),
|
|
931
|
+
] = None
|
|
932
|
+
|
|
933
|
+
def update(self, config) -> "Compute":
|
|
934
|
+
"""
|
|
935
|
+
Update a compute. Only accessible for SuperAdmins.
|
|
936
|
+
|
|
937
|
+
For the structure of the config and secrets, see the CREATE method.
|
|
938
|
+
|
|
939
|
+
:return: The updated compute
|
|
940
|
+
"""
|
|
941
|
+
return self.client._update(compute_id=self.id, config=config)
|
|
942
|
+
|
|
943
|
+
def delete(self):
|
|
944
|
+
"""
|
|
945
|
+
Delete compute. Only accessible for SuperAdmins.
|
|
946
|
+
"""
|
|
947
|
+
return self.client._delete(compute_id=self.id)
|
|
948
|
+
|
|
949
|
+
|
|
1096
950
|
class UsageReportPeriod(CustomBaseModel):
|
|
1097
951
|
"""
|
|
1098
952
|
The usage report for a specific month
|
|
@@ -1210,20 +1064,306 @@ class GeneratorListItem(CustomBaseModel):
|
|
|
1210
1064
|
] = None
|
|
1211
1065
|
|
|
1212
1066
|
|
|
1213
|
-
class
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
] = None
|
|
1218
|
-
|
|
1219
|
-
|
|
1067
|
+
class Probe(CustomBaseModel):
|
|
1068
|
+
name: Annotated[Optional[str], Field(None, description="The name of the table")] = (
|
|
1069
|
+
None
|
|
1070
|
+
)
|
|
1071
|
+
rows: Optional[List[Dict[str, Any]]] = None
|
|
1072
|
+
|
|
1073
|
+
|
|
1074
|
+
class ModelConfiguration(CustomBaseModel):
|
|
1075
|
+
"""
|
|
1076
|
+
The training configuration for a AI model
|
|
1077
|
+
"""
|
|
1078
|
+
|
|
1079
|
+
max_sample_size: Annotated[
|
|
1080
|
+
Optional[int],
|
|
1220
1081
|
Field(
|
|
1221
1082
|
None,
|
|
1222
|
-
|
|
1083
|
+
alias="maxSampleSize",
|
|
1084
|
+
description="The maximum number of samples to consider for training.\nIf not provided, then all available samples will be taken.\n",
|
|
1085
|
+
ge=1,
|
|
1086
|
+
le=1000000000,
|
|
1223
1087
|
),
|
|
1224
1088
|
] = None
|
|
1225
|
-
|
|
1226
|
-
|
|
1089
|
+
batch_size: Annotated[
|
|
1090
|
+
Optional[int],
|
|
1091
|
+
Field(
|
|
1092
|
+
None,
|
|
1093
|
+
alias="batchSize",
|
|
1094
|
+
description="The batch size used for training the model.\nIf not provided, batchSize will be chosen automatically.\n",
|
|
1095
|
+
ge=1,
|
|
1096
|
+
le=1000000,
|
|
1097
|
+
),
|
|
1098
|
+
] = None
|
|
1099
|
+
model_size: Annotated[
|
|
1100
|
+
Optional[ModelSize],
|
|
1101
|
+
Field(
|
|
1102
|
+
"M",
|
|
1103
|
+
alias="modelSize",
|
|
1104
|
+
description="The size of the model, with the default being M(edium).\nChoose S(mall) for faster training, or L(arge) for better results for large dataset.\nNote, that larger model sizes will require more memory and more compute.\n",
|
|
1105
|
+
),
|
|
1106
|
+
] = "M"
|
|
1107
|
+
max_training_time: Annotated[
|
|
1108
|
+
Optional[int],
|
|
1109
|
+
Field(
|
|
1110
|
+
10,
|
|
1111
|
+
alias="maxTrainingTime",
|
|
1112
|
+
description="The maximum number of minutes to train the model.",
|
|
1113
|
+
ge=0,
|
|
1114
|
+
le=100000,
|
|
1115
|
+
),
|
|
1116
|
+
] = 10
|
|
1117
|
+
max_epochs: Annotated[
|
|
1118
|
+
Optional[int],
|
|
1119
|
+
Field(
|
|
1120
|
+
100,
|
|
1121
|
+
alias="maxEpochs",
|
|
1122
|
+
description="The maximum number of epochs to train the model.",
|
|
1123
|
+
ge=0,
|
|
1124
|
+
le=100000,
|
|
1125
|
+
),
|
|
1126
|
+
] = 100
|
|
1127
|
+
max_sequence_window: Annotated[
|
|
1128
|
+
Optional[int],
|
|
1129
|
+
Field(
|
|
1130
|
+
100,
|
|
1131
|
+
alias="maxSequenceWindow",
|
|
1132
|
+
description="The maximum sequence window to consider for training.",
|
|
1133
|
+
ge=1,
|
|
1134
|
+
le=100000,
|
|
1135
|
+
),
|
|
1136
|
+
] = 100
|
|
1137
|
+
enable_flexible_generation: Annotated[
|
|
1138
|
+
Optional[bool],
|
|
1139
|
+
Field(
|
|
1140
|
+
True,
|
|
1141
|
+
alias="enableFlexibleGeneration",
|
|
1142
|
+
description="If true, then the trained generator can be used for rebalancing and imputation.\n",
|
|
1143
|
+
),
|
|
1144
|
+
] = True
|
|
1145
|
+
value_protection: Annotated[
|
|
1146
|
+
Optional[bool],
|
|
1147
|
+
Field(
|
|
1148
|
+
True,
|
|
1149
|
+
alias="valueProtection",
|
|
1150
|
+
description="Defines if Rare Category, Extreme value, or Sequence length protection will be applied.\n",
|
|
1151
|
+
),
|
|
1152
|
+
] = True
|
|
1153
|
+
rare_category_replacement_method: Annotated[
|
|
1154
|
+
Optional[RareCategoryReplacementMethod],
|
|
1155
|
+
Field(
|
|
1156
|
+
"CONSTANT",
|
|
1157
|
+
alias="rareCategoryReplacementMethod",
|
|
1158
|
+
description="Specifies, if the rare categories for categoricals will be replaced by a constant\n_RARE_ or by a sample from non-rare categories.\n",
|
|
1159
|
+
),
|
|
1160
|
+
] = "CONSTANT"
|
|
1161
|
+
compute: Optional[str] = None
|
|
1162
|
+
|
|
1163
|
+
|
|
1164
|
+
class ProgressStep(CustomBaseModel):
|
|
1165
|
+
id: Optional[str] = None
|
|
1166
|
+
model_label: Annotated[
|
|
1167
|
+
Optional[str],
|
|
1168
|
+
Field(
|
|
1169
|
+
None,
|
|
1170
|
+
alias="modelLabel",
|
|
1171
|
+
description="The unique label for the model, consisting of table name and an optional suffix for text model.\nThis will be empty for steps that are not related to a model.\n",
|
|
1172
|
+
examples=[["census", "census:text"]],
|
|
1173
|
+
),
|
|
1174
|
+
] = None
|
|
1175
|
+
step_code: Annotated[Optional[StepCode], Field(None, alias="stepCode")] = None
|
|
1176
|
+
start_date: Annotated[
|
|
1177
|
+
Optional[AwareDatetime],
|
|
1178
|
+
Field(
|
|
1179
|
+
None,
|
|
1180
|
+
alias="startDate",
|
|
1181
|
+
description="The UTC date and time when the job has started.\nIf the job has not started yet, then this is None.\n",
|
|
1182
|
+
examples=["2024-01-25T12:34:56Z"],
|
|
1183
|
+
),
|
|
1184
|
+
] = None
|
|
1185
|
+
end_date: Annotated[
|
|
1186
|
+
Optional[AwareDatetime],
|
|
1187
|
+
Field(
|
|
1188
|
+
None,
|
|
1189
|
+
alias="endDate",
|
|
1190
|
+
description="The UTC date and time when the job has ended.\nIf the job is still, then this is None.\n",
|
|
1191
|
+
examples=["2024-01-25T12:34:56Z"],
|
|
1192
|
+
),
|
|
1193
|
+
] = None
|
|
1194
|
+
messages: Optional[List[Dict[str, Any]]] = None
|
|
1195
|
+
progress: Optional[ProgressValue] = None
|
|
1196
|
+
status: Optional[ProgressStatus] = None
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
class SyntheticTableConfiguration(CustomBaseModel):
|
|
1200
|
+
"""
|
|
1201
|
+
The sample configuration for a synthetic table
|
|
1202
|
+
"""
|
|
1203
|
+
|
|
1204
|
+
sample_size: Annotated[
|
|
1205
|
+
Optional[int],
|
|
1206
|
+
Field(
|
|
1207
|
+
None,
|
|
1208
|
+
alias="sampleSize",
|
|
1209
|
+
description="Number of generated samples. Only applicable for subject tables.\nIf neither size nor seed is provided, then the default behavior for Synthetic Datasets is to generate the\nsame size of samples as the original, and the default behavior for Synthetic Datasets is to generate one\nsubject only.\n",
|
|
1210
|
+
ge=1,
|
|
1211
|
+
),
|
|
1212
|
+
] = None
|
|
1213
|
+
sample_seed_connector_id: Annotated[
|
|
1214
|
+
Optional[str],
|
|
1215
|
+
Field(
|
|
1216
|
+
None,
|
|
1217
|
+
alias="sampleSeedConnectorId",
|
|
1218
|
+
description="The connector id of the seed data for conditional generation.\nOnly applicable for subject tables.\n",
|
|
1219
|
+
),
|
|
1220
|
+
] = None
|
|
1221
|
+
sample_seed_dict: Annotated[
|
|
1222
|
+
Optional[str],
|
|
1223
|
+
Field(
|
|
1224
|
+
None,
|
|
1225
|
+
alias="sampleSeedDict",
|
|
1226
|
+
description="The base64-encoded string derived from a json line file containing the specified sample seed data.\n",
|
|
1227
|
+
),
|
|
1228
|
+
] = None
|
|
1229
|
+
sample_seed_data: Annotated[
|
|
1230
|
+
Optional[str],
|
|
1231
|
+
Field(
|
|
1232
|
+
None,
|
|
1233
|
+
alias="sampleSeedData",
|
|
1234
|
+
description="The base64-encoded string derived from a Parquet file containing the specified sample seed data.\n",
|
|
1235
|
+
),
|
|
1236
|
+
] = None
|
|
1237
|
+
sampling_temperature: Annotated[
|
|
1238
|
+
Optional[float],
|
|
1239
|
+
Field(
|
|
1240
|
+
None,
|
|
1241
|
+
alias="samplingTemperature",
|
|
1242
|
+
description="temperature for sampling",
|
|
1243
|
+
ge=0.0,
|
|
1244
|
+
le=10.0,
|
|
1245
|
+
),
|
|
1246
|
+
] = None
|
|
1247
|
+
sampling_top_p: Annotated[
|
|
1248
|
+
Optional[float],
|
|
1249
|
+
Field(
|
|
1250
|
+
None, alias="samplingTopP", description="topP for sampling", ge=0.0, le=1.0
|
|
1251
|
+
),
|
|
1252
|
+
] = None
|
|
1253
|
+
rebalancing: Optional[SyntheticTableRebalancing] = None
|
|
1254
|
+
imputation: Annotated[
|
|
1255
|
+
Optional[List[str]],
|
|
1256
|
+
Field(
|
|
1257
|
+
None,
|
|
1258
|
+
description="Specify a list of column names that are to be imputed.\nImputed columns will suppress the sampling of NULL values.\n",
|
|
1259
|
+
),
|
|
1260
|
+
] = None
|
|
1261
|
+
fairness: Optional[SyntheticTableFairness] = None
|
|
1262
|
+
tabular_compute: Annotated[Optional[str], Field(None, alias="tabularCompute")] = (
|
|
1263
|
+
None
|
|
1264
|
+
)
|
|
1265
|
+
language_compute: Annotated[Optional[str], Field(None, alias="languageCompute")] = (
|
|
1266
|
+
None
|
|
1267
|
+
)
|
|
1268
|
+
|
|
1269
|
+
|
|
1270
|
+
class SyntheticTable(CustomBaseModel):
|
|
1271
|
+
id: Annotated[
|
|
1272
|
+
Optional[str],
|
|
1273
|
+
Field(None, description="The unique identifier of a synthetic table"),
|
|
1274
|
+
] = None
|
|
1275
|
+
name: Annotated[
|
|
1276
|
+
Optional[str],
|
|
1277
|
+
Field(
|
|
1278
|
+
None,
|
|
1279
|
+
description="The name of a source table. It must be unique within a generator.",
|
|
1280
|
+
),
|
|
1281
|
+
] = None
|
|
1282
|
+
configuration: Optional[SyntheticTableConfiguration] = None
|
|
1283
|
+
model_metrics: Annotated[
|
|
1284
|
+
Optional[ModelMetrics], Field(None, alias="modelMetrics")
|
|
1285
|
+
] = None
|
|
1286
|
+
foreign_keys: Annotated[
|
|
1287
|
+
Optional[List[ForeignKey]],
|
|
1288
|
+
Field(None, alias="foreignKeys", description="The foreign keys of this table."),
|
|
1289
|
+
] = None
|
|
1290
|
+
total_rows: Annotated[
|
|
1291
|
+
Optional[int],
|
|
1292
|
+
Field(
|
|
1293
|
+
None,
|
|
1294
|
+
alias="totalRows",
|
|
1295
|
+
description="The total number of rows for that table in the generated synthetic dataset.\n",
|
|
1296
|
+
),
|
|
1297
|
+
] = None
|
|
1298
|
+
total_datapoints: Annotated[
|
|
1299
|
+
Optional[int],
|
|
1300
|
+
Field(
|
|
1301
|
+
None,
|
|
1302
|
+
alias="totalDatapoints",
|
|
1303
|
+
description="The total number of datapoints for that table in the generated synthetic dataset.\n",
|
|
1304
|
+
),
|
|
1305
|
+
] = None
|
|
1306
|
+
source_table_total_rows: Annotated[
|
|
1307
|
+
Optional[int],
|
|
1308
|
+
Field(
|
|
1309
|
+
None,
|
|
1310
|
+
alias="sourceTableTotalRows",
|
|
1311
|
+
description="The total number of rows in the source table while fetching data for training.\n",
|
|
1312
|
+
),
|
|
1313
|
+
] = None
|
|
1314
|
+
|
|
1315
|
+
|
|
1316
|
+
class AssistantThreadListItem(CustomBaseModel):
|
|
1317
|
+
id: Annotated[str, Field(description="The unique identifier of a assistant thread")]
|
|
1318
|
+
metadata: Metadata
|
|
1319
|
+
name: Annotated[
|
|
1320
|
+
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1321
|
+
] = None
|
|
1322
|
+
usage: Optional[AssistantThreadUsage] = None
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
class AssistantThread(CustomBaseModel):
|
|
1326
|
+
id: Annotated[
|
|
1327
|
+
Optional[str],
|
|
1328
|
+
Field(None, description="The unique identifier of a assistant thread"),
|
|
1329
|
+
] = None
|
|
1330
|
+
metadata: Optional[Metadata] = None
|
|
1331
|
+
name: Annotated[
|
|
1332
|
+
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1333
|
+
] = None
|
|
1334
|
+
session_status: Annotated[
|
|
1335
|
+
Optional[AssistantThreadSessionStatus], Field(None, alias="sessionStatus")
|
|
1336
|
+
] = None
|
|
1337
|
+
messages: Annotated[
|
|
1338
|
+
Optional[List[AssistantMessage]],
|
|
1339
|
+
Field(
|
|
1340
|
+
None,
|
|
1341
|
+
description="List of all existing messages, excluding any system message.\nExample:\n What's the square root of 9? role: user type: text\n ok, I will write some python role: assistant type: text\n r = math.sqrt(9)\\nr role: assistant type: python\n 3 role: tool type: console\n The answer is 3! role: assistant type: text\n Plot me a random barplot role: user type: text\n ... plt.savefig() ... role: assistant type: python\n Here is ![img]() ... role: assistant type: text\n Write me a random file role: user type: text\n ... .to_csv() ... role: assistant type: python\n Here is [file]() ... role: assistant type: text\n",
|
|
1342
|
+
),
|
|
1343
|
+
] = None
|
|
1344
|
+
usage: Optional[AssistantThreadUsage] = None
|
|
1345
|
+
|
|
1346
|
+
|
|
1347
|
+
class Share(User):
|
|
1348
|
+
permission_level: Annotated[
|
|
1349
|
+
Optional[PermissionLevel], Field(None, alias="permissionLevel")
|
|
1350
|
+
] = None
|
|
1351
|
+
|
|
1352
|
+
|
|
1353
|
+
class SourceTable(CustomBaseModel):
|
|
1354
|
+
id: Annotated[str, Field(description="The unique identifier of a source table")]
|
|
1355
|
+
source_connector: Annotated[
|
|
1356
|
+
Optional[BaseResource], Field(None, alias="sourceConnector")
|
|
1357
|
+
] = None
|
|
1358
|
+
location: Annotated[
|
|
1359
|
+
Optional[str],
|
|
1360
|
+
Field(
|
|
1361
|
+
None,
|
|
1362
|
+
description="The location of a source table. Together with the source connector it uniquely\nidentifies a source, and samples data from there.\n",
|
|
1363
|
+
),
|
|
1364
|
+
] = None
|
|
1365
|
+
name: Annotated[
|
|
1366
|
+
str,
|
|
1227
1367
|
Field(
|
|
1228
1368
|
description="The name of a source table. It must be unique within a generator."
|
|
1229
1369
|
),
|
|
@@ -1306,25 +1446,8 @@ class SourceTable(CustomBaseModel):
|
|
|
1306
1446
|
)
|
|
1307
1447
|
|
|
1308
1448
|
|
|
1309
|
-
class
|
|
1310
|
-
name: Annotated[Optional[str], Field(None, description="The name of the table")] = (
|
|
1311
|
-
None
|
|
1312
|
-
)
|
|
1313
|
-
rows: Optional[List[Dict[str, Any]]] = None
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
class ProgressStep(CustomBaseModel):
|
|
1449
|
+
class JobProgress(CustomBaseModel):
|
|
1317
1450
|
id: Optional[str] = None
|
|
1318
|
-
model_label: Annotated[
|
|
1319
|
-
Optional[str],
|
|
1320
|
-
Field(
|
|
1321
|
-
None,
|
|
1322
|
-
alias="modelLabel",
|
|
1323
|
-
description="The unique label for the model, consisting of table name and an optional suffix for text model.\nThis will be empty for steps that are not related to a model.\n",
|
|
1324
|
-
examples=[["census", "census:text"]],
|
|
1325
|
-
),
|
|
1326
|
-
] = None
|
|
1327
|
-
step_code: Annotated[Optional[StepCode], Field(None, alias="stepCode")] = None
|
|
1328
1451
|
start_date: Annotated[
|
|
1329
1452
|
Optional[AwareDatetime],
|
|
1330
1453
|
Field(
|
|
@@ -1343,9 +1466,9 @@ class ProgressStep(CustomBaseModel):
|
|
|
1343
1466
|
examples=["2024-01-25T12:34:56Z"],
|
|
1344
1467
|
),
|
|
1345
1468
|
] = None
|
|
1346
|
-
messages: Optional[List[Dict[str, Any]]] = None
|
|
1347
1469
|
progress: Optional[ProgressValue] = None
|
|
1348
1470
|
status: Optional[ProgressStatus] = None
|
|
1471
|
+
steps: Optional[List[ProgressStep]] = None
|
|
1349
1472
|
|
|
1350
1473
|
|
|
1351
1474
|
class SyntheticDataset(CustomBaseModel):
|
|
@@ -1493,43 +1616,6 @@ class SyntheticDataset(CustomBaseModel):
|
|
|
1493
1616
|
)
|
|
1494
1617
|
|
|
1495
1618
|
|
|
1496
|
-
class AssistantThreadListItem(CustomBaseModel):
|
|
1497
|
-
id: Annotated[str, Field(description="The unique identifier of a assistant thread")]
|
|
1498
|
-
metadata: Metadata
|
|
1499
|
-
name: Annotated[
|
|
1500
|
-
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1501
|
-
] = None
|
|
1502
|
-
usage: Optional[AssistantThreadUsage] = None
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
class AssistantThread(CustomBaseModel):
|
|
1506
|
-
id: Annotated[
|
|
1507
|
-
Optional[str],
|
|
1508
|
-
Field(None, description="The unique identifier of a assistant thread"),
|
|
1509
|
-
] = None
|
|
1510
|
-
metadata: Optional[Metadata] = None
|
|
1511
|
-
name: Annotated[
|
|
1512
|
-
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1513
|
-
] = None
|
|
1514
|
-
session_status: Annotated[
|
|
1515
|
-
Optional[AssistantThreadSessionStatus], Field(None, alias="sessionStatus")
|
|
1516
|
-
] = None
|
|
1517
|
-
messages: Annotated[
|
|
1518
|
-
Optional[List[AssistantMessage]],
|
|
1519
|
-
Field(
|
|
1520
|
-
None,
|
|
1521
|
-
description="List of all existing messages, excluding any system message.\nExample:\n What's the square root of 9? role: user type: text\n ok, I will write some python role: assistant type: text\n r = math.sqrt(9)\\nr role: assistant type: python\n 3 role: tool type: console\n The answer is 3! role: assistant type: text\n Plot me a random barplot role: user type: text\n ... plt.savefig() ... role: assistant type: python\n Here is ![img]() ... role: assistant type: text\n Write me a random file role: user type: text\n ... .to_csv() ... role: assistant type: python\n Here is [file]() ... role: assistant type: text\n",
|
|
1522
|
-
),
|
|
1523
|
-
] = None
|
|
1524
|
-
usage: Optional[AssistantThreadUsage] = None
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
class Share(User):
|
|
1528
|
-
permission_level: Annotated[
|
|
1529
|
-
Optional[PermissionLevel], Field(None, alias="permissionLevel")
|
|
1530
|
-
] = None
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
1619
|
class Generator(CustomBaseModel):
|
|
1534
1620
|
id: Annotated[str, Field(description="The unique identifier of a generator")]
|
|
1535
1621
|
name: Annotated[
|
|
@@ -1654,28 +1740,3 @@ class Generator(CustomBaseModel):
|
|
|
1654
1740
|
raise "Not implemented yet."
|
|
1655
1741
|
# return self.generator.client._list_synthetic_datasets(self.generator.id)
|
|
1656
1742
|
pass
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
class JobProgress(CustomBaseModel):
|
|
1660
|
-
id: Optional[str] = None
|
|
1661
|
-
start_date: Annotated[
|
|
1662
|
-
Optional[AwareDatetime],
|
|
1663
|
-
Field(
|
|
1664
|
-
None,
|
|
1665
|
-
alias="startDate",
|
|
1666
|
-
description="The UTC date and time when the job has started.\nIf the job has not started yet, then this is None.\n",
|
|
1667
|
-
examples=["2024-01-25T12:34:56Z"],
|
|
1668
|
-
),
|
|
1669
|
-
] = None
|
|
1670
|
-
end_date: Annotated[
|
|
1671
|
-
Optional[AwareDatetime],
|
|
1672
|
-
Field(
|
|
1673
|
-
None,
|
|
1674
|
-
alias="endDate",
|
|
1675
|
-
description="The UTC date and time when the job has ended.\nIf the job is still, then this is None.\n",
|
|
1676
|
-
examples=["2024-01-25T12:34:56Z"],
|
|
1677
|
-
),
|
|
1678
|
-
] = None
|
|
1679
|
-
progress: Optional[ProgressValue] = None
|
|
1680
|
-
status: Optional[ProgressStatus] = None
|
|
1681
|
-
steps: Optional[List[ProgressStep]] = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|