rapidata 2.41.3__py3-none-any.whl → 2.42.0__py3-none-any.whl
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.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -5
- rapidata/api_client/__init__.py +14 -14
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/asset_api.py +851 -0
- rapidata/api_client/api/benchmark_api.py +298 -0
- rapidata/api_client/api/customer_rapid_api.py +29 -43
- rapidata/api_client/api/dataset_api.py +163 -1143
- rapidata/api_client/api/participant_api.py +28 -74
- rapidata/api_client/api/validation_set_api.py +283 -0
- rapidata/api_client/models/__init__.py +13 -14
- rapidata/api_client/models/add_validation_rapid_model.py +3 -3
- rapidata/api_client/models/add_validation_rapid_new_model.py +152 -0
- rapidata/api_client/models/add_validation_rapid_new_model_asset.py +182 -0
- rapidata/api_client/models/compare_workflow_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_files_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_text_sources_model.py +3 -3
- rapidata/api_client/models/create_datapoint_from_urls_model.py +3 -3
- rapidata/api_client/models/create_datapoint_model.py +108 -0
- rapidata/api_client/models/create_datapoint_model_asset.py +182 -0
- rapidata/api_client/models/create_demographic_rapid_model.py +13 -2
- rapidata/api_client/models/create_demographic_rapid_model_asset.py +188 -0
- rapidata/api_client/models/create_demographic_rapid_model_new.py +119 -0
- rapidata/api_client/models/create_sample_model.py +8 -2
- rapidata/api_client/models/create_sample_model_asset.py +182 -0
- rapidata/api_client/models/create_sample_model_obsolete.py +87 -0
- rapidata/api_client/models/file_asset_input_file.py +8 -22
- rapidata/api_client/models/fork_benchmark_result.py +87 -0
- rapidata/api_client/models/form_file_wrapper.py +17 -2
- rapidata/api_client/models/get_asset_metadata_result.py +100 -0
- rapidata/api_client/models/multi_asset_input_assets_inner.py +10 -24
- rapidata/api_client/models/prompt_asset_metadata_input.py +3 -3
- rapidata/api_client/models/proxy_file_wrapper.py +17 -2
- rapidata/api_client/models/stream_file_wrapper.py +25 -3
- rapidata/api_client/models/submit_prompt_model.py +3 -3
- rapidata/api_client/models/text_metadata.py +6 -1
- rapidata/api_client/models/text_metadata_model.py +7 -2
- rapidata/api_client/models/upload_file_from_url_result.py +87 -0
- rapidata/api_client/models/upload_file_result.py +87 -0
- rapidata/api_client/models/zip_entry_file_wrapper.py +33 -2
- rapidata/api_client_README.md +28 -25
- rapidata/rapidata_client/__init__.py +0 -1
- rapidata/rapidata_client/benchmark/participant/_participant.py +24 -22
- rapidata/rapidata_client/benchmark/rapidata_benchmark.py +89 -102
- rapidata/rapidata_client/datapoints/__init__.py +0 -1
- rapidata/rapidata_client/datapoints/_asset_uploader.py +71 -0
- rapidata/rapidata_client/datapoints/_datapoint.py +58 -171
- rapidata/rapidata_client/datapoints/_datapoint_uploader.py +95 -0
- rapidata/rapidata_client/datapoints/assets/__init__.py +0 -11
- rapidata/rapidata_client/datapoints/metadata/_media_asset_metadata.py +10 -7
- rapidata/rapidata_client/demographic/demographic_manager.py +21 -8
- rapidata/rapidata_client/exceptions/failed_upload_exception.py +0 -62
- rapidata/rapidata_client/order/_rapidata_order_builder.py +0 -10
- rapidata/rapidata_client/order/dataset/_rapidata_dataset.py +67 -187
- rapidata/rapidata_client/order/rapidata_order_manager.py +58 -124
- rapidata/rapidata_client/validation/rapidata_validation_set.py +9 -5
- rapidata/rapidata_client/validation/rapids/_validation_rapid_uploader.py +101 -0
- rapidata/rapidata_client/validation/rapids/box.py +35 -11
- rapidata/rapidata_client/validation/rapids/rapids.py +26 -128
- rapidata/rapidata_client/validation/rapids/rapids_manager.py +123 -104
- rapidata/rapidata_client/validation/validation_set_manager.py +25 -34
- rapidata/rapidata_client/workflow/_ranking_workflow.py +14 -17
- rapidata/rapidata_client/workflow/_select_words_workflow.py +3 -16
- rapidata/service/openapi_service.py +8 -3
- {rapidata-2.41.3.dist-info → rapidata-2.42.0.dist-info}/METADATA +1 -1
- {rapidata-2.41.3.dist-info → rapidata-2.42.0.dist-info}/RECORD +67 -58
- {rapidata-2.41.3.dist-info → rapidata-2.42.0.dist-info}/WHEEL +1 -1
- rapidata/rapidata_client/datapoints/assets/_base_asset.py +0 -13
- rapidata/rapidata_client/datapoints/assets/_media_asset.py +0 -318
- rapidata/rapidata_client/datapoints/assets/_multi_asset.py +0 -61
- rapidata/rapidata_client/datapoints/assets/_sessions.py +0 -40
- rapidata/rapidata_client/datapoints/assets/_text_asset.py +0 -34
- rapidata/rapidata_client/datapoints/assets/data_type_enum.py +0 -8
- rapidata/rapidata_client/order/dataset/_progress_tracker.py +0 -100
- {rapidata-2.41.3.dist-info → rapidata-2.42.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.existing_asset_input import ExistingAssetInput
|
|
21
|
+
from rapidata.api_client.models.file_asset_input import FileAssetInput
|
|
22
|
+
from rapidata.api_client.models.multi_asset_input import MultiAssetInput
|
|
23
|
+
from rapidata.api_client.models.text_asset_input import TextAssetInput
|
|
24
|
+
from rapidata.api_client.models.url_asset_input import UrlAssetInput
|
|
25
|
+
from pydantic import StrictStr, Field
|
|
26
|
+
from typing import Union, List, Set, Optional, Dict
|
|
27
|
+
from typing_extensions import Literal, Self
|
|
28
|
+
|
|
29
|
+
CREATEDATAPOINTMODELASSET_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput"]
|
|
30
|
+
|
|
31
|
+
class CreateDatapointModelAsset(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
The asset within the datapoint
|
|
34
|
+
"""
|
|
35
|
+
# data type: ExistingAssetInput
|
|
36
|
+
oneof_schema_1_validator: Optional[ExistingAssetInput] = None
|
|
37
|
+
# data type: FileAssetInput
|
|
38
|
+
oneof_schema_2_validator: Optional[FileAssetInput] = None
|
|
39
|
+
# data type: MultiAssetInput
|
|
40
|
+
oneof_schema_3_validator: Optional[MultiAssetInput] = None
|
|
41
|
+
# data type: TextAssetInput
|
|
42
|
+
oneof_schema_4_validator: Optional[TextAssetInput] = None
|
|
43
|
+
# data type: UrlAssetInput
|
|
44
|
+
oneof_schema_5_validator: Optional[UrlAssetInput] = None
|
|
45
|
+
actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]] = None
|
|
46
|
+
one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput" }
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
58
|
+
if args:
|
|
59
|
+
if len(args) > 1:
|
|
60
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
61
|
+
if kwargs:
|
|
62
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
63
|
+
super().__init__(actual_instance=args[0])
|
|
64
|
+
else:
|
|
65
|
+
super().__init__(**kwargs)
|
|
66
|
+
|
|
67
|
+
@field_validator('actual_instance')
|
|
68
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
69
|
+
instance = CreateDatapointModelAsset.model_construct()
|
|
70
|
+
error_messages = []
|
|
71
|
+
match = 0
|
|
72
|
+
# validate data type: ExistingAssetInput
|
|
73
|
+
if not isinstance(v, ExistingAssetInput):
|
|
74
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ExistingAssetInput`")
|
|
75
|
+
else:
|
|
76
|
+
match += 1
|
|
77
|
+
# validate data type: FileAssetInput
|
|
78
|
+
if not isinstance(v, FileAssetInput):
|
|
79
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetInput`")
|
|
80
|
+
else:
|
|
81
|
+
match += 1
|
|
82
|
+
# validate data type: MultiAssetInput
|
|
83
|
+
if not isinstance(v, MultiAssetInput):
|
|
84
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetInput`")
|
|
85
|
+
else:
|
|
86
|
+
match += 1
|
|
87
|
+
# validate data type: TextAssetInput
|
|
88
|
+
if not isinstance(v, TextAssetInput):
|
|
89
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetInput`")
|
|
90
|
+
else:
|
|
91
|
+
match += 1
|
|
92
|
+
# validate data type: UrlAssetInput
|
|
93
|
+
if not isinstance(v, UrlAssetInput):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `UrlAssetInput`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
97
|
+
if match > 1:
|
|
98
|
+
# more than 1 match
|
|
99
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateDatapointModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
100
|
+
elif match == 0:
|
|
101
|
+
# no match
|
|
102
|
+
raise ValueError("No match found when setting `actual_instance` in CreateDatapointModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
103
|
+
else:
|
|
104
|
+
return v
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
108
|
+
return cls.from_json(json.dumps(obj))
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_json(cls, json_str: str) -> Self:
|
|
112
|
+
"""Returns the object represented by the json string"""
|
|
113
|
+
instance = cls.model_construct()
|
|
114
|
+
error_messages = []
|
|
115
|
+
match = 0
|
|
116
|
+
|
|
117
|
+
# deserialize data into ExistingAssetInput
|
|
118
|
+
try:
|
|
119
|
+
instance.actual_instance = ExistingAssetInput.from_json(json_str)
|
|
120
|
+
match += 1
|
|
121
|
+
except (ValidationError, ValueError) as e:
|
|
122
|
+
error_messages.append(str(e))
|
|
123
|
+
# deserialize data into FileAssetInput
|
|
124
|
+
try:
|
|
125
|
+
instance.actual_instance = FileAssetInput.from_json(json_str)
|
|
126
|
+
match += 1
|
|
127
|
+
except (ValidationError, ValueError) as e:
|
|
128
|
+
error_messages.append(str(e))
|
|
129
|
+
# deserialize data into MultiAssetInput
|
|
130
|
+
try:
|
|
131
|
+
instance.actual_instance = MultiAssetInput.from_json(json_str)
|
|
132
|
+
match += 1
|
|
133
|
+
except (ValidationError, ValueError) as e:
|
|
134
|
+
error_messages.append(str(e))
|
|
135
|
+
# deserialize data into TextAssetInput
|
|
136
|
+
try:
|
|
137
|
+
instance.actual_instance = TextAssetInput.from_json(json_str)
|
|
138
|
+
match += 1
|
|
139
|
+
except (ValidationError, ValueError) as e:
|
|
140
|
+
error_messages.append(str(e))
|
|
141
|
+
# deserialize data into UrlAssetInput
|
|
142
|
+
try:
|
|
143
|
+
instance.actual_instance = UrlAssetInput.from_json(json_str)
|
|
144
|
+
match += 1
|
|
145
|
+
except (ValidationError, ValueError) as e:
|
|
146
|
+
error_messages.append(str(e))
|
|
147
|
+
|
|
148
|
+
if match > 1:
|
|
149
|
+
# more than 1 match
|
|
150
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateDatapointModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
151
|
+
elif match == 0:
|
|
152
|
+
# no match
|
|
153
|
+
raise ValueError("No match found when deserializing the JSON string into CreateDatapointModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
154
|
+
else:
|
|
155
|
+
return instance
|
|
156
|
+
|
|
157
|
+
def to_json(self) -> str:
|
|
158
|
+
"""Returns the JSON representation of the actual instance"""
|
|
159
|
+
if self.actual_instance is None:
|
|
160
|
+
return "null"
|
|
161
|
+
|
|
162
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
163
|
+
return self.actual_instance.to_json()
|
|
164
|
+
else:
|
|
165
|
+
return json.dumps(self.actual_instance)
|
|
166
|
+
|
|
167
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]]:
|
|
168
|
+
"""Returns the dict representation of the actual instance"""
|
|
169
|
+
if self.actual_instance is None:
|
|
170
|
+
return None
|
|
171
|
+
|
|
172
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
173
|
+
return self.actual_instance.to_dict()
|
|
174
|
+
else:
|
|
175
|
+
# primitive type
|
|
176
|
+
return self.actual_instance
|
|
177
|
+
|
|
178
|
+
def to_str(self) -> str:
|
|
179
|
+
"""Returns the string representation of the actual instance"""
|
|
180
|
+
return pprint.pformat(self.model_dump())
|
|
181
|
+
|
|
182
|
+
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from rapidata.api_client.models.classify_payload import ClassifyPayload
|
|
23
|
+
from rapidata.api_client.models.create_demographic_rapid_model_asset import CreateDemographicRapidModelAsset
|
|
23
24
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
24
25
|
from typing import Optional, Set
|
|
25
26
|
from typing_extensions import Self
|
|
@@ -31,7 +32,8 @@ class CreateDemographicRapidModel(BaseModel):
|
|
|
31
32
|
key: StrictStr = Field(description="The identifier of the demographic classification.")
|
|
32
33
|
payload: ClassifyPayload
|
|
33
34
|
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, description="Optional feature flags to apply to the rapid.", alias="featureFlags")
|
|
34
|
-
|
|
35
|
+
asset: Optional[CreateDemographicRapidModelAsset] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["key", "payload", "featureFlags", "asset"]
|
|
35
37
|
|
|
36
38
|
model_config = ConfigDict(
|
|
37
39
|
populate_by_name=True,
|
|
@@ -82,11 +84,19 @@ class CreateDemographicRapidModel(BaseModel):
|
|
|
82
84
|
if _item_feature_flags:
|
|
83
85
|
_items.append(_item_feature_flags.to_dict())
|
|
84
86
|
_dict['featureFlags'] = _items
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
88
|
+
if self.asset:
|
|
89
|
+
_dict['asset'] = self.asset.to_dict()
|
|
85
90
|
# set to None if feature_flags (nullable) is None
|
|
86
91
|
# and model_fields_set contains the field
|
|
87
92
|
if self.feature_flags is None and "feature_flags" in self.model_fields_set:
|
|
88
93
|
_dict['featureFlags'] = None
|
|
89
94
|
|
|
95
|
+
# set to None if asset (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.asset is None and "asset" in self.model_fields_set:
|
|
98
|
+
_dict['asset'] = None
|
|
99
|
+
|
|
90
100
|
return _dict
|
|
91
101
|
|
|
92
102
|
@classmethod
|
|
@@ -101,7 +111,8 @@ class CreateDemographicRapidModel(BaseModel):
|
|
|
101
111
|
_obj = cls.model_validate({
|
|
102
112
|
"key": obj.get("key"),
|
|
103
113
|
"payload": ClassifyPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
104
|
-
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
|
|
114
|
+
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
115
|
+
"asset": CreateDemographicRapidModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
|
|
105
116
|
})
|
|
106
117
|
return _obj
|
|
107
118
|
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.existing_asset_input import ExistingAssetInput
|
|
21
|
+
from rapidata.api_client.models.file_asset_input import FileAssetInput
|
|
22
|
+
from rapidata.api_client.models.multi_asset_input import MultiAssetInput
|
|
23
|
+
from rapidata.api_client.models.text_asset_input import TextAssetInput
|
|
24
|
+
from rapidata.api_client.models.url_asset_input import UrlAssetInput
|
|
25
|
+
from pydantic import StrictStr, Field
|
|
26
|
+
from typing import Union, List, Set, Optional, Dict
|
|
27
|
+
from typing_extensions import Literal, Self
|
|
28
|
+
|
|
29
|
+
CREATEDEMOGRAPHICRAPIDMODELASSET_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput"]
|
|
30
|
+
|
|
31
|
+
class CreateDemographicRapidModelAsset(BaseModel):
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
"""
|
|
35
|
+
# data type: ExistingAssetInput
|
|
36
|
+
oneof_schema_1_validator: Optional[ExistingAssetInput] = None
|
|
37
|
+
# data type: FileAssetInput
|
|
38
|
+
oneof_schema_2_validator: Optional[FileAssetInput] = None
|
|
39
|
+
# data type: MultiAssetInput
|
|
40
|
+
oneof_schema_3_validator: Optional[MultiAssetInput] = None
|
|
41
|
+
# data type: TextAssetInput
|
|
42
|
+
oneof_schema_4_validator: Optional[TextAssetInput] = None
|
|
43
|
+
# data type: UrlAssetInput
|
|
44
|
+
oneof_schema_5_validator: Optional[UrlAssetInput] = None
|
|
45
|
+
actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]] = None
|
|
46
|
+
one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput" }
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(
|
|
49
|
+
validate_assignment=True,
|
|
50
|
+
protected_namespaces=(),
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
58
|
+
if args:
|
|
59
|
+
if len(args) > 1:
|
|
60
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
61
|
+
if kwargs:
|
|
62
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
63
|
+
super().__init__(actual_instance=args[0])
|
|
64
|
+
else:
|
|
65
|
+
super().__init__(**kwargs)
|
|
66
|
+
|
|
67
|
+
@field_validator('actual_instance')
|
|
68
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
69
|
+
if v is None:
|
|
70
|
+
return v
|
|
71
|
+
|
|
72
|
+
instance = CreateDemographicRapidModelAsset.model_construct()
|
|
73
|
+
error_messages = []
|
|
74
|
+
match = 0
|
|
75
|
+
# validate data type: ExistingAssetInput
|
|
76
|
+
if not isinstance(v, ExistingAssetInput):
|
|
77
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ExistingAssetInput`")
|
|
78
|
+
else:
|
|
79
|
+
match += 1
|
|
80
|
+
# validate data type: FileAssetInput
|
|
81
|
+
if not isinstance(v, FileAssetInput):
|
|
82
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetInput`")
|
|
83
|
+
else:
|
|
84
|
+
match += 1
|
|
85
|
+
# validate data type: MultiAssetInput
|
|
86
|
+
if not isinstance(v, MultiAssetInput):
|
|
87
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetInput`")
|
|
88
|
+
else:
|
|
89
|
+
match += 1
|
|
90
|
+
# validate data type: TextAssetInput
|
|
91
|
+
if not isinstance(v, TextAssetInput):
|
|
92
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetInput`")
|
|
93
|
+
else:
|
|
94
|
+
match += 1
|
|
95
|
+
# validate data type: UrlAssetInput
|
|
96
|
+
if not isinstance(v, UrlAssetInput):
|
|
97
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `UrlAssetInput`")
|
|
98
|
+
else:
|
|
99
|
+
match += 1
|
|
100
|
+
if match > 1:
|
|
101
|
+
# more than 1 match
|
|
102
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateDemographicRapidModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
103
|
+
elif match == 0:
|
|
104
|
+
# no match
|
|
105
|
+
raise ValueError("No match found when setting `actual_instance` in CreateDemographicRapidModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
106
|
+
else:
|
|
107
|
+
return v
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
111
|
+
return cls.from_json(json.dumps(obj))
|
|
112
|
+
|
|
113
|
+
@classmethod
|
|
114
|
+
def from_json(cls, json_str: Optional[str]) -> Self:
|
|
115
|
+
"""Returns the object represented by the json string"""
|
|
116
|
+
instance = cls.model_construct()
|
|
117
|
+
if json_str is None:
|
|
118
|
+
return instance
|
|
119
|
+
|
|
120
|
+
error_messages = []
|
|
121
|
+
match = 0
|
|
122
|
+
|
|
123
|
+
# deserialize data into ExistingAssetInput
|
|
124
|
+
try:
|
|
125
|
+
instance.actual_instance = ExistingAssetInput.from_json(json_str)
|
|
126
|
+
match += 1
|
|
127
|
+
except (ValidationError, ValueError) as e:
|
|
128
|
+
error_messages.append(str(e))
|
|
129
|
+
# deserialize data into FileAssetInput
|
|
130
|
+
try:
|
|
131
|
+
instance.actual_instance = FileAssetInput.from_json(json_str)
|
|
132
|
+
match += 1
|
|
133
|
+
except (ValidationError, ValueError) as e:
|
|
134
|
+
error_messages.append(str(e))
|
|
135
|
+
# deserialize data into MultiAssetInput
|
|
136
|
+
try:
|
|
137
|
+
instance.actual_instance = MultiAssetInput.from_json(json_str)
|
|
138
|
+
match += 1
|
|
139
|
+
except (ValidationError, ValueError) as e:
|
|
140
|
+
error_messages.append(str(e))
|
|
141
|
+
# deserialize data into TextAssetInput
|
|
142
|
+
try:
|
|
143
|
+
instance.actual_instance = TextAssetInput.from_json(json_str)
|
|
144
|
+
match += 1
|
|
145
|
+
except (ValidationError, ValueError) as e:
|
|
146
|
+
error_messages.append(str(e))
|
|
147
|
+
# deserialize data into UrlAssetInput
|
|
148
|
+
try:
|
|
149
|
+
instance.actual_instance = UrlAssetInput.from_json(json_str)
|
|
150
|
+
match += 1
|
|
151
|
+
except (ValidationError, ValueError) as e:
|
|
152
|
+
error_messages.append(str(e))
|
|
153
|
+
|
|
154
|
+
if match > 1:
|
|
155
|
+
# more than 1 match
|
|
156
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateDemographicRapidModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
157
|
+
elif match == 0:
|
|
158
|
+
# no match
|
|
159
|
+
raise ValueError("No match found when deserializing the JSON string into CreateDemographicRapidModelAsset with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
160
|
+
else:
|
|
161
|
+
return instance
|
|
162
|
+
|
|
163
|
+
def to_json(self) -> str:
|
|
164
|
+
"""Returns the JSON representation of the actual instance"""
|
|
165
|
+
if self.actual_instance is None:
|
|
166
|
+
return "null"
|
|
167
|
+
|
|
168
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
169
|
+
return self.actual_instance.to_json()
|
|
170
|
+
else:
|
|
171
|
+
return json.dumps(self.actual_instance)
|
|
172
|
+
|
|
173
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]]:
|
|
174
|
+
"""Returns the dict representation of the actual instance"""
|
|
175
|
+
if self.actual_instance is None:
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
179
|
+
return self.actual_instance.to_dict()
|
|
180
|
+
else:
|
|
181
|
+
# primitive type
|
|
182
|
+
return self.actual_instance
|
|
183
|
+
|
|
184
|
+
def to_str(self) -> str:
|
|
185
|
+
"""Returns the string representation of the actual instance"""
|
|
186
|
+
return pprint.pformat(self.model_dump())
|
|
187
|
+
|
|
188
|
+
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.classify_payload import ClassifyPayload
|
|
23
|
+
from rapidata.api_client.models.create_demographic_rapid_model_asset import CreateDemographicRapidModelAsset
|
|
24
|
+
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class CreateDemographicRapidModelNew(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
The model for creating a demographic rapid.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
key: StrictStr = Field(description="The identifier of the demographic classification.")
|
|
33
|
+
payload: ClassifyPayload
|
|
34
|
+
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, description="Optional feature flags to apply to the rapid.", alias="featureFlags")
|
|
35
|
+
asset: Optional[CreateDemographicRapidModelAsset] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["key", "payload", "featureFlags", "asset"]
|
|
37
|
+
|
|
38
|
+
model_config = ConfigDict(
|
|
39
|
+
populate_by_name=True,
|
|
40
|
+
validate_assignment=True,
|
|
41
|
+
protected_namespaces=(),
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def to_str(self) -> str:
|
|
46
|
+
"""Returns the string representation of the model using alias"""
|
|
47
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
48
|
+
|
|
49
|
+
def to_json(self) -> str:
|
|
50
|
+
"""Returns the JSON representation of the model using alias"""
|
|
51
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
52
|
+
return json.dumps(self.to_dict())
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
56
|
+
"""Create an instance of CreateDemographicRapidModelNew from a JSON string"""
|
|
57
|
+
return cls.from_dict(json.loads(json_str))
|
|
58
|
+
|
|
59
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
60
|
+
"""Return the dictionary representation of the model using alias.
|
|
61
|
+
|
|
62
|
+
This has the following differences from calling pydantic's
|
|
63
|
+
`self.model_dump(by_alias=True)`:
|
|
64
|
+
|
|
65
|
+
* `None` is only added to the output dict for nullable fields that
|
|
66
|
+
were set at model initialization. Other fields with value `None`
|
|
67
|
+
are ignored.
|
|
68
|
+
"""
|
|
69
|
+
excluded_fields: Set[str] = set([
|
|
70
|
+
])
|
|
71
|
+
|
|
72
|
+
_dict = self.model_dump(
|
|
73
|
+
by_alias=True,
|
|
74
|
+
exclude=excluded_fields,
|
|
75
|
+
exclude_none=True,
|
|
76
|
+
)
|
|
77
|
+
# override the default output from pydantic by calling `to_dict()` of payload
|
|
78
|
+
if self.payload:
|
|
79
|
+
_dict['payload'] = self.payload.to_dict()
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
|
|
81
|
+
_items = []
|
|
82
|
+
if self.feature_flags:
|
|
83
|
+
for _item_feature_flags in self.feature_flags:
|
|
84
|
+
if _item_feature_flags:
|
|
85
|
+
_items.append(_item_feature_flags.to_dict())
|
|
86
|
+
_dict['featureFlags'] = _items
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
88
|
+
if self.asset:
|
|
89
|
+
_dict['asset'] = self.asset.to_dict()
|
|
90
|
+
# set to None if feature_flags (nullable) is None
|
|
91
|
+
# and model_fields_set contains the field
|
|
92
|
+
if self.feature_flags is None and "feature_flags" in self.model_fields_set:
|
|
93
|
+
_dict['featureFlags'] = None
|
|
94
|
+
|
|
95
|
+
# set to None if asset (nullable) is None
|
|
96
|
+
# and model_fields_set contains the field
|
|
97
|
+
if self.asset is None and "asset" in self.model_fields_set:
|
|
98
|
+
_dict['asset'] = None
|
|
99
|
+
|
|
100
|
+
return _dict
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
104
|
+
"""Create an instance of CreateDemographicRapidModelNew from a dict"""
|
|
105
|
+
if obj is None:
|
|
106
|
+
return None
|
|
107
|
+
|
|
108
|
+
if not isinstance(obj, dict):
|
|
109
|
+
return cls.model_validate(obj)
|
|
110
|
+
|
|
111
|
+
_obj = cls.model_validate({
|
|
112
|
+
"key": obj.get("key"),
|
|
113
|
+
"payload": ClassifyPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
114
|
+
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
115
|
+
"asset": CreateDemographicRapidModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
|
|
116
|
+
})
|
|
117
|
+
return _obj
|
|
118
|
+
|
|
119
|
+
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.create_sample_model_asset import CreateSampleModelAsset
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -27,7 +28,8 @@ class CreateSampleModel(BaseModel):
|
|
|
27
28
|
The model used to create a sample to a participant.
|
|
28
29
|
""" # noqa: E501
|
|
29
30
|
identifier: StrictStr = Field(description="The identifier used to correlate samples of different participants.")
|
|
30
|
-
|
|
31
|
+
asset: CreateSampleModelAsset
|
|
32
|
+
__properties: ClassVar[List[str]] = ["identifier", "asset"]
|
|
31
33
|
|
|
32
34
|
model_config = ConfigDict(
|
|
33
35
|
populate_by_name=True,
|
|
@@ -68,6 +70,9 @@ class CreateSampleModel(BaseModel):
|
|
|
68
70
|
exclude=excluded_fields,
|
|
69
71
|
exclude_none=True,
|
|
70
72
|
)
|
|
73
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
74
|
+
if self.asset:
|
|
75
|
+
_dict['asset'] = self.asset.to_dict()
|
|
71
76
|
return _dict
|
|
72
77
|
|
|
73
78
|
@classmethod
|
|
@@ -80,7 +85,8 @@ class CreateSampleModel(BaseModel):
|
|
|
80
85
|
return cls.model_validate(obj)
|
|
81
86
|
|
|
82
87
|
_obj = cls.model_validate({
|
|
83
|
-
"identifier": obj.get("identifier")
|
|
88
|
+
"identifier": obj.get("identifier"),
|
|
89
|
+
"asset": CreateSampleModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
|
|
84
90
|
})
|
|
85
91
|
return _obj
|
|
86
92
|
|