rapidata 2.41.2__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 -116
- rapidata/rapidata_client/settings/translation_behaviour.py +1 -1
- 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.2.dist-info → rapidata-2.42.0.dist-info}/METADATA +1 -1
- {rapidata-2.41.2.dist-info → rapidata-2.42.0.dist-info}/RECORD +68 -59
- {rapidata-2.41.2.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.2.dist-info → rapidata-2.42.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -19,14 +19,13 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, f
|
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.existing_asset_input import ExistingAssetInput
|
|
21
21
|
from rapidata.api_client.models.file_asset_input import FileAssetInput
|
|
22
|
-
from rapidata.api_client.models.reference_asset_input import ReferenceAssetInput
|
|
23
22
|
from rapidata.api_client.models.text_asset_input import TextAssetInput
|
|
24
23
|
from rapidata.api_client.models.url_asset_input import UrlAssetInput
|
|
25
24
|
from pydantic import StrictStr, Field
|
|
26
25
|
from typing import Union, List, Set, Optional, Dict
|
|
27
26
|
from typing_extensions import Literal, Self
|
|
28
27
|
|
|
29
|
-
MULTIASSETINPUTASSETSINNER_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "
|
|
28
|
+
MULTIASSETINPUTASSETSINNER_ONE_OF_SCHEMAS = ["ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput"]
|
|
30
29
|
|
|
31
30
|
class MultiAssetInputAssetsInner(BaseModel):
|
|
32
31
|
"""
|
|
@@ -38,14 +37,12 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
38
37
|
oneof_schema_2_validator: Optional[FileAssetInput] = None
|
|
39
38
|
# data type: MultiAssetInput
|
|
40
39
|
oneof_schema_3_validator: Optional[MultiAssetInput] = None
|
|
41
|
-
# data type: ReferenceAssetInput
|
|
42
|
-
oneof_schema_4_validator: Optional[ReferenceAssetInput] = None
|
|
43
40
|
# data type: TextAssetInput
|
|
44
|
-
|
|
41
|
+
oneof_schema_4_validator: Optional[TextAssetInput] = None
|
|
45
42
|
# data type: UrlAssetInput
|
|
46
|
-
|
|
47
|
-
actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
48
|
-
one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "
|
|
43
|
+
oneof_schema_5_validator: Optional[UrlAssetInput] = None
|
|
44
|
+
actual_instance: Optional[Union[ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]] = None
|
|
45
|
+
one_of_schemas: Set[str] = { "ExistingAssetInput", "FileAssetInput", "MultiAssetInput", "TextAssetInput", "UrlAssetInput" }
|
|
49
46
|
|
|
50
47
|
model_config = ConfigDict(
|
|
51
48
|
validate_assignment=True,
|
|
@@ -86,11 +83,6 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
86
83
|
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetInput`")
|
|
87
84
|
else:
|
|
88
85
|
match += 1
|
|
89
|
-
# validate data type: ReferenceAssetInput
|
|
90
|
-
if not isinstance(v, ReferenceAssetInput):
|
|
91
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `ReferenceAssetInput`")
|
|
92
|
-
else:
|
|
93
|
-
match += 1
|
|
94
86
|
# validate data type: TextAssetInput
|
|
95
87
|
if not isinstance(v, TextAssetInput):
|
|
96
88
|
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetInput`")
|
|
@@ -103,10 +95,10 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
103
95
|
match += 1
|
|
104
96
|
if match > 1:
|
|
105
97
|
# more than 1 match
|
|
106
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
98
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
107
99
|
elif match == 0:
|
|
108
100
|
# no match
|
|
109
|
-
raise ValueError("No match found when setting `actual_instance` in MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
101
|
+
raise ValueError("No match found when setting `actual_instance` in MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
110
102
|
else:
|
|
111
103
|
return v
|
|
112
104
|
|
|
@@ -139,12 +131,6 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
139
131
|
match += 1
|
|
140
132
|
except (ValidationError, ValueError) as e:
|
|
141
133
|
error_messages.append(str(e))
|
|
142
|
-
# deserialize data into ReferenceAssetInput
|
|
143
|
-
try:
|
|
144
|
-
instance.actual_instance = ReferenceAssetInput.from_json(json_str)
|
|
145
|
-
match += 1
|
|
146
|
-
except (ValidationError, ValueError) as e:
|
|
147
|
-
error_messages.append(str(e))
|
|
148
134
|
# deserialize data into TextAssetInput
|
|
149
135
|
try:
|
|
150
136
|
instance.actual_instance = TextAssetInput.from_json(json_str)
|
|
@@ -160,10 +146,10 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
160
146
|
|
|
161
147
|
if match > 1:
|
|
162
148
|
# more than 1 match
|
|
163
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
149
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
164
150
|
elif match == 0:
|
|
165
151
|
# no match
|
|
166
|
-
raise ValueError("No match found when deserializing the JSON string into MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
152
|
+
raise ValueError("No match found when deserializing the JSON string into MultiAssetInputAssetsInner with oneOf schemas: ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput. Details: " + ", ".join(error_messages))
|
|
167
153
|
else:
|
|
168
154
|
return instance
|
|
169
155
|
|
|
@@ -177,7 +163,7 @@ class MultiAssetInputAssetsInner(BaseModel):
|
|
|
177
163
|
else:
|
|
178
164
|
return json.dumps(self.actual_instance)
|
|
179
165
|
|
|
180
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], ExistingAssetInput, FileAssetInput, MultiAssetInput,
|
|
166
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ExistingAssetInput, FileAssetInput, MultiAssetInput, TextAssetInput, UrlAssetInput]]:
|
|
181
167
|
"""Returns the dict representation of the actual instance"""
|
|
182
168
|
if self.actual_instance is None:
|
|
183
169
|
return None
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.multi_asset_input_assets_inner import MultiAssetInputAssetsInner
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ class PromptAssetMetadataInput(BaseModel):
|
|
|
28
28
|
PromptAssetMetadataInput
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
t: StrictStr = Field(description="Discriminator value for PromptAssetMetadataInput", alias="_t")
|
|
31
|
-
asset:
|
|
31
|
+
asset: MultiAssetInputAssetsInner
|
|
32
32
|
identifier: Optional[StrictStr] = None
|
|
33
33
|
__properties: ClassVar[List[str]] = ["_t", "asset", "identifier"]
|
|
34
34
|
|
|
@@ -94,7 +94,7 @@ class PromptAssetMetadataInput(BaseModel):
|
|
|
94
94
|
|
|
95
95
|
_obj = cls.model_validate({
|
|
96
96
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'PromptAssetMetadataInput',
|
|
97
|
-
"asset":
|
|
97
|
+
"asset": MultiAssetInputAssetsInner.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
98
98
|
"identifier": obj.get("identifier")
|
|
99
99
|
})
|
|
100
100
|
return _obj
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -31,7 +32,8 @@ class ProxyFileWrapper(BaseModel):
|
|
|
31
32
|
content_length: Optional[StrictInt] = Field(default=None, alias="contentLength")
|
|
32
33
|
content_type: Optional[StrictStr] = Field(default=None, alias="contentType")
|
|
33
34
|
is_in_memory: Optional[StrictBool] = Field(default=None, alias="isInMemory")
|
|
34
|
-
|
|
35
|
+
metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
|
|
36
|
+
__properties: ClassVar[List[str]] = ["_t", "name", "contentLength", "contentType", "isInMemory", "metadata"]
|
|
35
37
|
|
|
36
38
|
@field_validator('t')
|
|
37
39
|
def t_validate_enum(cls, value):
|
|
@@ -81,6 +83,13 @@ class ProxyFileWrapper(BaseModel):
|
|
|
81
83
|
exclude=excluded_fields,
|
|
82
84
|
exclude_none=True,
|
|
83
85
|
)
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
|
|
87
|
+
_field_dict = {}
|
|
88
|
+
if self.metadata:
|
|
89
|
+
for _key_metadata in self.metadata:
|
|
90
|
+
if self.metadata[_key_metadata]:
|
|
91
|
+
_field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
|
|
92
|
+
_dict['metadata'] = _field_dict
|
|
84
93
|
# set to None if content_length (nullable) is None
|
|
85
94
|
# and model_fields_set contains the field
|
|
86
95
|
if self.content_length is None and "content_length" in self.model_fields_set:
|
|
@@ -107,7 +116,13 @@ class ProxyFileWrapper(BaseModel):
|
|
|
107
116
|
"name": obj.get("name"),
|
|
108
117
|
"contentLength": obj.get("contentLength"),
|
|
109
118
|
"contentType": obj.get("contentType"),
|
|
110
|
-
"isInMemory": obj.get("isInMemory")
|
|
119
|
+
"isInMemory": obj.get("isInMemory"),
|
|
120
|
+
"metadata": dict(
|
|
121
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
122
|
+
for _k, _v in obj["metadata"].items()
|
|
123
|
+
)
|
|
124
|
+
if obj.get("metadata") is not None
|
|
125
|
+
else None
|
|
111
126
|
})
|
|
112
127
|
return _obj
|
|
113
128
|
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictBytes, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union
|
|
22
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -27,12 +28,13 @@ class StreamFileWrapper(BaseModel):
|
|
|
27
28
|
StreamFileWrapper
|
|
28
29
|
""" # noqa: E501
|
|
29
30
|
t: StrictStr = Field(description="Discriminator value for StreamFileWrapper", alias="_t")
|
|
30
|
-
stream: Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]
|
|
31
|
+
stream: Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]]
|
|
31
32
|
name: StrictStr
|
|
32
33
|
content_length: Optional[StrictInt] = Field(default=None, alias="contentLength")
|
|
33
34
|
content_type: Optional[StrictStr] = Field(default=None, alias="contentType")
|
|
34
35
|
is_in_memory: Optional[StrictBool] = Field(default=None, alias="isInMemory")
|
|
35
|
-
|
|
36
|
+
metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
|
|
37
|
+
__properties: ClassVar[List[str]] = ["_t", "stream", "name", "contentLength", "contentType", "isInMemory", "metadata"]
|
|
36
38
|
|
|
37
39
|
@field_validator('t')
|
|
38
40
|
def t_validate_enum(cls, value):
|
|
@@ -72,8 +74,10 @@ class StreamFileWrapper(BaseModel):
|
|
|
72
74
|
were set at model initialization. Other fields with value `None`
|
|
73
75
|
are ignored.
|
|
74
76
|
* OpenAPI `readOnly` fields are excluded.
|
|
77
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
75
78
|
"""
|
|
76
79
|
excluded_fields: Set[str] = set([
|
|
80
|
+
"content_length",
|
|
77
81
|
"is_in_memory",
|
|
78
82
|
])
|
|
79
83
|
|
|
@@ -82,6 +86,18 @@ class StreamFileWrapper(BaseModel):
|
|
|
82
86
|
exclude=excluded_fields,
|
|
83
87
|
exclude_none=True,
|
|
84
88
|
)
|
|
89
|
+
# override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
|
|
90
|
+
_field_dict = {}
|
|
91
|
+
if self.metadata:
|
|
92
|
+
for _key_metadata in self.metadata:
|
|
93
|
+
if self.metadata[_key_metadata]:
|
|
94
|
+
_field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
|
|
95
|
+
_dict['metadata'] = _field_dict
|
|
96
|
+
# set to None if stream (nullable) is None
|
|
97
|
+
# and model_fields_set contains the field
|
|
98
|
+
if self.stream is None and "stream" in self.model_fields_set:
|
|
99
|
+
_dict['stream'] = None
|
|
100
|
+
|
|
85
101
|
# set to None if content_length (nullable) is None
|
|
86
102
|
# and model_fields_set contains the field
|
|
87
103
|
if self.content_length is None and "content_length" in self.model_fields_set:
|
|
@@ -109,7 +125,13 @@ class StreamFileWrapper(BaseModel):
|
|
|
109
125
|
"name": obj.get("name"),
|
|
110
126
|
"contentLength": obj.get("contentLength"),
|
|
111
127
|
"contentType": obj.get("contentType"),
|
|
112
|
-
"isInMemory": obj.get("isInMemory")
|
|
128
|
+
"isInMemory": obj.get("isInMemory"),
|
|
129
|
+
"metadata": dict(
|
|
130
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
131
|
+
for _k, _v in obj["metadata"].items()
|
|
132
|
+
)
|
|
133
|
+
if obj.get("metadata") is not None
|
|
134
|
+
else None
|
|
113
135
|
})
|
|
114
136
|
return _obj
|
|
115
137
|
|
|
@@ -19,7 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.create_demographic_rapid_model_asset import CreateDemographicRapidModelAsset
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ class SubmitPromptModel(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
identifier: StrictStr = Field(description="An identifier associated to the prompt")
|
|
31
31
|
prompt: Optional[StrictStr] = Field(default=None, description="The prompt")
|
|
32
|
-
prompt_asset: Optional[
|
|
32
|
+
prompt_asset: Optional[CreateDemographicRapidModelAsset] = Field(default=None, alias="promptAsset")
|
|
33
33
|
tags: Optional[List[StrictStr]] = Field(default=None, description="The tags of a given prompt")
|
|
34
34
|
__properties: ClassVar[List[str]] = ["identifier", "prompt", "promptAsset", "tags"]
|
|
35
35
|
|
|
@@ -104,7 +104,7 @@ class SubmitPromptModel(BaseModel):
|
|
|
104
104
|
_obj = cls.model_validate({
|
|
105
105
|
"identifier": obj.get("identifier"),
|
|
106
106
|
"prompt": obj.get("prompt"),
|
|
107
|
-
"promptAsset":
|
|
107
|
+
"promptAsset": CreateDemographicRapidModelAsset.from_dict(obj["promptAsset"]) if obj.get("promptAsset") is not None else None,
|
|
108
108
|
"tags": obj.get("tags")
|
|
109
109
|
})
|
|
110
110
|
return _obj
|
|
@@ -27,7 +27,7 @@ class TextMetadata(BaseModel):
|
|
|
27
27
|
TextMetadata
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for TextMetadata", alias="_t")
|
|
30
|
-
text: StrictStr
|
|
30
|
+
text: Optional[StrictStr] = None
|
|
31
31
|
visibilities: Optional[List[StrictStr]] = None
|
|
32
32
|
__properties: ClassVar[List[str]] = ["_t", "text", "visibilities"]
|
|
33
33
|
|
|
@@ -88,6 +88,11 @@ class TextMetadata(BaseModel):
|
|
|
88
88
|
exclude=excluded_fields,
|
|
89
89
|
exclude_none=True,
|
|
90
90
|
)
|
|
91
|
+
# set to None if text (nullable) is None
|
|
92
|
+
# and model_fields_set contains the field
|
|
93
|
+
if self.text is None and "text" in self.model_fields_set:
|
|
94
|
+
_dict['text'] = None
|
|
95
|
+
|
|
91
96
|
return _dict
|
|
92
97
|
|
|
93
98
|
@classmethod
|
|
@@ -18,7 +18,7 @@ import re # noqa: F401
|
|
|
18
18
|
import json
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
-
from typing import Any, ClassVar, Dict, List
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from typing import Optional, Set
|
|
23
23
|
from typing_extensions import Self
|
|
24
24
|
|
|
@@ -27,7 +27,7 @@ class TextMetadataModel(BaseModel):
|
|
|
27
27
|
TextMetadataModel
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for TextMetadata", alias="_t")
|
|
30
|
-
text: StrictStr
|
|
30
|
+
text: Optional[StrictStr] = None
|
|
31
31
|
__properties: ClassVar[List[str]] = ["_t", "text"]
|
|
32
32
|
|
|
33
33
|
@field_validator('t')
|
|
@@ -76,6 +76,11 @@ class TextMetadataModel(BaseModel):
|
|
|
76
76
|
exclude=excluded_fields,
|
|
77
77
|
exclude_none=True,
|
|
78
78
|
)
|
|
79
|
+
# set to None if text (nullable) is None
|
|
80
|
+
# and model_fields_set contains the field
|
|
81
|
+
if self.text is None and "text" in self.model_fields_set:
|
|
82
|
+
_dict['text'] = None
|
|
83
|
+
|
|
79
84
|
return _dict
|
|
80
85
|
|
|
81
86
|
@classmethod
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class UploadFileFromUrlResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
UploadFileFromUrlResult
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
file_name: StrictStr = Field(alias="fileName")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["fileName"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of UploadFileFromUrlResult from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of UploadFileFromUrlResult from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"fileName": obj.get("fileName")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
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
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class UploadFileResult(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
UploadFileResult
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
file_name: StrictStr = Field(alias="fileName")
|
|
30
|
+
__properties: ClassVar[List[str]] = ["fileName"]
|
|
31
|
+
|
|
32
|
+
model_config = ConfigDict(
|
|
33
|
+
populate_by_name=True,
|
|
34
|
+
validate_assignment=True,
|
|
35
|
+
protected_namespaces=(),
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def to_str(self) -> str:
|
|
40
|
+
"""Returns the string representation of the model using alias"""
|
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
42
|
+
|
|
43
|
+
def to_json(self) -> str:
|
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
46
|
+
return json.dumps(self.to_dict())
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
50
|
+
"""Create an instance of UploadFileResult from a JSON string"""
|
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
|
52
|
+
|
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
|
55
|
+
|
|
56
|
+
This has the following differences from calling pydantic's
|
|
57
|
+
`self.model_dump(by_alias=True)`:
|
|
58
|
+
|
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
|
60
|
+
were set at model initialization. Other fields with value `None`
|
|
61
|
+
are ignored.
|
|
62
|
+
"""
|
|
63
|
+
excluded_fields: Set[str] = set([
|
|
64
|
+
])
|
|
65
|
+
|
|
66
|
+
_dict = self.model_dump(
|
|
67
|
+
by_alias=True,
|
|
68
|
+
exclude=excluded_fields,
|
|
69
|
+
exclude_none=True,
|
|
70
|
+
)
|
|
71
|
+
return _dict
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
75
|
+
"""Create an instance of UploadFileResult from a dict"""
|
|
76
|
+
if obj is None:
|
|
77
|
+
return None
|
|
78
|
+
|
|
79
|
+
if not isinstance(obj, dict):
|
|
80
|
+
return cls.model_validate(obj)
|
|
81
|
+
|
|
82
|
+
_obj = cls.model_validate({
|
|
83
|
+
"fileName": obj.get("fileName")
|
|
84
|
+
})
|
|
85
|
+
return _obj
|
|
86
|
+
|
|
87
|
+
|
|
@@ -19,6 +19,7 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -31,7 +32,10 @@ class ZipEntryFileWrapper(BaseModel):
|
|
|
31
32
|
content_length: Optional[StrictInt] = Field(default=None, alias="contentLength")
|
|
32
33
|
content_type: Optional[StrictStr] = Field(default=None, alias="contentType")
|
|
33
34
|
is_in_memory: Optional[StrictBool] = Field(default=None, alias="isInMemory")
|
|
34
|
-
|
|
35
|
+
metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
|
|
36
|
+
creator_id: Optional[StrictStr] = Field(default=None, alias="creatorId")
|
|
37
|
+
creator_mail: Optional[StrictStr] = Field(default=None, alias="creatorMail")
|
|
38
|
+
__properties: ClassVar[List[str]] = ["_t", "name", "contentLength", "contentType", "isInMemory", "metadata", "creatorId", "creatorMail"]
|
|
35
39
|
|
|
36
40
|
@field_validator('t')
|
|
37
41
|
def t_validate_enum(cls, value):
|
|
@@ -74,12 +78,14 @@ class ZipEntryFileWrapper(BaseModel):
|
|
|
74
78
|
* OpenAPI `readOnly` fields are excluded.
|
|
75
79
|
* OpenAPI `readOnly` fields are excluded.
|
|
76
80
|
* OpenAPI `readOnly` fields are excluded.
|
|
81
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
77
82
|
"""
|
|
78
83
|
excluded_fields: Set[str] = set([
|
|
79
84
|
"name",
|
|
80
85
|
"content_length",
|
|
81
86
|
"content_type",
|
|
82
87
|
"is_in_memory",
|
|
88
|
+
"metadata",
|
|
83
89
|
])
|
|
84
90
|
|
|
85
91
|
_dict = self.model_dump(
|
|
@@ -87,6 +93,13 @@ class ZipEntryFileWrapper(BaseModel):
|
|
|
87
93
|
exclude=excluded_fields,
|
|
88
94
|
exclude_none=True,
|
|
89
95
|
)
|
|
96
|
+
# override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
|
|
97
|
+
_field_dict = {}
|
|
98
|
+
if self.metadata:
|
|
99
|
+
for _key_metadata in self.metadata:
|
|
100
|
+
if self.metadata[_key_metadata]:
|
|
101
|
+
_field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
|
|
102
|
+
_dict['metadata'] = _field_dict
|
|
90
103
|
# set to None if content_length (nullable) is None
|
|
91
104
|
# and model_fields_set contains the field
|
|
92
105
|
if self.content_length is None and "content_length" in self.model_fields_set:
|
|
@@ -97,6 +110,16 @@ class ZipEntryFileWrapper(BaseModel):
|
|
|
97
110
|
if self.content_type is None and "content_type" in self.model_fields_set:
|
|
98
111
|
_dict['contentType'] = None
|
|
99
112
|
|
|
113
|
+
# set to None if creator_id (nullable) is None
|
|
114
|
+
# and model_fields_set contains the field
|
|
115
|
+
if self.creator_id is None and "creator_id" in self.model_fields_set:
|
|
116
|
+
_dict['creatorId'] = None
|
|
117
|
+
|
|
118
|
+
# set to None if creator_mail (nullable) is None
|
|
119
|
+
# and model_fields_set contains the field
|
|
120
|
+
if self.creator_mail is None and "creator_mail" in self.model_fields_set:
|
|
121
|
+
_dict['creatorMail'] = None
|
|
122
|
+
|
|
100
123
|
return _dict
|
|
101
124
|
|
|
102
125
|
@classmethod
|
|
@@ -113,7 +136,15 @@ class ZipEntryFileWrapper(BaseModel):
|
|
|
113
136
|
"name": obj.get("name"),
|
|
114
137
|
"contentLength": obj.get("contentLength"),
|
|
115
138
|
"contentType": obj.get("contentType"),
|
|
116
|
-
"isInMemory": obj.get("isInMemory")
|
|
139
|
+
"isInMemory": obj.get("isInMemory"),
|
|
140
|
+
"metadata": dict(
|
|
141
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
142
|
+
for _k, _v in obj["metadata"].items()
|
|
143
|
+
)
|
|
144
|
+
if obj.get("metadata") is not None
|
|
145
|
+
else None,
|
|
146
|
+
"creatorId": obj.get("creatorId"),
|
|
147
|
+
"creatorMail": obj.get("creatorMail")
|
|
117
148
|
})
|
|
118
149
|
return _obj
|
|
119
150
|
|