rapidata 2.23.1__py3-none-any.whl → 2.24.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 +2 -0
- rapidata/api_client/__init__.py +10 -1
- rapidata/api_client/api/validation_set_api.py +3 -3
- rapidata/api_client/models/__init__.py +10 -1
- rapidata/api_client/models/asset_metadata.py +104 -0
- rapidata/api_client/models/asset_metadata_asset.py +170 -0
- rapidata/api_client/models/asset_metadata_model.py +102 -0
- rapidata/api_client/models/asset_metadata_model_asset.py +170 -0
- rapidata/api_client/models/compare_workflow_config_metadata_value.py +33 -17
- rapidata/api_client/models/create_datapoint_from_files_model_metadata_inner.py +25 -11
- rapidata/api_client/models/datapoint.py +3 -3
- rapidata/api_client/models/datapoint_model.py +3 -3
- rapidata/api_client/models/file_asset.py +17 -12
- rapidata/api_client/models/file_asset_model.py +3 -1
- rapidata/api_client/models/file_asset_model_metadata_value.py +35 -19
- rapidata/api_client/models/get_compare_workflow_results_result.py +3 -3
- rapidata/api_client/models/get_datapoint_by_id_result.py +3 -3
- rapidata/api_client/models/get_rapid_responses_result.py +3 -3
- rapidata/api_client/models/get_workflow_results_result.py +3 -3
- rapidata/api_client/models/multi_asset.py +17 -12
- rapidata/api_client/models/multi_asset_model.py +4 -4
- rapidata/api_client/models/null_asset.py +16 -9
- rapidata/api_client/models/null_asset_model.py +3 -1
- rapidata/api_client/models/prompt_asset_metadata_input.py +102 -0
- rapidata/api_client/models/text_asset.py +17 -10
- rapidata/api_client/models/text_asset_model.py +3 -1
- rapidata/api_client/models/url_asset_input.py +100 -0
- rapidata/api_client_README.md +11 -2
- rapidata/rapidata_client/filter/__init__.py +1 -0
- rapidata/rapidata_client/filter/new_user_filter.py +13 -0
- rapidata/rapidata_client/metadata/__init__.py +1 -0
- rapidata/rapidata_client/metadata/_media_asset_metadata.py +15 -0
- rapidata/rapidata_client/order/rapidata_order_manager.py +37 -17
- {rapidata-2.23.1.dist-info → rapidata-2.24.0.dist-info}/METADATA +1 -1
- {rapidata-2.23.1.dist-info → rapidata-2.24.0.dist-info}/RECORD +37 -29
- {rapidata-2.23.1.dist-info → rapidata-2.24.0.dist-info}/LICENSE +0 -0
- {rapidata-2.23.1.dist-info → rapidata-2.24.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,170 @@
|
|
|
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 pydantic import StrictStr, Field
|
|
21
|
+
from typing import Union, List, Set, Optional, Dict
|
|
22
|
+
from typing_extensions import Literal, Self
|
|
23
|
+
|
|
24
|
+
ASSETMETADATAMODELASSET_ONE_OF_SCHEMAS = ["FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel"]
|
|
25
|
+
|
|
26
|
+
class AssetMetadataModelAsset(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
AssetMetadataModelAsset
|
|
29
|
+
"""
|
|
30
|
+
# data type: FileAssetModel
|
|
31
|
+
oneof_schema_1_validator: Optional[FileAssetModel] = None
|
|
32
|
+
# data type: MultiAssetModel
|
|
33
|
+
oneof_schema_2_validator: Optional[MultiAssetModel] = None
|
|
34
|
+
# data type: NullAssetModel
|
|
35
|
+
oneof_schema_3_validator: Optional[NullAssetModel] = None
|
|
36
|
+
# data type: TextAssetModel
|
|
37
|
+
oneof_schema_4_validator: Optional[TextAssetModel] = None
|
|
38
|
+
actual_instance: Optional[Union[FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]] = None
|
|
39
|
+
one_of_schemas: Set[str] = { "FileAssetModel", "MultiAssetModel", "NullAssetModel", "TextAssetModel" }
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
51
|
+
if args:
|
|
52
|
+
if len(args) > 1:
|
|
53
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
54
|
+
if kwargs:
|
|
55
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
56
|
+
super().__init__(actual_instance=args[0])
|
|
57
|
+
else:
|
|
58
|
+
super().__init__(**kwargs)
|
|
59
|
+
|
|
60
|
+
@field_validator('actual_instance')
|
|
61
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
62
|
+
instance = AssetMetadataModelAsset.model_construct()
|
|
63
|
+
error_messages = []
|
|
64
|
+
match = 0
|
|
65
|
+
# validate data type: FileAssetModel
|
|
66
|
+
if not isinstance(v, FileAssetModel):
|
|
67
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAssetModel`")
|
|
68
|
+
else:
|
|
69
|
+
match += 1
|
|
70
|
+
# validate data type: MultiAssetModel
|
|
71
|
+
if not isinstance(v, MultiAssetModel):
|
|
72
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAssetModel`")
|
|
73
|
+
else:
|
|
74
|
+
match += 1
|
|
75
|
+
# validate data type: NullAssetModel
|
|
76
|
+
if not isinstance(v, NullAssetModel):
|
|
77
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NullAssetModel`")
|
|
78
|
+
else:
|
|
79
|
+
match += 1
|
|
80
|
+
# validate data type: TextAssetModel
|
|
81
|
+
if not isinstance(v, TextAssetModel):
|
|
82
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAssetModel`")
|
|
83
|
+
else:
|
|
84
|
+
match += 1
|
|
85
|
+
if match > 1:
|
|
86
|
+
# more than 1 match
|
|
87
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in AssetMetadataModelAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
88
|
+
elif match == 0:
|
|
89
|
+
# no match
|
|
90
|
+
raise ValueError("No match found when setting `actual_instance` in AssetMetadataModelAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
91
|
+
else:
|
|
92
|
+
return v
|
|
93
|
+
|
|
94
|
+
@classmethod
|
|
95
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
96
|
+
return cls.from_json(json.dumps(obj))
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_json(cls, json_str: str) -> Self:
|
|
100
|
+
"""Returns the object represented by the json string"""
|
|
101
|
+
instance = cls.model_construct()
|
|
102
|
+
error_messages = []
|
|
103
|
+
match = 0
|
|
104
|
+
|
|
105
|
+
# deserialize data into FileAssetModel
|
|
106
|
+
try:
|
|
107
|
+
instance.actual_instance = FileAssetModel.from_json(json_str)
|
|
108
|
+
match += 1
|
|
109
|
+
except (ValidationError, ValueError) as e:
|
|
110
|
+
error_messages.append(str(e))
|
|
111
|
+
# deserialize data into MultiAssetModel
|
|
112
|
+
try:
|
|
113
|
+
instance.actual_instance = MultiAssetModel.from_json(json_str)
|
|
114
|
+
match += 1
|
|
115
|
+
except (ValidationError, ValueError) as e:
|
|
116
|
+
error_messages.append(str(e))
|
|
117
|
+
# deserialize data into NullAssetModel
|
|
118
|
+
try:
|
|
119
|
+
instance.actual_instance = NullAssetModel.from_json(json_str)
|
|
120
|
+
match += 1
|
|
121
|
+
except (ValidationError, ValueError) as e:
|
|
122
|
+
error_messages.append(str(e))
|
|
123
|
+
# deserialize data into TextAssetModel
|
|
124
|
+
try:
|
|
125
|
+
instance.actual_instance = TextAssetModel.from_json(json_str)
|
|
126
|
+
match += 1
|
|
127
|
+
except (ValidationError, ValueError) as e:
|
|
128
|
+
error_messages.append(str(e))
|
|
129
|
+
|
|
130
|
+
if match > 1:
|
|
131
|
+
# more than 1 match
|
|
132
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into AssetMetadataModelAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
133
|
+
elif match == 0:
|
|
134
|
+
# no match
|
|
135
|
+
raise ValueError("No match found when deserializing the JSON string into AssetMetadataModelAsset with oneOf schemas: FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel. Details: " + ", ".join(error_messages))
|
|
136
|
+
else:
|
|
137
|
+
return instance
|
|
138
|
+
|
|
139
|
+
def to_json(self) -> str:
|
|
140
|
+
"""Returns the JSON representation of the actual instance"""
|
|
141
|
+
if self.actual_instance is None:
|
|
142
|
+
return "null"
|
|
143
|
+
|
|
144
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
145
|
+
return self.actual_instance.to_json()
|
|
146
|
+
else:
|
|
147
|
+
return json.dumps(self.actual_instance)
|
|
148
|
+
|
|
149
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], FileAssetModel, MultiAssetModel, NullAssetModel, TextAssetModel]]:
|
|
150
|
+
"""Returns the dict representation of the actual instance"""
|
|
151
|
+
if self.actual_instance is None:
|
|
152
|
+
return None
|
|
153
|
+
|
|
154
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
155
|
+
return self.actual_instance.to_dict()
|
|
156
|
+
else:
|
|
157
|
+
# primitive type
|
|
158
|
+
return self.actual_instance
|
|
159
|
+
|
|
160
|
+
def to_str(self) -> str:
|
|
161
|
+
"""Returns the string representation of the actual instance"""
|
|
162
|
+
return pprint.pformat(self.model_dump())
|
|
163
|
+
|
|
164
|
+
from rapidata.api_client.models.file_asset_model import FileAssetModel
|
|
165
|
+
from rapidata.api_client.models.multi_asset_model import MultiAssetModel
|
|
166
|
+
from rapidata.api_client.models.null_asset_model import NullAssetModel
|
|
167
|
+
from rapidata.api_client.models.text_asset_model import TextAssetModel
|
|
168
|
+
# TODO: Rewrite to not use raise_errors
|
|
169
|
+
AssetMetadataModelAsset.model_rebuild(raise_errors=False)
|
|
170
|
+
|
|
@@ -30,32 +30,34 @@ from pydantic import StrictStr, Field
|
|
|
30
30
|
from typing import Union, List, Set, Optional, Dict
|
|
31
31
|
from typing_extensions import Literal, Self
|
|
32
32
|
|
|
33
|
-
COMPAREWORKFLOWCONFIGMETADATAVALUE_ONE_OF_SCHEMAS = ["ClassificationMetadata", "CountMetadata", "ImageDimensionMetadata", "LocationMetadata", "OriginalFilenameMetadata", "PromptMetadata", "SourceUrlMetadata", "TextMetadata", "TranscriptionMetadata"]
|
|
33
|
+
COMPAREWORKFLOWCONFIGMETADATAVALUE_ONE_OF_SCHEMAS = ["AssetMetadata", "ClassificationMetadata", "CountMetadata", "ImageDimensionMetadata", "LocationMetadata", "OriginalFilenameMetadata", "PromptMetadata", "SourceUrlMetadata", "TextMetadata", "TranscriptionMetadata"]
|
|
34
34
|
|
|
35
35
|
class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
36
36
|
"""
|
|
37
37
|
CompareWorkflowConfigMetadataValue
|
|
38
38
|
"""
|
|
39
|
+
# data type: AssetMetadata
|
|
40
|
+
oneof_schema_1_validator: Optional[AssetMetadata] = None
|
|
39
41
|
# data type: ClassificationMetadata
|
|
40
|
-
|
|
42
|
+
oneof_schema_2_validator: Optional[ClassificationMetadata] = None
|
|
41
43
|
# data type: CountMetadata
|
|
42
|
-
|
|
44
|
+
oneof_schema_3_validator: Optional[CountMetadata] = None
|
|
43
45
|
# data type: ImageDimensionMetadata
|
|
44
|
-
|
|
46
|
+
oneof_schema_4_validator: Optional[ImageDimensionMetadata] = None
|
|
45
47
|
# data type: LocationMetadata
|
|
46
|
-
|
|
48
|
+
oneof_schema_5_validator: Optional[LocationMetadata] = None
|
|
47
49
|
# data type: OriginalFilenameMetadata
|
|
48
|
-
|
|
50
|
+
oneof_schema_6_validator: Optional[OriginalFilenameMetadata] = None
|
|
49
51
|
# data type: PromptMetadata
|
|
50
|
-
|
|
52
|
+
oneof_schema_7_validator: Optional[PromptMetadata] = None
|
|
51
53
|
# data type: SourceUrlMetadata
|
|
52
|
-
|
|
54
|
+
oneof_schema_8_validator: Optional[SourceUrlMetadata] = None
|
|
53
55
|
# data type: TextMetadata
|
|
54
|
-
|
|
56
|
+
oneof_schema_9_validator: Optional[TextMetadata] = None
|
|
55
57
|
# data type: TranscriptionMetadata
|
|
56
|
-
|
|
57
|
-
actual_instance: Optional[Union[ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata]] = None
|
|
58
|
-
one_of_schemas: Set[str] = { "ClassificationMetadata", "CountMetadata", "ImageDimensionMetadata", "LocationMetadata", "OriginalFilenameMetadata", "PromptMetadata", "SourceUrlMetadata", "TextMetadata", "TranscriptionMetadata" }
|
|
58
|
+
oneof_schema_10_validator: Optional[TranscriptionMetadata] = None
|
|
59
|
+
actual_instance: Optional[Union[AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata]] = None
|
|
60
|
+
one_of_schemas: Set[str] = { "AssetMetadata", "ClassificationMetadata", "CountMetadata", "ImageDimensionMetadata", "LocationMetadata", "OriginalFilenameMetadata", "PromptMetadata", "SourceUrlMetadata", "TextMetadata", "TranscriptionMetadata" }
|
|
59
61
|
|
|
60
62
|
model_config = ConfigDict(
|
|
61
63
|
validate_assignment=True,
|
|
@@ -81,6 +83,11 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
81
83
|
instance = CompareWorkflowConfigMetadataValue.model_construct()
|
|
82
84
|
error_messages = []
|
|
83
85
|
match = 0
|
|
86
|
+
# validate data type: AssetMetadata
|
|
87
|
+
if not isinstance(v, AssetMetadata):
|
|
88
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AssetMetadata`")
|
|
89
|
+
else:
|
|
90
|
+
match += 1
|
|
84
91
|
# validate data type: ClassificationMetadata
|
|
85
92
|
if not isinstance(v, ClassificationMetadata):
|
|
86
93
|
error_messages.append(f"Error! Input type `{type(v)}` is not `ClassificationMetadata`")
|
|
@@ -128,10 +135,10 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
128
135
|
match += 1
|
|
129
136
|
if match > 1:
|
|
130
137
|
# more than 1 match
|
|
131
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowConfigMetadataValue with oneOf schemas: ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
138
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CompareWorkflowConfigMetadataValue with oneOf schemas: AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
132
139
|
elif match == 0:
|
|
133
140
|
# no match
|
|
134
|
-
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowConfigMetadataValue with oneOf schemas: ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
141
|
+
raise ValueError("No match found when setting `actual_instance` in CompareWorkflowConfigMetadataValue with oneOf schemas: AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
135
142
|
else:
|
|
136
143
|
return v
|
|
137
144
|
|
|
@@ -146,6 +153,12 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
146
153
|
error_messages = []
|
|
147
154
|
match = 0
|
|
148
155
|
|
|
156
|
+
# deserialize data into AssetMetadata
|
|
157
|
+
try:
|
|
158
|
+
instance.actual_instance = AssetMetadata.from_json(json_str)
|
|
159
|
+
match += 1
|
|
160
|
+
except (ValidationError, ValueError) as e:
|
|
161
|
+
error_messages.append(str(e))
|
|
149
162
|
# deserialize data into ClassificationMetadata
|
|
150
163
|
try:
|
|
151
164
|
instance.actual_instance = ClassificationMetadata.from_json(json_str)
|
|
@@ -203,10 +216,10 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
203
216
|
|
|
204
217
|
if match > 1:
|
|
205
218
|
# more than 1 match
|
|
206
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CompareWorkflowConfigMetadataValue with oneOf schemas: ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
219
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CompareWorkflowConfigMetadataValue with oneOf schemas: AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
207
220
|
elif match == 0:
|
|
208
221
|
# no match
|
|
209
|
-
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowConfigMetadataValue with oneOf schemas: ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
222
|
+
raise ValueError("No match found when deserializing the JSON string into CompareWorkflowConfigMetadataValue with oneOf schemas: AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata. Details: " + ", ".join(error_messages))
|
|
210
223
|
else:
|
|
211
224
|
return instance
|
|
212
225
|
|
|
@@ -220,7 +233,7 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
220
233
|
else:
|
|
221
234
|
return json.dumps(self.actual_instance)
|
|
222
235
|
|
|
223
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata]]:
|
|
236
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AssetMetadata, ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata]]:
|
|
224
237
|
"""Returns the dict representation of the actual instance"""
|
|
225
238
|
if self.actual_instance is None:
|
|
226
239
|
return None
|
|
@@ -235,4 +248,7 @@ class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
|
235
248
|
"""Returns the string representation of the actual instance"""
|
|
236
249
|
return pprint.pformat(self.model_dump())
|
|
237
250
|
|
|
251
|
+
from rapidata.api_client.models.asset_metadata import AssetMetadata
|
|
252
|
+
# TODO: Rewrite to not use raise_errors
|
|
253
|
+
CompareWorkflowConfigMetadataValue.model_rebuild(raise_errors=False)
|
|
238
254
|
|
|
@@ -18,6 +18,7 @@ import pprint
|
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.private_text_metadata_input import PrivateTextMetadataInput
|
|
21
|
+
from rapidata.api_client.models.prompt_asset_metadata_input import PromptAssetMetadataInput
|
|
21
22
|
from rapidata.api_client.models.prompt_metadata_input import PromptMetadataInput
|
|
22
23
|
from rapidata.api_client.models.public_text_metadata_input import PublicTextMetadataInput
|
|
23
24
|
from rapidata.api_client.models.transcription_metadata_input import TranscriptionMetadataInput
|
|
@@ -25,7 +26,7 @@ from pydantic import StrictStr, Field
|
|
|
25
26
|
from typing import Union, List, Set, Optional, Dict
|
|
26
27
|
from typing_extensions import Literal, Self
|
|
27
28
|
|
|
28
|
-
CREATEDATAPOINTFROMFILESMODELMETADATAINNER_ONE_OF_SCHEMAS = ["PrivateTextMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput"]
|
|
29
|
+
CREATEDATAPOINTFROMFILESMODELMETADATAINNER_ONE_OF_SCHEMAS = ["PrivateTextMetadataInput", "PromptAssetMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput"]
|
|
29
30
|
|
|
30
31
|
class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
31
32
|
"""
|
|
@@ -33,14 +34,16 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
33
34
|
"""
|
|
34
35
|
# data type: PrivateTextMetadataInput
|
|
35
36
|
oneof_schema_1_validator: Optional[PrivateTextMetadataInput] = None
|
|
37
|
+
# data type: PromptAssetMetadataInput
|
|
38
|
+
oneof_schema_2_validator: Optional[PromptAssetMetadataInput] = None
|
|
36
39
|
# data type: PromptMetadataInput
|
|
37
|
-
|
|
40
|
+
oneof_schema_3_validator: Optional[PromptMetadataInput] = None
|
|
38
41
|
# data type: PublicTextMetadataInput
|
|
39
|
-
|
|
42
|
+
oneof_schema_4_validator: Optional[PublicTextMetadataInput] = None
|
|
40
43
|
# data type: TranscriptionMetadataInput
|
|
41
|
-
|
|
42
|
-
actual_instance: Optional[Union[PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]] = None
|
|
43
|
-
one_of_schemas: Set[str] = { "PrivateTextMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput" }
|
|
44
|
+
oneof_schema_5_validator: Optional[TranscriptionMetadataInput] = None
|
|
45
|
+
actual_instance: Optional[Union[PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]] = None
|
|
46
|
+
one_of_schemas: Set[str] = { "PrivateTextMetadataInput", "PromptAssetMetadataInput", "PromptMetadataInput", "PublicTextMetadataInput", "TranscriptionMetadataInput" }
|
|
44
47
|
|
|
45
48
|
model_config = ConfigDict(
|
|
46
49
|
validate_assignment=True,
|
|
@@ -71,6 +74,11 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
71
74
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PrivateTextMetadataInput`")
|
|
72
75
|
else:
|
|
73
76
|
match += 1
|
|
77
|
+
# validate data type: PromptAssetMetadataInput
|
|
78
|
+
if not isinstance(v, PromptAssetMetadataInput):
|
|
79
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PromptAssetMetadataInput`")
|
|
80
|
+
else:
|
|
81
|
+
match += 1
|
|
74
82
|
# validate data type: PromptMetadataInput
|
|
75
83
|
if not isinstance(v, PromptMetadataInput):
|
|
76
84
|
error_messages.append(f"Error! Input type `{type(v)}` is not `PromptMetadataInput`")
|
|
@@ -88,10 +96,10 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
88
96
|
match += 1
|
|
89
97
|
if match > 1:
|
|
90
98
|
# more than 1 match
|
|
91
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
99
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
92
100
|
elif match == 0:
|
|
93
101
|
# no match
|
|
94
|
-
raise ValueError("No match found when setting `actual_instance` in CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
102
|
+
raise ValueError("No match found when setting `actual_instance` in CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
95
103
|
else:
|
|
96
104
|
return v
|
|
97
105
|
|
|
@@ -112,6 +120,12 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
112
120
|
match += 1
|
|
113
121
|
except (ValidationError, ValueError) as e:
|
|
114
122
|
error_messages.append(str(e))
|
|
123
|
+
# deserialize data into PromptAssetMetadataInput
|
|
124
|
+
try:
|
|
125
|
+
instance.actual_instance = PromptAssetMetadataInput.from_json(json_str)
|
|
126
|
+
match += 1
|
|
127
|
+
except (ValidationError, ValueError) as e:
|
|
128
|
+
error_messages.append(str(e))
|
|
115
129
|
# deserialize data into PromptMetadataInput
|
|
116
130
|
try:
|
|
117
131
|
instance.actual_instance = PromptMetadataInput.from_json(json_str)
|
|
@@ -133,10 +147,10 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
133
147
|
|
|
134
148
|
if match > 1:
|
|
135
149
|
# more than 1 match
|
|
136
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
150
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
137
151
|
elif match == 0:
|
|
138
152
|
# no match
|
|
139
|
-
raise ValueError("No match found when deserializing the JSON string into CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
153
|
+
raise ValueError("No match found when deserializing the JSON string into CreateDatapointFromFilesModelMetadataInner with oneOf schemas: PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput. Details: " + ", ".join(error_messages))
|
|
140
154
|
else:
|
|
141
155
|
return instance
|
|
142
156
|
|
|
@@ -150,7 +164,7 @@ class CreateDatapointFromFilesModelMetadataInner(BaseModel):
|
|
|
150
164
|
else:
|
|
151
165
|
return json.dumps(self.actual_instance)
|
|
152
166
|
|
|
153
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], PrivateTextMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]]:
|
|
167
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], PrivateTextMetadataInput, PromptAssetMetadataInput, PromptMetadataInput, PublicTextMetadataInput, TranscriptionMetadataInput]]:
|
|
154
168
|
"""Returns the dict representation of the actual instance"""
|
|
155
169
|
if self.actual_instance is None:
|
|
156
170
|
return None
|
|
@@ -20,7 +20,7 @@ import json
|
|
|
20
20
|
from datetime import datetime
|
|
21
21
|
from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
|
|
22
22
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
23
|
-
from rapidata.api_client.models.
|
|
23
|
+
from rapidata.api_client.models.asset_metadata_model_asset import AssetMetadataModelAsset
|
|
24
24
|
from typing import Optional, Set
|
|
25
25
|
from typing_extensions import Self
|
|
26
26
|
|
|
@@ -31,7 +31,7 @@ class Datapoint(BaseModel):
|
|
|
31
31
|
id: StrictStr
|
|
32
32
|
dataset_id: StrictStr = Field(alias="datasetId")
|
|
33
33
|
sort_index: Optional[StrictInt] = Field(default=None, alias="sortIndex")
|
|
34
|
-
asset:
|
|
34
|
+
asset: AssetMetadataModelAsset
|
|
35
35
|
created_at: datetime = Field(alias="createdAt")
|
|
36
36
|
__properties: ClassVar[List[str]] = ["id", "datasetId", "sortIndex", "asset", "createdAt"]
|
|
37
37
|
|
|
@@ -97,7 +97,7 @@ class Datapoint(BaseModel):
|
|
|
97
97
|
"id": obj.get("id"),
|
|
98
98
|
"datasetId": obj.get("datasetId"),
|
|
99
99
|
"sortIndex": obj.get("sortIndex"),
|
|
100
|
-
"asset":
|
|
100
|
+
"asset": AssetMetadataModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
101
101
|
"createdAt": obj.get("createdAt")
|
|
102
102
|
})
|
|
103
103
|
return _obj
|
|
@@ -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
|
|
22
|
-
from rapidata.api_client.models.
|
|
22
|
+
from rapidata.api_client.models.asset_metadata_model_asset import AssetMetadataModelAsset
|
|
23
23
|
from typing import Optional, Set
|
|
24
24
|
from typing_extensions import Self
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ class DatapointModel(BaseModel):
|
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
id: StrictStr
|
|
31
31
|
dataset_id: StrictStr = Field(alias="datasetId")
|
|
32
|
-
asset:
|
|
32
|
+
asset: AssetMetadataModelAsset
|
|
33
33
|
__properties: ClassVar[List[str]] = ["id", "datasetId", "asset"]
|
|
34
34
|
|
|
35
35
|
model_config = ConfigDict(
|
|
@@ -88,7 +88,7 @@ class DatapointModel(BaseModel):
|
|
|
88
88
|
_obj = cls.model_validate({
|
|
89
89
|
"id": obj.get("id"),
|
|
90
90
|
"datasetId": obj.get("datasetId"),
|
|
91
|
-
"asset":
|
|
91
|
+
"asset": AssetMetadataModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None
|
|
92
92
|
})
|
|
93
93
|
return _obj
|
|
94
94
|
|
|
@@ -19,7 +19,6 @@ 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.file_asset_metadata_inner import FileAssetMetadataInner
|
|
23
22
|
from typing import Optional, Set
|
|
24
23
|
from typing_extensions import Self
|
|
25
24
|
|
|
@@ -29,9 +28,8 @@ class FileAsset(BaseModel):
|
|
|
29
28
|
""" # noqa: E501
|
|
30
29
|
t: StrictStr = Field(description="Discriminator value for FileAsset", alias="_t")
|
|
31
30
|
file_name: StrictStr = Field(alias="fileName")
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
__properties: ClassVar[List[str]] = ["_t", "fileName", "originalFileName", "metadata"]
|
|
31
|
+
metadata: Optional[Dict[str, CompareWorkflowConfigMetadataValue]] = None
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "fileName", "metadata"]
|
|
35
33
|
|
|
36
34
|
@field_validator('t')
|
|
37
35
|
def t_validate_enum(cls, value):
|
|
@@ -79,13 +77,13 @@ class FileAsset(BaseModel):
|
|
|
79
77
|
exclude=excluded_fields,
|
|
80
78
|
exclude_none=True,
|
|
81
79
|
)
|
|
82
|
-
# override the default output from pydantic by calling `to_dict()` of each
|
|
83
|
-
|
|
80
|
+
# override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
|
|
81
|
+
_field_dict = {}
|
|
84
82
|
if self.metadata:
|
|
85
|
-
for
|
|
86
|
-
if
|
|
87
|
-
|
|
88
|
-
_dict['metadata'] =
|
|
83
|
+
for _key_metadata in self.metadata:
|
|
84
|
+
if self.metadata[_key_metadata]:
|
|
85
|
+
_field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
|
|
86
|
+
_dict['metadata'] = _field_dict
|
|
89
87
|
return _dict
|
|
90
88
|
|
|
91
89
|
@classmethod
|
|
@@ -100,9 +98,16 @@ class FileAsset(BaseModel):
|
|
|
100
98
|
_obj = cls.model_validate({
|
|
101
99
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'FileAsset',
|
|
102
100
|
"fileName": obj.get("fileName"),
|
|
103
|
-
"
|
|
104
|
-
|
|
101
|
+
"metadata": dict(
|
|
102
|
+
(_k, CompareWorkflowConfigMetadataValue.from_dict(_v))
|
|
103
|
+
for _k, _v in obj["metadata"].items()
|
|
104
|
+
)
|
|
105
|
+
if obj.get("metadata") is not None
|
|
106
|
+
else None
|
|
105
107
|
})
|
|
106
108
|
return _obj
|
|
107
109
|
|
|
110
|
+
from rapidata.api_client.models.compare_workflow_config_metadata_value import CompareWorkflowConfigMetadataValue
|
|
111
|
+
# TODO: Rewrite to not use raise_errors
|
|
112
|
+
FileAsset.model_rebuild(raise_errors=False)
|
|
108
113
|
|
|
@@ -19,7 +19,6 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
|
-
from rapidata.api_client.models.file_asset_model_metadata_value import FileAssetModelMetadataValue
|
|
23
22
|
from typing import Optional, Set
|
|
24
23
|
from typing_extensions import Self
|
|
25
24
|
|
|
@@ -110,4 +109,7 @@ class FileAssetModel(BaseModel):
|
|
|
110
109
|
})
|
|
111
110
|
return _obj
|
|
112
111
|
|
|
112
|
+
from rapidata.api_client.models.file_asset_model_metadata_value import FileAssetModelMetadataValue
|
|
113
|
+
# TODO: Rewrite to not use raise_errors
|
|
114
|
+
FileAssetModel.model_rebuild(raise_errors=False)
|
|
113
115
|
|
|
@@ -32,36 +32,38 @@ from pydantic import StrictStr, Field
|
|
|
32
32
|
from typing import Union, List, Set, Optional, Dict
|
|
33
33
|
from typing_extensions import Literal, Self
|
|
34
34
|
|
|
35
|
-
FILEASSETMODELMETADATAVALUE_ONE_OF_SCHEMAS = ["ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel"]
|
|
35
|
+
FILEASSETMODELMETADATAVALUE_ONE_OF_SCHEMAS = ["AssetMetadataModel", "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel"]
|
|
36
36
|
|
|
37
37
|
class FileAssetModelMetadataValue(BaseModel):
|
|
38
38
|
"""
|
|
39
39
|
FileAssetModelMetadataValue
|
|
40
40
|
"""
|
|
41
|
+
# data type: AssetMetadataModel
|
|
42
|
+
oneof_schema_1_validator: Optional[AssetMetadataModel] = None
|
|
41
43
|
# data type: ClassificationMetadataModel
|
|
42
|
-
|
|
44
|
+
oneof_schema_2_validator: Optional[ClassificationMetadataModel] = None
|
|
43
45
|
# data type: CountMetadataModel
|
|
44
|
-
|
|
46
|
+
oneof_schema_3_validator: Optional[CountMetadataModel] = None
|
|
45
47
|
# data type: DemographicMetadataModel
|
|
46
|
-
|
|
48
|
+
oneof_schema_4_validator: Optional[DemographicMetadataModel] = None
|
|
47
49
|
# data type: ImageDimensionMetadataModel
|
|
48
|
-
|
|
50
|
+
oneof_schema_5_validator: Optional[ImageDimensionMetadataModel] = None
|
|
49
51
|
# data type: LocationMetadataModel
|
|
50
|
-
|
|
52
|
+
oneof_schema_6_validator: Optional[LocationMetadataModel] = None
|
|
51
53
|
# data type: OriginalFilenameMetadataModel
|
|
52
|
-
|
|
54
|
+
oneof_schema_7_validator: Optional[OriginalFilenameMetadataModel] = None
|
|
53
55
|
# data type: PromptMetadataModel
|
|
54
|
-
|
|
56
|
+
oneof_schema_8_validator: Optional[PromptMetadataModel] = None
|
|
55
57
|
# data type: SourceUrlMetadataModel
|
|
56
|
-
|
|
58
|
+
oneof_schema_9_validator: Optional[SourceUrlMetadataModel] = None
|
|
57
59
|
# data type: TextMetadataModel
|
|
58
|
-
|
|
60
|
+
oneof_schema_10_validator: Optional[TextMetadataModel] = None
|
|
59
61
|
# data type: TranscriptionMetadataModel
|
|
60
|
-
|
|
62
|
+
oneof_schema_11_validator: Optional[TranscriptionMetadataModel] = None
|
|
61
63
|
# data type: TranslatedPromptMetadataModel
|
|
62
|
-
|
|
63
|
-
actual_instance: Optional[Union[ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]] = None
|
|
64
|
-
one_of_schemas: Set[str] = { "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel" }
|
|
64
|
+
oneof_schema_12_validator: Optional[TranslatedPromptMetadataModel] = None
|
|
65
|
+
actual_instance: Optional[Union[AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]] = None
|
|
66
|
+
one_of_schemas: Set[str] = { "AssetMetadataModel", "ClassificationMetadataModel", "CountMetadataModel", "DemographicMetadataModel", "ImageDimensionMetadataModel", "LocationMetadataModel", "OriginalFilenameMetadataModel", "PromptMetadataModel", "SourceUrlMetadataModel", "TextMetadataModel", "TranscriptionMetadataModel", "TranslatedPromptMetadataModel" }
|
|
65
67
|
|
|
66
68
|
model_config = ConfigDict(
|
|
67
69
|
validate_assignment=True,
|
|
@@ -87,6 +89,11 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
87
89
|
instance = FileAssetModelMetadataValue.model_construct()
|
|
88
90
|
error_messages = []
|
|
89
91
|
match = 0
|
|
92
|
+
# validate data type: AssetMetadataModel
|
|
93
|
+
if not isinstance(v, AssetMetadataModel):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AssetMetadataModel`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
90
97
|
# validate data type: ClassificationMetadataModel
|
|
91
98
|
if not isinstance(v, ClassificationMetadataModel):
|
|
92
99
|
error_messages.append(f"Error! Input type `{type(v)}` is not `ClassificationMetadataModel`")
|
|
@@ -144,10 +151,10 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
144
151
|
match += 1
|
|
145
152
|
if match > 1:
|
|
146
153
|
# more than 1 match
|
|
147
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
154
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
148
155
|
elif match == 0:
|
|
149
156
|
# no match
|
|
150
|
-
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
157
|
+
raise ValueError("No match found when setting `actual_instance` in FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
151
158
|
else:
|
|
152
159
|
return v
|
|
153
160
|
|
|
@@ -162,6 +169,12 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
162
169
|
error_messages = []
|
|
163
170
|
match = 0
|
|
164
171
|
|
|
172
|
+
# deserialize data into AssetMetadataModel
|
|
173
|
+
try:
|
|
174
|
+
instance.actual_instance = AssetMetadataModel.from_json(json_str)
|
|
175
|
+
match += 1
|
|
176
|
+
except (ValidationError, ValueError) as e:
|
|
177
|
+
error_messages.append(str(e))
|
|
165
178
|
# deserialize data into ClassificationMetadataModel
|
|
166
179
|
try:
|
|
167
180
|
instance.actual_instance = ClassificationMetadataModel.from_json(json_str)
|
|
@@ -231,10 +244,10 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
231
244
|
|
|
232
245
|
if match > 1:
|
|
233
246
|
# more than 1 match
|
|
234
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
247
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
235
248
|
elif match == 0:
|
|
236
249
|
# no match
|
|
237
|
-
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
250
|
+
raise ValueError("No match found when deserializing the JSON string into FileAssetModelMetadataValue with oneOf schemas: AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel. Details: " + ", ".join(error_messages))
|
|
238
251
|
else:
|
|
239
252
|
return instance
|
|
240
253
|
|
|
@@ -248,7 +261,7 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
248
261
|
else:
|
|
249
262
|
return json.dumps(self.actual_instance)
|
|
250
263
|
|
|
251
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]]:
|
|
264
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AssetMetadataModel, ClassificationMetadataModel, CountMetadataModel, DemographicMetadataModel, ImageDimensionMetadataModel, LocationMetadataModel, OriginalFilenameMetadataModel, PromptMetadataModel, SourceUrlMetadataModel, TextMetadataModel, TranscriptionMetadataModel, TranslatedPromptMetadataModel]]:
|
|
252
265
|
"""Returns the dict representation of the actual instance"""
|
|
253
266
|
if self.actual_instance is None:
|
|
254
267
|
return None
|
|
@@ -263,4 +276,7 @@ class FileAssetModelMetadataValue(BaseModel):
|
|
|
263
276
|
"""Returns the string representation of the actual instance"""
|
|
264
277
|
return pprint.pformat(self.model_dump())
|
|
265
278
|
|
|
279
|
+
from rapidata.api_client.models.asset_metadata_model import AssetMetadataModel
|
|
280
|
+
# TODO: Rewrite to not use raise_errors
|
|
281
|
+
FileAssetModelMetadataValue.model_rebuild(raise_errors=False)
|
|
266
282
|
|