mostlyai 0.3.7__tar.gz → 0.3.9__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.7 → mostlyai-0.3.9}/PKG-INFO +24 -12
- {mostlyai-0.3.7 → mostlyai-0.3.9}/README.md +23 -11
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/__init__.py +1 -1
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/api.py +19 -7
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/base.py +2 -1
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/model.py +230 -15
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/synthetic_datasets.py +13 -4
- {mostlyai-0.3.7 → mostlyai-0.3.9}/pyproject.toml +1 -1
- {mostlyai-0.3.7 → mostlyai-0.3.9}/LICENSE +0 -0
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/connectors.py +0 -0
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/exceptions.py +0 -0
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/generators.py +0 -0
- {mostlyai-0.3.7 → mostlyai-0.3.9}/mostlyai/shares.py +0 -0
- {mostlyai-0.3.7 → mostlyai-0.3.9}/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.9
|
|
4
4
|
Summary: The official Python client for the MOSTLY AI platform.
|
|
5
5
|
Home-page: https://app.mostly.ai/
|
|
6
6
|
License: Proprietary
|
|
@@ -24,21 +24,24 @@ Description-Content-Type: text/markdown
|
|
|
24
24
|
|
|
25
25
|
A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
|
|
26
26
|
|
|
27
|
-
| Intent | Primitive
|
|
28
|
-
|
|
29
|
-
| Train a Generative AI on tabular data | `g = mostly.train(data)`
|
|
30
|
-
| Empower your team with safe synthetic data | `mostly.share(g, email)`
|
|
31
|
-
| Generate
|
|
32
|
-
| Prompt the generator for the data that you need | `mostly.generate(g, seed)`
|
|
33
|
-
|
|
|
34
|
-
|
|
|
27
|
+
| Intent | Primitive |
|
|
28
|
+
|-------------------------------------------------|----------------------------------|
|
|
29
|
+
| Train a Generative AI on tabular data | `g = mostly.train(data)` |
|
|
30
|
+
| Empower your team with safe synthetic data | `mostly.share(g, email)` |
|
|
31
|
+
| Generate any number of synthetic data records | `mostly.generate(g, size)` |
|
|
32
|
+
| Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
|
|
33
|
+
| Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
|
|
34
|
+
| Connect to any data source within your org | `mostly.connect(config)` |
|
|
35
|
+
| Info about the current user | `mostly.me()` |
|
|
36
|
+
| Info about the platform | `mostly.about()` |
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
## Installation
|
|
42
|
+
|
|
40
43
|
```shell
|
|
41
|
-
pip install mostlyai
|
|
44
|
+
pip install -U mostlyai
|
|
42
45
|
```
|
|
43
46
|
|
|
44
47
|
## Basic Usage
|
|
@@ -46,8 +49,10 @@ pip install mostlyai
|
|
|
46
49
|
from mostlyai import MostlyAI
|
|
47
50
|
mostly = MostlyAI(api_key='your_api_key')
|
|
48
51
|
g = mostly.train(data) # train a generator on your data
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
mostly.share(g, email) # share the generator with your team
|
|
53
|
+
sd = mostly.generate(g) # use the generator to create a synthetic dataset
|
|
54
|
+
syn = sd.data() # consume the synthetic data as pandas DataFrame(s)
|
|
55
|
+
mostly.probe(g, size=100) # generate few samples on demand
|
|
51
56
|
```
|
|
52
57
|
|
|
53
58
|
## Supported Methods
|
|
@@ -131,3 +136,10 @@ sd.shares()
|
|
|
131
136
|
c.shares()
|
|
132
137
|
```
|
|
133
138
|
|
|
139
|
+
### Info
|
|
140
|
+
|
|
141
|
+
```python
|
|
142
|
+
mostly.about()
|
|
143
|
+
mostly.me()
|
|
144
|
+
```
|
|
145
|
+
|
|
@@ -2,21 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
A Python wrapper for the MOSTLY AI platform (https://app.mostly.ai/).
|
|
4
4
|
|
|
5
|
-
| Intent | Primitive
|
|
6
|
-
|
|
7
|
-
| Train a Generative AI on tabular data | `g = mostly.train(data)`
|
|
8
|
-
| Empower your team with safe synthetic data | `mostly.share(g, email)`
|
|
9
|
-
| Generate
|
|
10
|
-
| Prompt the generator for the data that you need | `mostly.generate(g, seed)`
|
|
11
|
-
|
|
|
12
|
-
|
|
|
5
|
+
| Intent | Primitive |
|
|
6
|
+
|-------------------------------------------------|----------------------------------|
|
|
7
|
+
| Train a Generative AI on tabular data | `g = mostly.train(data)` |
|
|
8
|
+
| Empower your team with safe synthetic data | `mostly.share(g, email)` |
|
|
9
|
+
| Generate any number of synthetic data records | `mostly.generate(g, size)` |
|
|
10
|
+
| Prompt the generator for the data that you need | `mostly.generate(g, seed)` |
|
|
11
|
+
| Live probe the generator on demand | `mostly.probe(g, size \| seed)` |
|
|
12
|
+
| Connect to any data source within your org | `mostly.connect(config)` |
|
|
13
|
+
| Info about the current user | `mostly.me()` |
|
|
14
|
+
| Info about the platform | `mostly.about()` |
|
|
13
15
|
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
## Installation
|
|
20
|
+
|
|
18
21
|
```shell
|
|
19
|
-
pip install mostlyai
|
|
22
|
+
pip install -U mostlyai
|
|
20
23
|
```
|
|
21
24
|
|
|
22
25
|
## Basic Usage
|
|
@@ -24,8 +27,10 @@ pip install mostlyai
|
|
|
24
27
|
from mostlyai import MostlyAI
|
|
25
28
|
mostly = MostlyAI(api_key='your_api_key')
|
|
26
29
|
g = mostly.train(data) # train a generator on your data
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
mostly.share(g, email) # share the generator with your team
|
|
31
|
+
sd = mostly.generate(g) # use the generator to create a synthetic dataset
|
|
32
|
+
syn = sd.data() # consume the synthetic data as pandas DataFrame(s)
|
|
33
|
+
mostly.probe(g, size=100) # generate few samples on demand
|
|
29
34
|
```
|
|
30
35
|
|
|
31
36
|
## Supported Methods
|
|
@@ -108,3 +113,10 @@ g.shares()
|
|
|
108
113
|
sd.shares()
|
|
109
114
|
c.shares()
|
|
110
115
|
```
|
|
116
|
+
|
|
117
|
+
### Info
|
|
118
|
+
|
|
119
|
+
```python
|
|
120
|
+
mostly.about()
|
|
121
|
+
mostly.me()
|
|
122
|
+
```
|
|
@@ -115,12 +115,15 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
115
115
|
host: string
|
|
116
116
|
port: integer, default: 10000
|
|
117
117
|
username: string (required for regular auth)
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
kerberosEnabled: boolean, default: false
|
|
119
|
+
kerberosPrincipal: string (required if kerberosEnabled)
|
|
120
|
+
kerberosKrb5Conf: string (required if kerberosEnabled)
|
|
121
|
+
sslEnabled: boolean, default: false
|
|
121
122
|
secrets:
|
|
122
123
|
password: string (required for regular auth)
|
|
123
|
-
|
|
124
|
+
kerberosKeytab: base64-encoded string (required if kerberosEnabled)
|
|
125
|
+
ssl:
|
|
126
|
+
caCertificate: base64-encoded string
|
|
124
127
|
|
|
125
128
|
- type: MARIADB
|
|
126
129
|
config:
|
|
@@ -163,12 +166,13 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
163
166
|
port: integer, default: 5432
|
|
164
167
|
username: string
|
|
165
168
|
database: string
|
|
169
|
+
sslEnabled: boolean, default: false
|
|
166
170
|
secrets:
|
|
167
171
|
password: string
|
|
168
172
|
ssl:
|
|
169
|
-
rootCertificate: string
|
|
170
|
-
sslCertificate: string
|
|
171
|
-
sslCertificateKey: string
|
|
173
|
+
rootCertificate: base64-encoded string
|
|
174
|
+
sslCertificate: base64-encoded string
|
|
175
|
+
sslCertificateKey: base64-encoded string
|
|
172
176
|
|
|
173
177
|
- type: SNOWFLAKE
|
|
174
178
|
config:
|
|
@@ -370,3 +374,11 @@ class MostlyAI(_MostlyBaseClient):
|
|
|
370
374
|
:return: info about the current user.
|
|
371
375
|
"""
|
|
372
376
|
return self.request(verb=GET, path=["users", "me"], response_type=CurrentUser)
|
|
377
|
+
|
|
378
|
+
def about(self) -> dict[str, Any]:
|
|
379
|
+
"""
|
|
380
|
+
Retrieve about info from the endpoint.
|
|
381
|
+
Supported from release v210 onwards.
|
|
382
|
+
:return: info about the platform.
|
|
383
|
+
"""
|
|
384
|
+
return self.request(verb=GET, path=["about"])
|
|
@@ -213,7 +213,7 @@ class CustomBaseModel(BaseModel):
|
|
|
213
213
|
rich.print(self.dict())
|
|
214
214
|
return capture.get()
|
|
215
215
|
|
|
216
|
-
def open(self):
|
|
216
|
+
def open(self) -> str:
|
|
217
217
|
"""
|
|
218
218
|
Opens the instance in a web browser.
|
|
219
219
|
"""
|
|
@@ -221,6 +221,7 @@ class CustomBaseModel(BaseModel):
|
|
|
221
221
|
raise APIError("Cannot open the instance")
|
|
222
222
|
url = "/".join([self.client.base_url, *self.OPEN_URL_PARTS, str(self.id)])
|
|
223
223
|
webbrowser.open_new(url)
|
|
224
|
+
return url
|
|
224
225
|
|
|
225
226
|
def reload(self):
|
|
226
227
|
"""
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# generated by datamodel-codegen:
|
|
2
|
-
# timestamp: 2024-05-
|
|
2
|
+
# timestamp: 2024-05-28T13:04:58+00:00
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
@@ -123,6 +123,14 @@ class Metadata(CustomBaseModel):
|
|
|
123
123
|
current_user_permission_level: Annotated[
|
|
124
124
|
Optional[PermissionLevel], Field(None, alias="currentUserPermissionLevel")
|
|
125
125
|
] = None
|
|
126
|
+
short_lived_file_token: Annotated[
|
|
127
|
+
Optional[str],
|
|
128
|
+
Field(
|
|
129
|
+
None,
|
|
130
|
+
alias="shortLivedFileToken",
|
|
131
|
+
description="An auto-generated short-lived file token (`slft`) for accessing resource artefacts.\nThe token is always restricted to a single resource, only valid for 10 minutes, and \nonly accepted by API endpoints that allow to download single files.\n",
|
|
132
|
+
),
|
|
133
|
+
] = None
|
|
126
134
|
|
|
127
135
|
|
|
128
136
|
class PaginatedTotalCount(RootModel[int]):
|
|
@@ -322,7 +330,7 @@ class GeneratorUsage(CustomBaseModel):
|
|
|
322
330
|
Field(
|
|
323
331
|
None,
|
|
324
332
|
alias="totalComputeTime",
|
|
325
|
-
description="The total compute time in seconds used for training this generator
|
|
333
|
+
description="The total compute time in seconds used for training this generator.\nThis is the sum of the compute time of all trained tasks.\n",
|
|
326
334
|
),
|
|
327
335
|
] = None
|
|
328
336
|
no_of_synthetic_datasets: Annotated[
|
|
@@ -372,24 +380,27 @@ class SourceColumnValueRange(CustomBaseModel):
|
|
|
372
380
|
min: Annotated[
|
|
373
381
|
Optional[str],
|
|
374
382
|
Field(
|
|
375
|
-
|
|
383
|
+
None,
|
|
384
|
+
description="The minimum value of the column. For dates, this is represented in ISO format.",
|
|
376
385
|
),
|
|
377
386
|
] = None
|
|
378
387
|
max: Annotated[
|
|
379
388
|
Optional[str],
|
|
380
389
|
Field(
|
|
381
|
-
|
|
390
|
+
None,
|
|
391
|
+
description="The maximum value of the column. For dates, this is represented in ISO format.",
|
|
382
392
|
),
|
|
383
393
|
] = None
|
|
384
394
|
values: Annotated[
|
|
385
395
|
Optional[List[str]],
|
|
386
396
|
Field(
|
|
387
|
-
|
|
397
|
+
None,
|
|
398
|
+
description="The list of distinct values of the column. Limited to a maximum of 1000 values.",
|
|
388
399
|
),
|
|
389
400
|
] = None
|
|
390
401
|
has_null: Annotated[
|
|
391
402
|
Optional[bool],
|
|
392
|
-
Field(description="If true, null value was detected within the column."),
|
|
403
|
+
Field(None, description="If true, null value was detected within the column."),
|
|
393
404
|
] = None
|
|
394
405
|
|
|
395
406
|
|
|
@@ -404,7 +415,7 @@ class SourceColumn(CustomBaseModel):
|
|
|
404
415
|
]
|
|
405
416
|
model_encoding_type: Annotated[ModelEncodingType, Field(alias="modelEncodingType")]
|
|
406
417
|
value_range: Annotated[
|
|
407
|
-
Optional[SourceColumnValueRange], Field(alias="valueRange")
|
|
418
|
+
Optional[SourceColumnValueRange], Field(None, alias="valueRange")
|
|
408
419
|
] = None
|
|
409
420
|
|
|
410
421
|
|
|
@@ -537,7 +548,7 @@ class ModelConfiguration(CustomBaseModel):
|
|
|
537
548
|
Field(
|
|
538
549
|
"CONSTANT",
|
|
539
550
|
alias="rareCategoryReplacementMethod",
|
|
540
|
-
description="Specifies, if the rare categories for categoricals will be replaced by a constant
|
|
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",
|
|
541
552
|
),
|
|
542
553
|
] = "CONSTANT"
|
|
543
554
|
|
|
@@ -666,7 +677,7 @@ class SyntheticDatasetUsage(CustomBaseModel):
|
|
|
666
677
|
Field(
|
|
667
678
|
None,
|
|
668
679
|
alias="totalComputeTime",
|
|
669
|
-
description="The total compute time in seconds used for generating this synthetic dataset
|
|
680
|
+
description="The total compute time in seconds used for generating this synthetic dataset.\nThis is the sum of the compute time of all trained tasks.\n",
|
|
670
681
|
),
|
|
671
682
|
] = None
|
|
672
683
|
no_of_shares: Annotated[
|
|
@@ -729,7 +740,7 @@ class SyntheticTableRebalancing(CustomBaseModel):
|
|
|
729
740
|
Optional[Dict[str, float]],
|
|
730
741
|
Field(
|
|
731
742
|
None,
|
|
732
|
-
description="The target distribution of samples values
|
|
743
|
+
description="The target distribution of samples values.\nThe keys are the categorical values, and the values are the probabilities.\n",
|
|
733
744
|
examples=[[{"US": 0.8}, {"male": 0.5, "female": 0.5}]],
|
|
734
745
|
),
|
|
735
746
|
] = None
|
|
@@ -754,7 +765,7 @@ class SyntheticTableConfiguration(CustomBaseModel):
|
|
|
754
765
|
Field(
|
|
755
766
|
None,
|
|
756
767
|
alias="sampleSeedConnectorId",
|
|
757
|
-
description="The connector id of the seed data for conditional generation
|
|
768
|
+
description="The connector id of the seed data for conditional generation.\nOnly applicable for subject tables.\n",
|
|
758
769
|
),
|
|
759
770
|
] = None
|
|
760
771
|
sample_seed_dict: Annotated[
|
|
@@ -868,6 +879,174 @@ class SyntheticDatasetDelivery(CustomBaseModel):
|
|
|
868
879
|
]
|
|
869
880
|
|
|
870
881
|
|
|
882
|
+
class AssistantLiteLlmExtraItem(CustomBaseModel):
|
|
883
|
+
key: Optional[str] = None
|
|
884
|
+
value: Optional[str] = None
|
|
885
|
+
|
|
886
|
+
|
|
887
|
+
class LiteLlm(CustomBaseModel):
|
|
888
|
+
model: Annotated[
|
|
889
|
+
Optional[str],
|
|
890
|
+
Field(
|
|
891
|
+
None,
|
|
892
|
+
description="The LiteLLM model of the assistant. See https://docs.litellm.ai/docs/providers.",
|
|
893
|
+
examples=[["openai/gpt-3.5-turbo", "mistral/mistral-tiny"]],
|
|
894
|
+
),
|
|
895
|
+
] = None
|
|
896
|
+
api_key: Annotated[
|
|
897
|
+
Optional[str],
|
|
898
|
+
Field(
|
|
899
|
+
None,
|
|
900
|
+
alias="apiKey",
|
|
901
|
+
description="The API key for the selected LiteLLM model. See https://docs.litellm.ai/docs/providers.",
|
|
902
|
+
),
|
|
903
|
+
] = None
|
|
904
|
+
extra: Annotated[
|
|
905
|
+
Optional[List[AssistantLiteLlmExtraItem]],
|
|
906
|
+
Field(
|
|
907
|
+
None,
|
|
908
|
+
description="Any additional configuration parameters for the selected LiteLLM model. See https://docs.litellm.ai/docs/providers.",
|
|
909
|
+
),
|
|
910
|
+
] = None
|
|
911
|
+
|
|
912
|
+
|
|
913
|
+
class DataLlm(CustomBaseModel):
|
|
914
|
+
api_key: Annotated[
|
|
915
|
+
Optional[str],
|
|
916
|
+
Field(
|
|
917
|
+
None,
|
|
918
|
+
alias="apiKey",
|
|
919
|
+
description="The API key for the DataLLM service. See https://data.mostly.ai.",
|
|
920
|
+
),
|
|
921
|
+
] = None
|
|
922
|
+
|
|
923
|
+
|
|
924
|
+
class AssistantSettings(CustomBaseModel):
|
|
925
|
+
"""
|
|
926
|
+
Additional optional assistant settings used for LiteLLM
|
|
927
|
+
"""
|
|
928
|
+
|
|
929
|
+
is_enabled: Annotated[
|
|
930
|
+
Optional[bool],
|
|
931
|
+
Field(
|
|
932
|
+
None, alias="isEnabled", description="If true, the assistant is enabled."
|
|
933
|
+
),
|
|
934
|
+
] = None
|
|
935
|
+
lite_llm: Annotated[Optional[LiteLlm], Field(None, alias="liteLlm")] = None
|
|
936
|
+
data_llm: Annotated[Optional[DataLlm], Field(None, alias="dataLlm")] = None
|
|
937
|
+
system_instructions: Annotated[
|
|
938
|
+
Optional[str],
|
|
939
|
+
Field(
|
|
940
|
+
None,
|
|
941
|
+
alias="systemInstructions",
|
|
942
|
+
description="The system instructions of the assistant",
|
|
943
|
+
),
|
|
944
|
+
] = None
|
|
945
|
+
custom_instructions: Annotated[
|
|
946
|
+
Optional[str],
|
|
947
|
+
Field(
|
|
948
|
+
None,
|
|
949
|
+
alias="customInstructions",
|
|
950
|
+
description="The custom instructions of the assistant",
|
|
951
|
+
),
|
|
952
|
+
] = None
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
class AssistantThreadSessionStatus(str, Enum):
|
|
956
|
+
pending = "pending"
|
|
957
|
+
active = "active"
|
|
958
|
+
inactive = "inactive"
|
|
959
|
+
|
|
960
|
+
|
|
961
|
+
class AssistantMessageRole(str, Enum):
|
|
962
|
+
"""
|
|
963
|
+
The role of the author of this message
|
|
964
|
+
"""
|
|
965
|
+
|
|
966
|
+
system = "system"
|
|
967
|
+
user = "user"
|
|
968
|
+
assistant = "assistant"
|
|
969
|
+
tool = "tool"
|
|
970
|
+
|
|
971
|
+
|
|
972
|
+
class AssistantMessageContentType(str, Enum):
|
|
973
|
+
"""
|
|
974
|
+
The type of the message content
|
|
975
|
+
"""
|
|
976
|
+
|
|
977
|
+
text = "text"
|
|
978
|
+
python = "python"
|
|
979
|
+
console = "console"
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
class AssistantMessageFinishReason(str, Enum):
|
|
983
|
+
stop = "stop"
|
|
984
|
+
length = "length"
|
|
985
|
+
tool_calls = "tool_calls"
|
|
986
|
+
|
|
987
|
+
|
|
988
|
+
class AssistantMessage(CustomBaseModel):
|
|
989
|
+
"""
|
|
990
|
+
A complete message.
|
|
991
|
+
"""
|
|
992
|
+
|
|
993
|
+
id: Annotated[
|
|
994
|
+
Optional[str],
|
|
995
|
+
Field(None, description="The unique identifier of a assistant message"),
|
|
996
|
+
] = None
|
|
997
|
+
role: Optional[AssistantMessageRole] = None
|
|
998
|
+
content_type: Annotated[
|
|
999
|
+
Optional[AssistantMessageContentType], Field(None, alias="contentType")
|
|
1000
|
+
] = None
|
|
1001
|
+
content: Annotated[
|
|
1002
|
+
Optional[str],
|
|
1003
|
+
Field(
|
|
1004
|
+
None, description="The content of a message", max_length=65000, min_length=1
|
|
1005
|
+
),
|
|
1006
|
+
] = None
|
|
1007
|
+
finish_reason: Annotated[
|
|
1008
|
+
Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
|
|
1009
|
+
] = None
|
|
1010
|
+
|
|
1011
|
+
|
|
1012
|
+
class AssistantMessageDelta(CustomBaseModel):
|
|
1013
|
+
"""
|
|
1014
|
+
A partial message delta generated by streamed model responses.
|
|
1015
|
+
"""
|
|
1016
|
+
|
|
1017
|
+
id: Annotated[
|
|
1018
|
+
Optional[str],
|
|
1019
|
+
Field(None, description="The unique identifier of a assistant message"),
|
|
1020
|
+
] = None
|
|
1021
|
+
role: Optional[AssistantMessageRole] = None
|
|
1022
|
+
content_type: Annotated[
|
|
1023
|
+
Optional[AssistantMessageContentType], Field(None, alias="contentType")
|
|
1024
|
+
] = None
|
|
1025
|
+
delta: Annotated[
|
|
1026
|
+
Optional[str],
|
|
1027
|
+
Field(
|
|
1028
|
+
None,
|
|
1029
|
+
description="The partial content of a message",
|
|
1030
|
+
max_length=65000,
|
|
1031
|
+
min_length=1,
|
|
1032
|
+
),
|
|
1033
|
+
] = None
|
|
1034
|
+
finish_reason: Annotated[
|
|
1035
|
+
Optional[AssistantMessageFinishReason], Field(None, alias="finishReason")
|
|
1036
|
+
] = None
|
|
1037
|
+
|
|
1038
|
+
|
|
1039
|
+
class AssistantThreadUsage(CustomBaseModel):
|
|
1040
|
+
no_of_shares: Annotated[
|
|
1041
|
+
Optional[int],
|
|
1042
|
+
Field(
|
|
1043
|
+
None,
|
|
1044
|
+
alias="noOfShares",
|
|
1045
|
+
description="Number of shares of this assistant thread.",
|
|
1046
|
+
),
|
|
1047
|
+
] = None
|
|
1048
|
+
|
|
1049
|
+
|
|
871
1050
|
class BaseResource(CustomBaseModel):
|
|
872
1051
|
id: Annotated[
|
|
873
1052
|
Optional[str], Field(None, description="The unique identifier of the entity")
|
|
@@ -1067,7 +1246,7 @@ class ProgressStep(CustomBaseModel):
|
|
|
1067
1246
|
Field(
|
|
1068
1247
|
None,
|
|
1069
1248
|
alias="endDate",
|
|
1070
|
-
description="The UTC date and time when the job has ended
|
|
1249
|
+
description="The UTC date and time when the job has ended.\nIf the job is still, then this is None.\n",
|
|
1071
1250
|
examples=["2024-01-25T12:34:56Z"],
|
|
1072
1251
|
),
|
|
1073
1252
|
] = None
|
|
@@ -1151,7 +1330,9 @@ class SyntheticDataset(CustomBaseModel):
|
|
|
1151
1330
|
:param file_path: The file path to save the synthetic dataset
|
|
1152
1331
|
"""
|
|
1153
1332
|
bytes, filename = self.client._download(
|
|
1154
|
-
synthetic_dataset_id=self.id,
|
|
1333
|
+
synthetic_dataset_id=self.id,
|
|
1334
|
+
ds_format=format,
|
|
1335
|
+
short_lived_file_token=self.metadata.short_lived_file_token,
|
|
1155
1336
|
)
|
|
1156
1337
|
file_path = Path(file_path or ".")
|
|
1157
1338
|
if file_path.is_dir():
|
|
@@ -1167,7 +1348,10 @@ class SyntheticDataset(CustomBaseModel):
|
|
|
1167
1348
|
|
|
1168
1349
|
:return: The synthetic dataset as dictionary of pandas DataFrames
|
|
1169
1350
|
"""
|
|
1170
|
-
dfs = self.client._data(
|
|
1351
|
+
dfs = self.client._data(
|
|
1352
|
+
synthetic_dataset_id=self.id,
|
|
1353
|
+
short_lived_file_token=self.metadata.short_lived_file_token,
|
|
1354
|
+
)
|
|
1171
1355
|
if return_type == "auto" and len(dfs) == 1:
|
|
1172
1356
|
return list(dfs.values())[0]
|
|
1173
1357
|
else:
|
|
@@ -1216,6 +1400,37 @@ class SyntheticDataset(CustomBaseModel):
|
|
|
1216
1400
|
)
|
|
1217
1401
|
|
|
1218
1402
|
|
|
1403
|
+
class AssistantThreadListItem(CustomBaseModel):
|
|
1404
|
+
id: Annotated[str, Field(description="The unique identifier of a assistant thread")]
|
|
1405
|
+
metadata: Metadata
|
|
1406
|
+
name: Annotated[
|
|
1407
|
+
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1408
|
+
] = None
|
|
1409
|
+
usage: Optional[AssistantThreadUsage] = None
|
|
1410
|
+
|
|
1411
|
+
|
|
1412
|
+
class AssistantThread(CustomBaseModel):
|
|
1413
|
+
id: Annotated[
|
|
1414
|
+
Optional[str],
|
|
1415
|
+
Field(None, description="The unique identifier of a assistant thread"),
|
|
1416
|
+
] = None
|
|
1417
|
+
metadata: Optional[Metadata] = None
|
|
1418
|
+
name: Annotated[
|
|
1419
|
+
Optional[str], Field(None, description="The name of a assistant thread")
|
|
1420
|
+
] = None
|
|
1421
|
+
session_status: Annotated[
|
|
1422
|
+
Optional[AssistantThreadSessionStatus], Field(None, alias="sessionStatus")
|
|
1423
|
+
] = None
|
|
1424
|
+
messages: Annotated[
|
|
1425
|
+
Optional[List[AssistantMessage]],
|
|
1426
|
+
Field(
|
|
1427
|
+
None,
|
|
1428
|
+
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",
|
|
1429
|
+
),
|
|
1430
|
+
] = None
|
|
1431
|
+
usage: Optional[AssistantThreadUsage] = None
|
|
1432
|
+
|
|
1433
|
+
|
|
1219
1434
|
class Share(User):
|
|
1220
1435
|
permission_level: Annotated[
|
|
1221
1436
|
Optional[PermissionLevel], Field(None, alias="permissionLevel")
|
|
@@ -1348,7 +1563,7 @@ class JobProgress(CustomBaseModel):
|
|
|
1348
1563
|
Field(
|
|
1349
1564
|
None,
|
|
1350
1565
|
alias="endDate",
|
|
1351
|
-
description="The UTC date and time when the job has ended
|
|
1566
|
+
description="The UTC date and time when the job has ended.\nIf the job is still, then this is None.\n",
|
|
1352
1567
|
examples=["2024-01-25T12:34:56Z"],
|
|
1353
1568
|
),
|
|
1354
1569
|
] = None
|
|
@@ -99,12 +99,17 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
99
99
|
self,
|
|
100
100
|
synthetic_dataset_id: str,
|
|
101
101
|
ds_format: SyntheticDatasetFormat = SyntheticDatasetFormat.parquet,
|
|
102
|
+
short_lived_file_token: Optional[str] = None,
|
|
102
103
|
) -> (bytes, Optional[str]):
|
|
103
|
-
ds_format = ds_format.upper() if isinstance(ds_format, str) else ds_format.value
|
|
104
104
|
response = self.request(
|
|
105
105
|
verb=GET,
|
|
106
106
|
path=[synthetic_dataset_id, "download"],
|
|
107
|
-
params={
|
|
107
|
+
params={
|
|
108
|
+
"format": ds_format.upper()
|
|
109
|
+
if isinstance(ds_format, str)
|
|
110
|
+
else ds_format.value,
|
|
111
|
+
"slft": short_lived_file_token,
|
|
112
|
+
},
|
|
108
113
|
headers={
|
|
109
114
|
"Content-Type": "application/zip",
|
|
110
115
|
"Accept": "application/json, text/plain, */*",
|
|
@@ -120,10 +125,14 @@ class _MostlySyntheticDatasetsClient(_MostlyBaseClient):
|
|
|
120
125
|
filename = None
|
|
121
126
|
return content_bytes, filename
|
|
122
127
|
|
|
123
|
-
def _data(
|
|
128
|
+
def _data(
|
|
129
|
+
self, synthetic_dataset_id: str, short_lived_file_token: Optional[str]
|
|
130
|
+
) -> dict[str, pd.DataFrame]:
|
|
124
131
|
# download pqt
|
|
125
132
|
pqt_zip_bytes, filename = self._download(
|
|
126
|
-
synthetic_dataset_id,
|
|
133
|
+
synthetic_dataset_id=synthetic_dataset_id,
|
|
134
|
+
ds_format=SyntheticDatasetFormat.parquet,
|
|
135
|
+
short_lived_file_token=short_lived_file_token,
|
|
127
136
|
)
|
|
128
137
|
# read each parquet file into a pandas dataframe
|
|
129
138
|
with zipfile.ZipFile(io.BytesIO(pqt_zip_bytes), "r") as z:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|