mostlyai 0.6.1__tar.gz → 0.7.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.6.1 → mostlyai-0.7.0}/PKG-INFO +18 -18
- {mostlyai-0.6.1 → mostlyai-0.7.0}/README.md +15 -15
- mostlyai-0.7.0/mostlyai/__init__.py +18 -0
- mostlyai-0.7.0/mostlyai/client/__init__.py +14 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/_base_utils.py +14 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/_mostly_utils.py +15 -1
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/_naming_conventions.py +14 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/api.py +39 -11
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/base.py +18 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/connectors.py +22 -2
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/exceptions.py +14 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/generators.py +15 -1
- {mostlyai-0.6.1 → mostlyai-0.7.0}/mostlyai/client/synthetic_datasets.py +15 -1
- {mostlyai-0.6.1/mostlyai/client → mostlyai-0.7.0/mostlyai}/domain.py +966 -528
- {mostlyai-0.6.1 → mostlyai-0.7.0}/pyproject.toml +3 -3
- mostlyai-0.6.1/mostlyai/__init__.py +0 -4
- mostlyai-0.6.1/mostlyai/client/__init__.py +0 -0
- {mostlyai-0.6.1 → mostlyai-0.7.0}/LICENSE +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: mostlyai
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.7.0
|
|
4
4
|
Summary: MOSTLY AI - Python Client
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -29,31 +29,31 @@ Requires-Dist: pandas (>=1.5.3,<3.0.0)
|
|
|
29
29
|
Requires-Dist: pyarrow (>=14.0.0)
|
|
30
30
|
Requires-Dist: pydantic (>=2.4.2,<3.0.0)
|
|
31
31
|
Requires-Dist: rich (>=13.7.0)
|
|
32
|
-
Project-URL: Documentation, https://mostly-ai.github.io/mostlyai
|
|
33
|
-
Project-URL: Source, https://github.com/mostly-ai/mostlyai
|
|
32
|
+
Project-URL: Documentation, https://mostly-ai.github.io/mostlyai/
|
|
33
|
+
Project-URL: Source, https://github.com/mostly-ai/mostlyai
|
|
34
34
|
Description-Content-Type: text/markdown
|
|
35
35
|
|
|
36
|
-
# MOSTLY AI -
|
|
36
|
+
# MOSTLY AI - SDK 🚀
|
|
37
37
|
|
|
38
|
-
[](https://mostly-ai.github.io/mostlyai
|
|
38
|
+
[](https://mostly-ai.github.io/mostlyai/) [](https://pypi.org/project/mostlyai/)   
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
[Package Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/api_client/)
|
|
41
41
|
|
|
42
|
-
The
|
|
42
|
+
The official Python SDK for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity privacy-safe **Synthetic Data**.
|
|
43
|
+
|
|
44
|
+
This toolkit allows you to programmatically create, browse and manage the 3 key resources of the MOSTLY AI platform:
|
|
43
45
|
|
|
44
46
|
1. **Generators** - Train a synthetic data generator on your existing tabular or language data assets
|
|
45
47
|
2. **Synthetic Datasets** - Use a generator to create any number of synthetic samples to your needs
|
|
46
48
|
3. **Connectors** - Connect to any data source within your organization, for reading and writing data
|
|
47
49
|
|
|
48
50
|
|
|
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
|
|
52
|
-
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai
|
|
53
|
-
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai
|
|
54
|
-
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai
|
|
55
|
-
|
|
56
|
-
See our [Package Documentation](https://mostly-ai.github.io/mostlyai-client/) as well also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
51
|
+
| Intent | Primitive | Documentation |
|
|
52
|
+
|-----------------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------------------------|
|
|
53
|
+
| Train a Generator on tabular or language data | `g = mostly.train(config)` | see [mostly.train](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.train) |
|
|
54
|
+
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.generate) |
|
|
55
|
+
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
56
|
+
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
57
57
|
|
|
58
58
|
## Installation
|
|
59
59
|
|
|
@@ -105,10 +105,10 @@ df_synthetic = sd.data()
|
|
|
105
105
|
Please consider citing our project if you find it useful:
|
|
106
106
|
|
|
107
107
|
```bibtex
|
|
108
|
-
@software{mostlyai
|
|
108
|
+
@software{mostlyai,
|
|
109
109
|
author = {{MOSTLY AI}},
|
|
110
|
-
title = {{MOSTLY AI
|
|
111
|
-
url = {https://github.com/mostly-ai/mostlyai
|
|
110
|
+
title = {{MOSTLY AI SDK}},
|
|
111
|
+
url = {https://github.com/mostly-ai/mostlyai},
|
|
112
112
|
year = {2024}
|
|
113
113
|
}
|
|
114
114
|
```
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# MOSTLY AI -
|
|
1
|
+
# MOSTLY AI - SDK 🚀
|
|
2
2
|
|
|
3
|
-
[](https://mostly-ai.github.io/mostlyai
|
|
3
|
+
[](https://mostly-ai.github.io/mostlyai/) [](https://pypi.org/project/mostlyai/)   
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
[Package Documentation](https://mostly-ai.github.io/mostlyai/) | [Platform Documentation](https://mostly.ai/docs) | [Usage Examples](https://mostly-ai.github.io/mostlyai/api_client/)
|
|
6
6
|
|
|
7
|
-
The
|
|
7
|
+
The official Python SDK for [MOSTLY AI](https://app.mostly.ai/), the #1 platform for high-fidelity privacy-safe **Synthetic Data**.
|
|
8
|
+
|
|
9
|
+
This toolkit allows you to programmatically create, browse and manage the 3 key resources of the MOSTLY AI platform:
|
|
8
10
|
|
|
9
11
|
1. **Generators** - Train a synthetic data generator on your existing tabular or language data assets
|
|
10
12
|
2. **Synthetic Datasets** - Use a generator to create any number of synthetic samples to your needs
|
|
11
13
|
3. **Connectors** - Connect to any data source within your organization, for reading and writing data
|
|
12
14
|
|
|
13
15
|
|
|
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
|
|
17
|
-
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai
|
|
18
|
-
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai
|
|
19
|
-
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai
|
|
20
|
-
|
|
21
|
-
See our [Package Documentation](https://mostly-ai.github.io/mostlyai-client/) as well also our [Platform Documentation](https://mostly.ai/docs) for detailed feature descriptions and further Python examples.
|
|
16
|
+
| Intent | Primitive | Documentation |
|
|
17
|
+
|-----------------------------------------------|-----------------------------------|---------------------------------------------------------------------------------------------------------------|
|
|
18
|
+
| Train a Generator on tabular or language data | `g = mostly.train(config)` | see [mostly.train](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.train) |
|
|
19
|
+
| Generate any number of synthetic data records | `sd = mostly.generate(g, config)` | see [mostly.generate](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.generate) |
|
|
20
|
+
| Live probe the generator on demand | `df = mostly.probe(g, config)` | see [mostly.probe](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.probe) |
|
|
21
|
+
| Connect to any data source within your org | `c = mostly.connect(config)` | see [mostly.connect](https://mostly-ai.github.io/mostlyai/api_client/#mostlyai.client.api.MostlyAI.connect) |
|
|
22
22
|
|
|
23
23
|
## Installation
|
|
24
24
|
|
|
@@ -70,10 +70,10 @@ df_synthetic = sd.data()
|
|
|
70
70
|
Please consider citing our project if you find it useful:
|
|
71
71
|
|
|
72
72
|
```bibtex
|
|
73
|
-
@software{mostlyai
|
|
73
|
+
@software{mostlyai,
|
|
74
74
|
author = {{MOSTLY AI}},
|
|
75
|
-
title = {{MOSTLY AI
|
|
76
|
-
url = {https://github.com/mostly-ai/mostlyai
|
|
75
|
+
title = {{MOSTLY AI SDK}},
|
|
76
|
+
url = {https://github.com/mostly-ai/mostlyai},
|
|
77
77
|
year = {2024}
|
|
78
78
|
}
|
|
79
79
|
```
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Copyright 2024 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 mostlyai.client.api import MostlyAI
|
|
16
|
+
|
|
17
|
+
__all__ = ["MostlyAI"]
|
|
18
|
+
__version__ = "0.7.0" # Do not set this manually. Use poetry version [params].
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
import base64
|
|
2
16
|
import io
|
|
3
17
|
import warnings
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
import time
|
|
2
16
|
from pathlib import Path
|
|
3
17
|
from typing import Callable, Union, Any, Optional
|
|
@@ -14,7 +28,7 @@ from rich.progress import (
|
|
|
14
28
|
from rich.style import Style
|
|
15
29
|
|
|
16
30
|
from mostlyai.client._base_utils import convert_to_base64, read_table_from_path
|
|
17
|
-
from mostlyai.
|
|
31
|
+
from mostlyai.domain import (
|
|
18
32
|
StepCode,
|
|
19
33
|
ProgressStatus,
|
|
20
34
|
Generator,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
import re
|
|
2
16
|
from typing import Callable
|
|
3
17
|
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
from pathlib import Path
|
|
2
16
|
from typing import Any, Optional, Union, Literal
|
|
3
17
|
|
|
@@ -7,7 +21,7 @@ import rich
|
|
|
7
21
|
from mostlyai.client.base import GET, _MostlyBaseClient
|
|
8
22
|
from mostlyai.client.connectors import _MostlyConnectorsClient
|
|
9
23
|
from mostlyai.client.generators import _MostlyGeneratorsClient
|
|
10
|
-
from mostlyai.
|
|
24
|
+
from mostlyai.domain import (
|
|
11
25
|
Connector,
|
|
12
26
|
CurrentUser,
|
|
13
27
|
Generator,
|
|
@@ -19,6 +33,7 @@ from mostlyai.client.domain import (
|
|
|
19
33
|
SourceTableConfig,
|
|
20
34
|
SyntheticDatasetConfig,
|
|
21
35
|
SyntheticProbeConfig,
|
|
36
|
+
AboutService,
|
|
22
37
|
)
|
|
23
38
|
from mostlyai.client.synthetic_datasets import (
|
|
24
39
|
_MostlySyntheticDatasetsClient,
|
|
@@ -85,16 +100,28 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
85
100
|
self.generators = _MostlyGeneratorsClient(**client_kwargs)
|
|
86
101
|
self.synthetic_datasets = _MostlySyntheticDatasetsClient(**client_kwargs)
|
|
87
102
|
self.synthetic_probes = _MostlySyntheticProbesClient(**client_kwargs)
|
|
103
|
+
try:
|
|
104
|
+
version = self.about().version
|
|
105
|
+
email = self.me().email
|
|
106
|
+
rich.print(
|
|
107
|
+
f"Connected to {self.base_url} ({version}) as [bold]{email}[/bold]"
|
|
108
|
+
)
|
|
109
|
+
except Exception as e:
|
|
110
|
+
rich.print(f"Failed to connect to {self.base_url}: {e}")
|
|
88
111
|
|
|
89
112
|
def __repr__(self) -> str:
|
|
90
113
|
api_key = "'***'" if self.api_key else "None"
|
|
91
114
|
return f"MostlyAI(base_url='{self.base_url}', api_key={api_key})"
|
|
92
115
|
|
|
93
|
-
def connect(
|
|
116
|
+
def connect(
|
|
117
|
+
self,
|
|
118
|
+
config: Union[ConnectorConfig, dict[str, Any]],
|
|
119
|
+
test_connection: Optional[bool] = True,
|
|
120
|
+
) -> Connector:
|
|
94
121
|
"""
|
|
95
122
|
Create a connector and optionally validate the connection before saving.
|
|
96
123
|
|
|
97
|
-
See [ConnectorConfig](api_domain.md#mostlyai.
|
|
124
|
+
See [ConnectorConfig](api_domain.md#mostlyai.domain.ConnectorConfig) for more information on the available configuration parameters.
|
|
98
125
|
|
|
99
126
|
Example for creating a connector to a AWS S3 storage:
|
|
100
127
|
```python
|
|
@@ -115,6 +142,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
115
142
|
|
|
116
143
|
Args:
|
|
117
144
|
config: Configuration for the connector. Can be either a ConnectorConfig object or an equivalent dictionary.
|
|
145
|
+
test_connection: Whether to validate the connection before saving.
|
|
118
146
|
|
|
119
147
|
The structures of the `config`, `secrets` and `ssl` parameters depend on the connector `type`:
|
|
120
148
|
|
|
@@ -236,7 +264,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
236
264
|
Returns:
|
|
237
265
|
Connector: The created connector.
|
|
238
266
|
"""
|
|
239
|
-
c = self.connectors.create(config)
|
|
267
|
+
c = self.connectors.create(config=config, test_connection=test_connection)
|
|
240
268
|
rich.print(
|
|
241
269
|
f"Created connector [link={self.base_url}/d/connectors/{c.id} blue underline]{c.id}[/]"
|
|
242
270
|
)
|
|
@@ -254,7 +282,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
254
282
|
"""
|
|
255
283
|
Train a generator.
|
|
256
284
|
|
|
257
|
-
See [GeneratorConfig](api_domain.md#mostlyai.
|
|
285
|
+
See [GeneratorConfig](api_domain.md#mostlyai.domain.GeneratorConfig) for more information on the available configuration parameters.
|
|
258
286
|
|
|
259
287
|
Example configuration using short-hand notation:
|
|
260
288
|
```python
|
|
@@ -365,7 +393,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
365
393
|
"""
|
|
366
394
|
Generate synthetic data.
|
|
367
395
|
|
|
368
|
-
See [SyntheticDatasetConfig](api_domain.md#mostlyai.
|
|
396
|
+
See [SyntheticDatasetConfig](api_domain.md#mostlyai.domain.SyntheticDatasetConfig) for more information on the available configuration parameters.
|
|
369
397
|
|
|
370
398
|
Example configuration using short-hand notation:
|
|
371
399
|
```python
|
|
@@ -467,7 +495,7 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
467
495
|
"""
|
|
468
496
|
Probe a generator.
|
|
469
497
|
|
|
470
|
-
See [SyntheticProbeConfig](api_domain.md#mostlyai.
|
|
498
|
+
See [SyntheticProbeConfig](api_domain.md#mostlyai.domain.SyntheticProbeConfig) for more information on the available configuration parameters.
|
|
471
499
|
|
|
472
500
|
Example for probing a generator for 10 synthetic samples:
|
|
473
501
|
```python
|
|
@@ -537,11 +565,11 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
537
565
|
```
|
|
538
566
|
|
|
539
567
|
Returns:
|
|
540
|
-
|
|
568
|
+
Information about the current user.
|
|
541
569
|
"""
|
|
542
570
|
return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
|
|
543
571
|
|
|
544
|
-
def about(self) ->
|
|
572
|
+
def about(self) -> AboutService:
|
|
545
573
|
"""
|
|
546
574
|
Retrieve information about the platform.
|
|
547
575
|
|
|
@@ -554,9 +582,9 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
554
582
|
```
|
|
555
583
|
|
|
556
584
|
Returns:
|
|
557
|
-
|
|
585
|
+
Information about the platform.
|
|
558
586
|
"""
|
|
559
|
-
return self.request(verb=GET, path=["about"])
|
|
587
|
+
return self.request(verb=GET, path=["about"], response_type=AboutService)
|
|
560
588
|
|
|
561
589
|
def models(self, model_type: Union[str, ModelType]) -> list[str]:
|
|
562
590
|
"""
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
import os
|
|
2
16
|
import sys
|
|
3
17
|
import warnings
|
|
@@ -121,6 +135,10 @@ class _MostlyBaseClient:
|
|
|
121
135
|
if isinstance(kwargs["json"], BaseModel):
|
|
122
136
|
kwargs["json"] = kwargs["json"].model_dump()
|
|
123
137
|
kwargs["json"] = map_snake_to_camel_case(kwargs["json"])
|
|
138
|
+
if "params" in kwargs and do_json_camel_case:
|
|
139
|
+
if isinstance(kwargs["params"], BaseModel):
|
|
140
|
+
kwargs["params"] = kwargs["params"].model_dump()
|
|
141
|
+
kwargs["params"] = map_snake_to_camel_case(kwargs["params"])
|
|
124
142
|
|
|
125
143
|
try:
|
|
126
144
|
with httpx.Client(timeout=self.timeout, verify=self.ssl_verify) as client:
|
|
@@ -1,7 +1,21 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
from typing import Any, Iterator, Optional, List, Dict, Union
|
|
2
16
|
|
|
3
17
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
4
|
-
from mostlyai.
|
|
18
|
+
from mostlyai.domain import (
|
|
5
19
|
Connector,
|
|
6
20
|
ConnectorListItem,
|
|
7
21
|
ConnectorPatchConfig,
|
|
@@ -78,6 +92,7 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
78
92
|
def create(
|
|
79
93
|
self,
|
|
80
94
|
config: Union[ConnectorConfig, dict[str, Any]],
|
|
95
|
+
test_connection: Optional[bool] = True,
|
|
81
96
|
) -> Connector:
|
|
82
97
|
"""
|
|
83
98
|
Create a connector and optionally validate the connection before saving.
|
|
@@ -86,12 +101,17 @@ class _MostlyConnectorsClient(_MostlyBaseClient):
|
|
|
86
101
|
|
|
87
102
|
Args:
|
|
88
103
|
config: Configuration for the connector.
|
|
104
|
+
test_connection: Whether to test the connection before saving the connector
|
|
89
105
|
|
|
90
106
|
Returns:
|
|
91
107
|
The created connector object.
|
|
92
108
|
"""
|
|
93
109
|
response = self.request(
|
|
94
|
-
verb=POST,
|
|
110
|
+
verb=POST,
|
|
111
|
+
path=[],
|
|
112
|
+
json=config,
|
|
113
|
+
params={"test_connection": test_connection},
|
|
114
|
+
response_type=Connector,
|
|
95
115
|
)
|
|
96
116
|
return response
|
|
97
117
|
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
from rich.console import Console
|
|
2
16
|
from rich.panel import Panel
|
|
3
17
|
from rich.text import Text
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
from pathlib import Path
|
|
2
16
|
from typing import Any, Iterator, Optional, Union
|
|
3
17
|
import re
|
|
@@ -5,7 +19,7 @@ import re
|
|
|
5
19
|
import pandas as pd
|
|
6
20
|
|
|
7
21
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
8
|
-
from mostlyai.
|
|
22
|
+
from mostlyai.domain import (
|
|
9
23
|
Generator,
|
|
10
24
|
JobProgress,
|
|
11
25
|
GeneratorListItem,
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# Copyright 2024 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
|
+
|
|
1
15
|
import io
|
|
2
16
|
import re
|
|
3
17
|
import zipfile
|
|
@@ -6,7 +20,7 @@ from typing import Any, Iterator, Optional, Union
|
|
|
6
20
|
import pandas as pd
|
|
7
21
|
|
|
8
22
|
from mostlyai.client.base import DELETE, GET, PATCH, POST, Paginator, _MostlyBaseClient
|
|
9
|
-
from mostlyai.
|
|
23
|
+
from mostlyai.domain import (
|
|
10
24
|
JobProgress,
|
|
11
25
|
SyntheticDataset,
|
|
12
26
|
SyntheticDatasetFormat,
|