mostlyai 0.5.0__tar.gz → 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {mostlyai-0.5.0 → mostlyai-0.6.0}/PKG-INFO +21 -8
- {mostlyai-0.5.0 → mostlyai-0.6.0}/README.md +20 -7
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/_mostly_utils.py +1 -1
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/api.py +110 -10
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/connectors.py +19 -4
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/generators.py +59 -3
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/synthetic_datasets.py +49 -2
- {mostlyai-0.5.0 → mostlyai-0.6.0}/pyproject.toml +3 -3
- {mostlyai-0.5.0 → mostlyai-0.6.0}/LICENSE +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/__init__.py +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/__init__.py +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/_base_utils.py +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/_naming_conventions.py +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/base.py +0 -0
- /mostlyai-0.5.0/mostlyai/client/model.py → /mostlyai-0.6.0/mostlyai/client/domain.py +0 -0
- {mostlyai-0.5.0 → mostlyai-0.6.0}/mostlyai/client/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: MOSTLY AI - Python Client
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -46,12 +46,12 @@ The client allows you to programmatically create, browse and manage the 3 key re
|
|
|
46
46
|
3. **Connectors** - Connect to any data source within your organization, for reading and writing data
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
| Intent | Primitive |
|
|
50
|
-
|
|
51
|
-
| Train a Generator on tabular or language data | `g = mostly.train(config)` |
|
|
52
|
-
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` |
|
|
53
|
-
| Live probe the generator on demand | `df = mostly.probe(g, config)` |
|
|
54
|
-
| Connect to any data source within your org | `c = mostly.connect(config)` |
|
|
49
|
+
| Intent | Primitive | Documentation |
|
|
50
|
+
|-----------------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------|
|
|
51
|
+
| Train a Generator on tabular or language data | `g = mostly.train(config)` | see [mostly.train](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.train) |
|
|
52
|
+
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.generate) |
|
|
53
|
+
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
54
|
+
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
55
55
|
|
|
56
56
|
See also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
57
57
|
|
|
@@ -91,7 +91,7 @@ sd = mostly.generate(g, size=10_000)
|
|
|
91
91
|
df_synthetic = sd.data()
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
## Further
|
|
94
|
+
## Further Resources
|
|
95
95
|
|
|
96
96
|
* [MOSTLY AI Website](https://mostly.ai/)
|
|
97
97
|
* [MOSTLY AI Blog](https://mostly.ai/blog)
|
|
@@ -100,3 +100,16 @@ df_synthetic = sd.data()
|
|
|
100
100
|
* [MOSTLY AI @ GitHub](https://github.com/mostly-ai/)
|
|
101
101
|
* [Synthetic Data - Quality Assurance](https://github.com/mostly-ai/mostlyai-qa/) `mostlyai-qa`
|
|
102
102
|
|
|
103
|
+
## Citation
|
|
104
|
+
|
|
105
|
+
Please consider citing our project if you find it useful:
|
|
106
|
+
|
|
107
|
+
```bibtex
|
|
108
|
+
@software{mostlyai-client,
|
|
109
|
+
author = {{MOSTLY AI}},
|
|
110
|
+
title = {{MOSTLY AI - Python Client}},
|
|
111
|
+
url = {https://github.com/mostly-ai/mostlyai-client},
|
|
112
|
+
year = {2024}
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
@@ -11,12 +11,12 @@ The client allows you to programmatically create, browse and manage the 3 key re
|
|
|
11
11
|
3. **Connectors** - Connect to any data source within your organization, for reading and writing data
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
| Intent | Primitive |
|
|
15
|
-
|
|
16
|
-
| Train a Generator on tabular or language data | `g = mostly.train(config)` |
|
|
17
|
-
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` |
|
|
18
|
-
| Live probe the generator on demand | `df = mostly.probe(g, config)` |
|
|
19
|
-
| Connect to any data source within your org | `c = mostly.connect(config)` |
|
|
14
|
+
| Intent | Primitive | Documentation |
|
|
15
|
+
|-----------------------------------------------|-----------------------------------|----------------------------------------------------------------------------------------------------------------------|
|
|
16
|
+
| Train a Generator on tabular or language data | `g = mostly.train(config)` | see [mostly.train](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.train) |
|
|
17
|
+
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.generate) |
|
|
18
|
+
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
19
|
+
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai-client/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
20
20
|
|
|
21
21
|
See also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ sd = mostly.generate(g, size=10_000)
|
|
|
56
56
|
df_synthetic = sd.data()
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
## Further
|
|
59
|
+
## Further Resources
|
|
60
60
|
|
|
61
61
|
* [MOSTLY AI Website](https://mostly.ai/)
|
|
62
62
|
* [MOSTLY AI Blog](https://mostly.ai/blog)
|
|
@@ -64,3 +64,16 @@ df_synthetic = sd.data()
|
|
|
64
64
|
* [OpenAPI Documentation](https://api-docs.mostly.ai/)
|
|
65
65
|
* [MOSTLY AI @ GitHub](https://github.com/mostly-ai/)
|
|
66
66
|
* [Synthetic Data - Quality Assurance](https://github.com/mostly-ai/mostlyai-qa/) `mostlyai-qa`
|
|
67
|
+
|
|
68
|
+
## Citation
|
|
69
|
+
|
|
70
|
+
Please consider citing our project if you find it useful:
|
|
71
|
+
|
|
72
|
+
```bibtex
|
|
73
|
+
@software{mostlyai-client,
|
|
74
|
+
author = {{MOSTLY AI}},
|
|
75
|
+
title = {{MOSTLY AI - Python Client}},
|
|
76
|
+
url = {https://github.com/mostly-ai/mostlyai-client},
|
|
77
|
+
year = {2024}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
@@ -14,7 +14,7 @@ from rich.progress import (
|
|
|
14
14
|
from rich.style import Style
|
|
15
15
|
|
|
16
16
|
from mostlyai.client._base_utils import convert_to_base64, read_table_from_path
|
|
17
|
-
from mostlyai.client.
|
|
17
|
+
from mostlyai.client.domain import (
|
|
18
18
|
StepCode,
|
|
19
19
|
ProgressStatus,
|
|
20
20
|
Generator,
|
|
@@ -7,7 +7,7 @@ import rich
|
|
|
7
7
|
from mostlyai.client.base import GET, _MostlyBaseClient
|
|
8
8
|
from mostlyai.client.connectors import _MostlyConnectorsClient
|
|
9
9
|
from mostlyai.client.generators import _MostlyGeneratorsClient
|
|
10
|
-
from mostlyai.client.
|
|
10
|
+
from mostlyai.client.domain import (
|
|
11
11
|
Connector,
|
|
12
12
|
CurrentUser,
|
|
13
13
|
Generator,
|
|
@@ -34,7 +34,29 @@ from mostlyai.client._mostly_utils import (
|
|
|
34
34
|
|
|
35
35
|
class MostlyAI(_MostlyBaseClient):
|
|
36
36
|
"""
|
|
37
|
-
|
|
37
|
+
Instantiate a client for interacting with the MOSTLY AI platform via its [Public API](https://github.com/mostly-ai/mostly-openapi/blob/main/public-api.yaml).
|
|
38
|
+
|
|
39
|
+
Example for instantiating the client with explicit arguments:
|
|
40
|
+
```python
|
|
41
|
+
from mostlyai import MostlyAI
|
|
42
|
+
mostly = MostlyAI(
|
|
43
|
+
api_key='INSERT_YOUR_API_KEY',
|
|
44
|
+
base_url='https://app.mostly.ai',
|
|
45
|
+
)
|
|
46
|
+
mostly
|
|
47
|
+
# MostlyAI(base_url='https://app.mostly.ai', api_key='***')
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Example for instantiating the client with environment variables:
|
|
51
|
+
```python
|
|
52
|
+
import os
|
|
53
|
+
from mostlyai import MostlyAI
|
|
54
|
+
os.environ["MOSTLYAI_API_KEY"] = "INSERT_YOUR_API_KEY"
|
|
55
|
+
os.environ["MOSTLYAI_BASE_URL"] = "https://app.mostly.ai"
|
|
56
|
+
mostly = MostlyAI()
|
|
57
|
+
mostly
|
|
58
|
+
# MostlyAI(base_url='https://app.mostly.ai', api_key='***')
|
|
59
|
+
```
|
|
38
60
|
|
|
39
61
|
Args:
|
|
40
62
|
base_url: The base URL. If not provided, a default value is used.
|
|
@@ -64,13 +86,17 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
64
86
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
65
87
|
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
66
88
|
|
|
89
|
+
def __repr__(self) -> str:
|
|
90
|
+
api_key = "'***'" if self.api_key else "None"
|
|
91
|
+
return f"MostlyAI(base_url='{self.base_url}', api_key={api_key})"
|
|
92
|
+
|
|
67
93
|
def connect(self, config: Union[ConnectorConfig, dict[str, Any]]) -> Connector:
|
|
68
94
|
"""
|
|
69
95
|
Create a connector and optionally validate the connection before saving.
|
|
70
96
|
|
|
71
|
-
See [ConnectorConfig](
|
|
97
|
+
See [ConnectorConfig](api_domain.md#mostlyai.client.domain.ConnectorConfig) for more information on the available configuration parameters.
|
|
72
98
|
|
|
73
|
-
Example:
|
|
99
|
+
Example for creating a connector to a AWS S3 storage:
|
|
74
100
|
```python
|
|
75
101
|
from mostlyai import MostlyAI
|
|
76
102
|
mostly = MostlyAI()
|
|
@@ -228,7 +254,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
228
254
|
"""
|
|
229
255
|
Train a generator.
|
|
230
256
|
|
|
231
|
-
See [GeneratorConfig](
|
|
257
|
+
See [GeneratorConfig](api_domain.md#mostlyai.client.domain.GeneratorConfig) for more information on the available configuration parameters.
|
|
232
258
|
|
|
233
259
|
Example configuration using short-hand notation:
|
|
234
260
|
```python
|
|
@@ -339,7 +365,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
339
365
|
"""
|
|
340
366
|
Generate synthetic data.
|
|
341
367
|
|
|
342
|
-
See [SyntheticDatasetConfig](
|
|
368
|
+
See [SyntheticDatasetConfig](api_domain.md#mostlyai.client.domain.SyntheticDatasetConfig) for more information on the available configuration parameters.
|
|
343
369
|
|
|
344
370
|
Example configuration using short-hand notation:
|
|
345
371
|
```python
|
|
@@ -441,11 +467,37 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
441
467
|
"""
|
|
442
468
|
Probe a generator.
|
|
443
469
|
|
|
444
|
-
|
|
470
|
+
See [SyntheticProbeConfig](api_domain.md#mostlyai.client.domain.SyntheticProbeConfig) for more information on the available configuration parameters.
|
|
471
|
+
|
|
472
|
+
Example for probing a generator for 10 synthetic samples:
|
|
473
|
+
```python
|
|
474
|
+
from mostlyai import MostlyAI
|
|
475
|
+
mostly = MostlyAI()
|
|
476
|
+
probe = mostly.probe(
|
|
477
|
+
generator='INSERT_YOUR_GENERATOR_ID',
|
|
478
|
+
size=10
|
|
479
|
+
)
|
|
480
|
+
```
|
|
481
|
+
|
|
482
|
+
Example for conditional probing a generator for 10 synthetic samples:
|
|
445
483
|
```python
|
|
484
|
+
import pandas as pd
|
|
446
485
|
from mostlyai import MostlyAI
|
|
447
486
|
mostly = MostlyAI()
|
|
448
|
-
|
|
487
|
+
g = mostly.generators.get('INSERT_YOUR_GENERATOR_ID')
|
|
488
|
+
print('columns:', [c.name for c in g.tables[0].columns])
|
|
489
|
+
# columns: ['age', 'workclass', 'fnlwgt', ...]
|
|
490
|
+
col = g.tables[0].columns[1]
|
|
491
|
+
print(col.name, col.value_range.values)
|
|
492
|
+
# workclass: ['Federal-gov', 'Local-gov', 'Never-worked', ...]
|
|
493
|
+
mostly.probe(
|
|
494
|
+
generator=g,
|
|
495
|
+
seed=pd.DataFrame({
|
|
496
|
+
'age': [63, 45],
|
|
497
|
+
'sex': ['Female', 'Male'],
|
|
498
|
+
'workclass': ['Sales', 'Tech-support'],
|
|
499
|
+
}),
|
|
500
|
+
)
|
|
449
501
|
```
|
|
450
502
|
|
|
451
503
|
Args:
|
|
@@ -476,6 +528,14 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
476
528
|
"""
|
|
477
529
|
Retrieve information about the current user.
|
|
478
530
|
|
|
531
|
+
Example for retrieving information about the current user:
|
|
532
|
+
```python
|
|
533
|
+
from mostlyai import MostlyAI
|
|
534
|
+
mostly = MostlyAI()
|
|
535
|
+
mostly.me()
|
|
536
|
+
# {'id': '488f2f26-...', 'first_name': 'Tom', ...}
|
|
537
|
+
```
|
|
538
|
+
|
|
479
539
|
Returns:
|
|
480
540
|
CurrentUser: Information about the current user.
|
|
481
541
|
"""
|
|
@@ -483,8 +543,15 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
483
543
|
|
|
484
544
|
def about(self) -> dict[str, Any]:
|
|
485
545
|
"""
|
|
486
|
-
Retrieve platform
|
|
487
|
-
|
|
546
|
+
Retrieve information about the platform.
|
|
547
|
+
|
|
548
|
+
Example for retrieving information about the platform:
|
|
549
|
+
```python
|
|
550
|
+
from mostlyai import MostlyAI
|
|
551
|
+
mostly = MostlyAI()
|
|
552
|
+
mostly.about()
|
|
553
|
+
# {'version': 'v316', 'assistant': True}
|
|
554
|
+
```
|
|
488
555
|
|
|
489
556
|
Returns:
|
|
490
557
|
dict[str, Any]: Information about the platform.
|
|
@@ -492,9 +559,42 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
492
559
|
return self.request(verb=GET, path=["about"])
|
|
493
560
|
|
|
494
561
|
def models(self, model_type: Union[str, ModelType]) -> list[str]:
|
|
562
|
+
"""
|
|
563
|
+
Retrieve a list of available models of a specific type.
|
|
564
|
+
|
|
565
|
+
Example for retrieving available models:
|
|
566
|
+
```python
|
|
567
|
+
from mostlyai import MostlyAI
|
|
568
|
+
mostly = MostlyAI()
|
|
569
|
+
mostly.models("LANGUAGE")
|
|
570
|
+
# ['MOSTLY_AI/LSTMFromScratch-3m', 'microsoft/phi-1_5', ..]
|
|
571
|
+
mostly.models("TABULAR")
|
|
572
|
+
# ['MOSTLY_AI/Small', 'MOSTLY_AI/Medium', 'MOSTLY_AI/Large']
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Args:
|
|
576
|
+
model_type: The type of model to retrieve. Can be a string or a ModelType enum.
|
|
577
|
+
|
|
578
|
+
Returns:
|
|
579
|
+
A list of available models of the specified type.
|
|
580
|
+
"""
|
|
495
581
|
if isinstance(model_type, ModelType):
|
|
496
582
|
model_type = model_type.value
|
|
497
583
|
return self.request(verb=GET, path=["models", model_type])
|
|
498
584
|
|
|
499
585
|
def computes(self) -> list[dict[str, Any]]:
|
|
586
|
+
"""
|
|
587
|
+
Retrieve a list of available compute resources, that can be used for executing tasks.
|
|
588
|
+
|
|
589
|
+
Example for retrieving available compute resources:
|
|
590
|
+
```python
|
|
591
|
+
from mostlyai import MostlyAI
|
|
592
|
+
mostly = MostlyAI()
|
|
593
|
+
mostly.computes()
|
|
594
|
+
# [{'id': '...', 'name': 'CPU Large',...]
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
Returns:
|
|
598
|
+
A list of available compute resources.
|
|
599
|
+
"""
|
|
500
600
|
return self.request(verb=GET, path=["computes"])
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
from typing import Any, Iterator, Optional, List, Dict, Union
|
|
2
2
|
|
|
3
3
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
4
|
-
from mostlyai.client.
|
|
4
|
+
from mostlyai.client.domain import (
|
|
5
5
|
Connector,
|
|
6
6
|
ConnectorListItem,
|
|
7
|
-
SyntheticDatasetConfig,
|
|
8
7
|
ConnectorPatchConfig,
|
|
9
8
|
ConnectorConfig,
|
|
10
9
|
)
|
|
@@ -27,6 +26,14 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
27
26
|
|
|
28
27
|
Paginate through all connectors accessible by the user. Only connectors that are independent of a table will be returned.
|
|
29
28
|
|
|
29
|
+
Example for listing all connectors:
|
|
30
|
+
```python
|
|
31
|
+
from mostlyai import MostlyAI
|
|
32
|
+
mostly = MostlyAI()
|
|
33
|
+
for c in mostly.connectors.list():
|
|
34
|
+
print(f"Connector `{c.name}` ({c.access_type}, {c.type}, {c.id})")
|
|
35
|
+
```
|
|
36
|
+
|
|
30
37
|
Args:
|
|
31
38
|
offset: Offset for entities in the response.
|
|
32
39
|
limit: Limit for the number of entities in the response.
|
|
@@ -51,6 +58,14 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
51
58
|
"""
|
|
52
59
|
Retrieve a connector by its ID.
|
|
53
60
|
|
|
61
|
+
Example for retrieving a connector:
|
|
62
|
+
```python
|
|
63
|
+
from mostlyai import MostlyAI
|
|
64
|
+
mostly = MostlyAI()
|
|
65
|
+
c = mostly.connectors.get('INSERT_YOUR_CONNECTOR_ID')
|
|
66
|
+
c
|
|
67
|
+
```
|
|
68
|
+
|
|
54
69
|
Args:
|
|
55
70
|
connector_id: The unique identifier of the connector.
|
|
56
71
|
|
|
@@ -62,12 +77,12 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
62
77
|
|
|
63
78
|
def create(
|
|
64
79
|
self,
|
|
65
|
-
config: Union[
|
|
80
|
+
config: Union[ConnectorConfig, dict[str, Any]],
|
|
66
81
|
) -> Connector:
|
|
67
82
|
"""
|
|
68
83
|
Create a connector and optionally validate the connection before saving.
|
|
69
84
|
|
|
70
|
-
See `mostly.connect` for more details.
|
|
85
|
+
See [`mostly.connect`](api_client.md#mostlyai.client.api.MostlyAI.connect) for more details.
|
|
71
86
|
|
|
72
87
|
Args:
|
|
73
88
|
config: Configuration for the connector.
|
|
@@ -5,7 +5,7 @@ import re
|
|
|
5
5
|
import pandas as pd
|
|
6
6
|
|
|
7
7
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
8
|
-
from mostlyai.client.
|
|
8
|
+
from mostlyai.client.domain import (
|
|
9
9
|
Generator,
|
|
10
10
|
JobProgress,
|
|
11
11
|
GeneratorListItem,
|
|
@@ -35,6 +35,22 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
35
35
|
|
|
36
36
|
Paginate through all generators accessible by the user.
|
|
37
37
|
|
|
38
|
+
Example for listing all generators:
|
|
39
|
+
```python
|
|
40
|
+
from mostlyai import MostlyAI
|
|
41
|
+
mostly = MostlyAI()
|
|
42
|
+
for g in mostly.generators.list():
|
|
43
|
+
print(f"Generator `{g.name}` ({g.training_status}, {g.id})")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Example for searching trained generators via key word:
|
|
47
|
+
```python
|
|
48
|
+
from mostlyai import MostlyAI
|
|
49
|
+
mostly = MostlyAI()
|
|
50
|
+
generators = list(mostly.generators.list(search_term="census", status="DONE"))
|
|
51
|
+
print(f"Found {len(generators)} generators")
|
|
52
|
+
```
|
|
53
|
+
|
|
38
54
|
Args:
|
|
39
55
|
offset: Offset for the entities in the response.
|
|
40
56
|
limit: Limit for the number of entities in the response.
|
|
@@ -63,6 +79,14 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
63
79
|
Args:
|
|
64
80
|
generator_id: The unique identifier of the generator.
|
|
65
81
|
|
|
82
|
+
Example for retrieving a generator:
|
|
83
|
+
```python
|
|
84
|
+
from mostlyai import MostlyAI
|
|
85
|
+
mostly = MostlyAI()
|
|
86
|
+
g = mostly.generators.get('INSERT_YOUR_GENERATOR_ID')
|
|
87
|
+
g
|
|
88
|
+
```
|
|
89
|
+
|
|
66
90
|
Returns:
|
|
67
91
|
Generator: The retrieved generator object.
|
|
68
92
|
"""
|
|
@@ -71,7 +95,32 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
71
95
|
|
|
72
96
|
def create(self, config: Union[GeneratorConfig, dict]) -> Generator:
|
|
73
97
|
"""
|
|
74
|
-
Create a generator.
|
|
98
|
+
Create a generator. The generator will be in the NEW state and will need to be trained before it can be used.
|
|
99
|
+
|
|
100
|
+
See [`mostly.train`](api_client.md#mostlyai.client.api.MostlyAI.train) for more details.
|
|
101
|
+
|
|
102
|
+
Example for creating a generator:
|
|
103
|
+
```python
|
|
104
|
+
from mostlyai import MostlyAI
|
|
105
|
+
mostly = MostlyAI()
|
|
106
|
+
g = mostly.generators.create(
|
|
107
|
+
config=GeneratorConfig(
|
|
108
|
+
name="US Census",
|
|
109
|
+
tables=[{
|
|
110
|
+
"name": "census",
|
|
111
|
+
"data": original_df,
|
|
112
|
+
}]
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
print("status:", g.training_status)
|
|
116
|
+
# status: NEW
|
|
117
|
+
g.training.start() # start training
|
|
118
|
+
print("status:", g.training_status)
|
|
119
|
+
# status: QUEUED
|
|
120
|
+
g.training.wait() # wait for training to complete
|
|
121
|
+
print("status:", g.training_status)
|
|
122
|
+
# status: DONE
|
|
123
|
+
```
|
|
75
124
|
|
|
76
125
|
Args:
|
|
77
126
|
config: Configuration for the generator.
|
|
@@ -110,7 +159,14 @@ class _MostlyGeneratorsClient(_MostlyBaseClient):
|
|
|
110
159
|
) -> Generator:
|
|
111
160
|
"""
|
|
112
161
|
Import a generator from a file.
|
|
113
|
-
|
|
162
|
+
|
|
163
|
+
Example for importing a generator from a file:
|
|
164
|
+
```python
|
|
165
|
+
from mostlyai import MostlyAI
|
|
166
|
+
mostly = MostlyAI()
|
|
167
|
+
g = mostly.generators.import_from_file('path/to/generator')
|
|
168
|
+
g
|
|
169
|
+
```
|
|
114
170
|
|
|
115
171
|
Args:
|
|
116
172
|
file_path: Path to the file to import.
|
|
@@ -6,7 +6,7 @@ from typing import Any, Iterator, Optional, Union
|
|
|
6
6
|
import pandas as pd
|
|
7
7
|
|
|
8
8
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
9
|
-
from mostlyai.client.
|
|
9
|
+
from mostlyai.client.domain import (
|
|
10
10
|
JobProgress,
|
|
11
11
|
SyntheticDataset,
|
|
12
12
|
SyntheticDatasetFormat,
|
|
@@ -35,6 +35,22 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
35
35
|
|
|
36
36
|
Paginate through all synthetic datasets accessible by the user.
|
|
37
37
|
|
|
38
|
+
Example for listing all synthetic datasets:
|
|
39
|
+
```python
|
|
40
|
+
from mostlyai import MostlyAI
|
|
41
|
+
mostly = MostlyAI()
|
|
42
|
+
for sd in mostly.synthetic_datasets.list():
|
|
43
|
+
print(f"Synthetic Dataset `{sd.name}` ({sd.generation_status}, {sd.id})")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Example for searching generated synthetic datasets via key word:
|
|
47
|
+
```python
|
|
48
|
+
from mostlyai import MostlyAI
|
|
49
|
+
mostly = MostlyAI()
|
|
50
|
+
datasets = list(mostly.synthetic_datasets.list(search_term="census", status="DONE"))
|
|
51
|
+
print(f"Found {len(datasets)} synthetic datasets")
|
|
52
|
+
```
|
|
53
|
+
|
|
38
54
|
Args:
|
|
39
55
|
offset: Offset for the entities in the response.
|
|
40
56
|
limit: Limit for the number of entities in the response.
|
|
@@ -60,6 +76,14 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
60
76
|
"""
|
|
61
77
|
Retrieve a synthetic dataset by its ID.
|
|
62
78
|
|
|
79
|
+
Example for retrieving a synthetic dataset:
|
|
80
|
+
```python
|
|
81
|
+
from mostlyai import MostlyAI
|
|
82
|
+
mostly = MostlyAI()
|
|
83
|
+
sd = mostly.synthetic_datasets.get('INSERT_YOUR_SYNTHETIC_DATASET_ID')
|
|
84
|
+
sd
|
|
85
|
+
```
|
|
86
|
+
|
|
63
87
|
Args:
|
|
64
88
|
synthetic_dataset_id: The unique identifier of the synthetic dataset.
|
|
65
89
|
|
|
@@ -75,7 +99,28 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
75
99
|
self, config: Union[SyntheticDatasetConfig, dict[str, Any]]
|
|
76
100
|
) -> SyntheticDataset:
|
|
77
101
|
"""
|
|
78
|
-
Create a synthetic dataset.
|
|
102
|
+
Create a synthetic dataset. The synthetic dataset will be in the NEW state and will need to be generated before it can be used.
|
|
103
|
+
|
|
104
|
+
See [`mostly.generate`](api_client.md#mostlyai.client.api.MostlyAI.generate) for more details.
|
|
105
|
+
|
|
106
|
+
Example for creating a synthetic dataset:
|
|
107
|
+
```python
|
|
108
|
+
from mostlyai import MostlyAI
|
|
109
|
+
mostly = MostlyAI()
|
|
110
|
+
sd = mostly.synthetic_datasets.create(
|
|
111
|
+
config=SyntheticDatasetConfig(
|
|
112
|
+
generator_id="INSERT_YOUR_GENERATOR_ID",
|
|
113
|
+
)
|
|
114
|
+
)
|
|
115
|
+
print("status:", sd.generation_status)
|
|
116
|
+
# status: NEW
|
|
117
|
+
sd.generation.start() # start generation
|
|
118
|
+
print("status:", sd.generation_status)
|
|
119
|
+
# status: QUEUED
|
|
120
|
+
sd.generation.wait() # wait for generation to complete
|
|
121
|
+
print("status:", sd.generation_status)
|
|
122
|
+
# status: DONE
|
|
123
|
+
```
|
|
79
124
|
|
|
80
125
|
Args:
|
|
81
126
|
config: Configuration for the synthetic dataset.
|
|
@@ -208,6 +253,8 @@ class _MostlySyntheticProbesClient(_MostlyBaseClient):
|
|
|
208
253
|
"""
|
|
209
254
|
Create a synthetic probe.
|
|
210
255
|
|
|
256
|
+
See [`mostly.probe`](api_client.md#mostlyai.client.api.MostlyAI.probe) for more details.
|
|
257
|
+
|
|
211
258
|
Args:
|
|
212
259
|
config: Configuration for the synthetic probe.
|
|
213
260
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "mostlyai"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "MOSTLY AI - Python Client"
|
|
5
5
|
homepage = "https://app.mostly.ai/"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -46,7 +46,8 @@ ruff = "0.4.4"
|
|
|
46
46
|
respx = "^0.20.2"
|
|
47
47
|
twine = "^5.0.0"
|
|
48
48
|
poetry-bumpversion = "^0.3.2"
|
|
49
|
-
|
|
49
|
+
|
|
50
|
+
[tool.poetry.group.docs.dependencies]
|
|
50
51
|
mkdocs = ">=1.5.3"
|
|
51
52
|
mkdocstrings = { version = "^0.27.0", extras = ["crystal", "python"] }
|
|
52
53
|
mkdocs-material = "^9.0.0"
|
|
@@ -54,7 +55,6 @@ griffe = "^1.0.0"
|
|
|
54
55
|
pymdown-extensions = "^10.0.0"
|
|
55
56
|
griffe-fieldz = "^0.2.0"
|
|
56
57
|
|
|
57
|
-
|
|
58
58
|
[[tool.poetry_bumpversion.replacements]]
|
|
59
59
|
files = ["mostlyai/__init__.py"]
|
|
60
60
|
search = '__version__ = "{current_version}"'
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|