mostlyai 0.3.11__tar.gz → 0.3.12__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.11 → mostlyai-0.3.12}/PKG-INFO +4 -2
- {mostlyai-0.3.11 → mostlyai-0.3.12}/README.md +3 -1
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/__init__.py +1 -1
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/api.py +20 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/model.py +65 -13
- {mostlyai-0.3.11 → mostlyai-0.3.12}/pyproject.toml +1 -1
- {mostlyai-0.3.11 → mostlyai-0.3.12}/LICENSE +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/base.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/connectors.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/generators.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/shares.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/mostlyai/synthetic_datasets.py +0 -0
- {mostlyai-0.3.11 → mostlyai-0.3.12}/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.12
|
|
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,6 +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.usage(by_periods)` |
|
|
36
37
|
| Info about the platform | `mostly.about()` |
|
|
37
38
|
|
|
38
39
|
|
|
@@ -144,7 +145,8 @@ c.shares()
|
|
|
144
145
|
### Info
|
|
145
146
|
|
|
146
147
|
```python
|
|
147
|
-
mostly.about()
|
|
148
148
|
mostly.me()
|
|
149
|
+
mostly.usage_report(by_periods)
|
|
150
|
+
mostly.about()
|
|
149
151
|
```
|
|
150
152
|
|
|
@@ -11,6 +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.usage(by_periods)` |
|
|
14
15
|
| Info about the platform | `mostly.about()` |
|
|
15
16
|
|
|
16
17
|
|
|
@@ -122,6 +123,7 @@ c.shares()
|
|
|
122
123
|
### Info
|
|
123
124
|
|
|
124
125
|
```python
|
|
125
|
-
mostly.about()
|
|
126
126
|
mostly.me()
|
|
127
|
+
mostly.usage_report(by_periods)
|
|
128
|
+
mostly.about()
|
|
127
129
|
```
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import io
|
|
2
|
+
import json
|
|
1
3
|
from pathlib import Path
|
|
2
4
|
from typing import Any, Optional, Union, Literal
|
|
3
5
|
|
|
@@ -375,6 +377,24 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
375
377
|
"""
|
|
376
378
|
return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
|
|
377
379
|
|
|
380
|
+
def usage_report(self, by_periods: bool = False) -> pd.DataFrame:
|
|
381
|
+
"""
|
|
382
|
+
Retrieve usage report as a pd.DataFrame.
|
|
383
|
+
|
|
384
|
+
:param by_periods: if True, by periods. Otherwise, the overall usage report.
|
|
385
|
+
:return: summary of the usage (either by periods or overall)
|
|
386
|
+
"""
|
|
387
|
+
headers = {"Accept": "*/*"} # Accept any content type
|
|
388
|
+
path = ["usage-report"] + (["periods"] if by_periods else ["download"])
|
|
389
|
+
response = self.request(verb=GET, headers=headers, path=path, raw_response=True)
|
|
390
|
+
if by_periods:
|
|
391
|
+
data = json.loads(response.content.decode("utf-8"))["usage"]
|
|
392
|
+
df = pd.DataFrame(data)
|
|
393
|
+
else:
|
|
394
|
+
csv_file = io.BytesIO(response.content)
|
|
395
|
+
df = pd.read_csv(csv_file)
|
|
396
|
+
return df
|
|
397
|
+
|
|
378
398
|
def about(self) -> dict[str, Any]:
|
|
379
399
|
"""
|
|
380
400
|
Retrieve about info from the endpoint.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
|
-
# timestamp: 2024-
|
|
2
|
+
# timestamp: 2024-08-12T09:57:53+00:00
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -754,10 +754,8 @@ class SyntheticTableFairness(CustomBaseModel):
|
|
|
754
754
|
|
|
755
755
|
"""
|
|
756
756
|
|
|
757
|
-
target_column: Annotated[
|
|
758
|
-
sensitive_columns: Annotated[
|
|
759
|
-
Optional[List[str]], Field(None, alias="sensitiveColumns")
|
|
760
|
-
] = None
|
|
757
|
+
target_column: Annotated[str, Field(alias="targetColumn")]
|
|
758
|
+
sensitive_columns: Annotated[List[str], Field(alias="sensitiveColumns")]
|
|
761
759
|
|
|
762
760
|
|
|
763
761
|
class SyntheticTableConfiguration(CustomBaseModel):
|
|
@@ -989,12 +987,20 @@ class AssistantSettings(CustomBaseModel):
|
|
|
989
987
|
description="The custom instructions of the assistant",
|
|
990
988
|
),
|
|
991
989
|
] = None
|
|
990
|
+
default_system_instructions: Annotated[
|
|
991
|
+
Optional[str],
|
|
992
|
+
Field(
|
|
993
|
+
None,
|
|
994
|
+
alias="defaultSystemInstructions",
|
|
995
|
+
description="The system instructions of the assistant",
|
|
996
|
+
),
|
|
997
|
+
] = None
|
|
992
998
|
|
|
993
999
|
|
|
994
1000
|
class AssistantThreadSessionStatus(str, Enum):
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1001
|
+
initializing = "initializing"
|
|
1002
|
+
running = "running"
|
|
1003
|
+
expired = "expired"
|
|
998
1004
|
|
|
999
1005
|
|
|
1000
1006
|
class AssistantMessageRole(str, Enum):
|
|
@@ -1016,6 +1022,7 @@ class AssistantMessageContentType(str, Enum):
|
|
|
1016
1022
|
text = "text"
|
|
1017
1023
|
python = "python"
|
|
1018
1024
|
console = "console"
|
|
1025
|
+
file = "file"
|
|
1019
1026
|
|
|
1020
1027
|
|
|
1021
1028
|
class AssistantMessageFinishReason(str, Enum):
|
|
@@ -1040,7 +1047,7 @@ class AssistantMessage(CustomBaseModel):
|
|
|
1040
1047
|
content: Annotated[
|
|
1041
1048
|
Optional[str],
|
|
1042
1049
|
Field(
|
|
1043
|
-
None, description="The content of a message", max_length=65000, min_length=
|
|
1050
|
+
None, description="The content of a message", max_length=65000, min_length=0
|
|
1044
1051
|
),
|
|
1045
1052
|
] = None
|
|
1046
1053
|
finish_reason: Annotated[
|
|
@@ -1086,6 +1093,53 @@ class AssistantThreadUsage(CustomBaseModel):
|
|
|
1086
1093
|
] = None
|
|
1087
1094
|
|
|
1088
1095
|
|
|
1096
|
+
class UsageReportPeriod(CustomBaseModel):
|
|
1097
|
+
"""
|
|
1098
|
+
The usage report for a specific month
|
|
1099
|
+
"""
|
|
1100
|
+
|
|
1101
|
+
period_start: Annotated[
|
|
1102
|
+
Optional[AwareDatetime],
|
|
1103
|
+
Field(
|
|
1104
|
+
None,
|
|
1105
|
+
alias="periodStart",
|
|
1106
|
+
description="The UTC date and time when the reported time period started",
|
|
1107
|
+
),
|
|
1108
|
+
] = None
|
|
1109
|
+
period_end: Annotated[
|
|
1110
|
+
Optional[AwareDatetime],
|
|
1111
|
+
Field(
|
|
1112
|
+
None,
|
|
1113
|
+
alias="periodEnd",
|
|
1114
|
+
description="The UTC date and time when the reported time period started",
|
|
1115
|
+
),
|
|
1116
|
+
] = None
|
|
1117
|
+
total_datapoints: Annotated[
|
|
1118
|
+
Optional[int],
|
|
1119
|
+
Field(
|
|
1120
|
+
None,
|
|
1121
|
+
alias="totalDatapoints",
|
|
1122
|
+
description="The number of datapoints generated during the reported period",
|
|
1123
|
+
),
|
|
1124
|
+
] = None
|
|
1125
|
+
total_rows: Annotated[
|
|
1126
|
+
Optional[int],
|
|
1127
|
+
Field(
|
|
1128
|
+
None,
|
|
1129
|
+
alias="totalRows",
|
|
1130
|
+
description="The number of rows generated during the reported period",
|
|
1131
|
+
),
|
|
1132
|
+
] = None
|
|
1133
|
+
total_credits: Annotated[
|
|
1134
|
+
Optional[float],
|
|
1135
|
+
Field(
|
|
1136
|
+
None,
|
|
1137
|
+
alias="totalCredits",
|
|
1138
|
+
description="The number of credits used during the reported period",
|
|
1139
|
+
),
|
|
1140
|
+
] = None
|
|
1141
|
+
|
|
1142
|
+
|
|
1089
1143
|
class BaseResource(CustomBaseModel):
|
|
1090
1144
|
id: Annotated[
|
|
1091
1145
|
Optional[str], Field(None, description="The unique identifier of the entity")
|
|
@@ -1545,11 +1599,9 @@ class Generator(CustomBaseModel):
|
|
|
1545
1599
|
file_path: Union[str, Path, None] = None,
|
|
1546
1600
|
) -> Path:
|
|
1547
1601
|
"""
|
|
1548
|
-
Export generator and save to file
|
|
1549
|
-
Supported from release v212 onwards.
|
|
1602
|
+
Export generator and save to file
|
|
1550
1603
|
|
|
1551
|
-
:param file_path:
|
|
1552
|
-
:return: The file path of the exported generator
|
|
1604
|
+
:param file_path: The file path to save the synthetic dataset
|
|
1553
1605
|
"""
|
|
1554
1606
|
bytes, filename = self.client._export_to_file(generator_id=self.id)
|
|
1555
1607
|
file_path = Path(file_path or ".")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|