rapidata 2.41.1__py3-none-any.whl → 2.41.3__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 -1
- rapidata/api_client/__init__.py +4 -2
- rapidata/api_client/api/dataset_api.py +544 -0
- rapidata/api_client/api/order_api.py +1 -3
- rapidata/api_client/models/__init__.py +4 -2
- rapidata/api_client/models/compare_workflow_config.py +3 -3
- rapidata/api_client/models/compare_workflow_config_model.py +3 -3
- rapidata/api_client/models/compare_workflow_model.py +4 -4
- rapidata/api_client/models/compare_workflow_model_pair_maker_config.py +1 -1
- rapidata/api_client/models/create_order_model_referee.py +12 -12
- rapidata/api_client/models/create_order_model_workflow.py +15 -15
- rapidata/api_client/models/early_stopping_referee_model.py +3 -3
- rapidata/api_client/models/elo_config_model.py +4 -4
- rapidata/api_client/models/evaluation_workflow_model.py +4 -4
- rapidata/api_client/models/existing_asset_input.py +100 -0
- rapidata/api_client/models/file_asset.py +3 -3
- rapidata/api_client/models/file_asset_metadata_value.py +296 -0
- rapidata/api_client/models/multi_asset.py +3 -3
- rapidata/api_client/models/multi_asset_input1_assets_inner.py +40 -12
- rapidata/api_client/models/multi_asset_input3_assets_inner.py +40 -12
- rapidata/api_client/models/multi_asset_input_assets_inner.py +40 -12
- rapidata/api_client/models/naive_referee_model.py +2 -2
- rapidata/api_client/models/null_asset.py +3 -3
- rapidata/api_client/models/online_pair_maker_config_model.py +3 -3
- rapidata/api_client/models/prompt_asset_metadata_input_asset.py +40 -12
- rapidata/api_client/models/reference_asset_input.py +100 -0
- rapidata/api_client/models/simple_workflow_model.py +5 -5
- rapidata/api_client/models/submit_prompt_model_prompt_asset.py +40 -12
- rapidata/api_client/models/text_asset.py +3 -3
- rapidata/api_client/models/upload_asset_result.py +102 -0
- rapidata/api_client_README.md +6 -2
- rapidata/rapidata_client/order/_rapidata_order_builder.py +4 -2
- rapidata/rapidata_client/order/rapidata_order_manager.py +8 -0
- rapidata/rapidata_client/settings/translation_behaviour.py +1 -1
- rapidata/rapidata_client/workflow/_classify_workflow.py +3 -3
- rapidata/rapidata_client/workflow/_compare_workflow.py +3 -3
- rapidata/rapidata_client/workflow/_draw_workflow.py +4 -3
- rapidata/rapidata_client/workflow/_free_text_workflow.py +3 -3
- rapidata/rapidata_client/workflow/_locate_workflow.py +4 -3
- rapidata/rapidata_client/workflow/_select_words_workflow.py +4 -3
- rapidata/rapidata_client/workflow/_timestamp_workflow.py +4 -3
- {rapidata-2.41.1.dist-info → rapidata-2.41.3.dist-info}/METADATA +4 -2
- {rapidata-2.41.1.dist-info → rapidata-2.41.3.dist-info}/RECORD +45 -41
- {rapidata-2.41.1.dist-info → rapidata-2.41.3.dist-info}/WHEEL +1 -1
- {rapidata-2.41.1.dist-info → rapidata-2.41.3.dist-info/licenses}/LICENSE +0 -0
|
@@ -19,11 +19,11 @@ 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.compare_workflow_config_metadata_value import CompareWorkflowConfigMetadataValue
|
|
23
22
|
from rapidata.api_client.models.compare_workflow_config_pair_maker_config import CompareWorkflowConfigPairMakerConfig
|
|
24
23
|
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
25
24
|
from rapidata.api_client.models.elo_config import EloConfig
|
|
26
25
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
26
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
27
27
|
from typing import Optional, Set
|
|
28
28
|
from typing_extensions import Self
|
|
29
29
|
|
|
@@ -35,7 +35,7 @@ class CompareWorkflowConfig(BaseModel):
|
|
|
35
35
|
criteria: StrictStr
|
|
36
36
|
referee: CompareWorkflowModel1Referee
|
|
37
37
|
target_country_codes: List[StrictStr] = Field(alias="targetCountryCodes")
|
|
38
|
-
metadata: Dict[str,
|
|
38
|
+
metadata: Dict[str, FileAssetMetadataValue]
|
|
39
39
|
elo_config: Optional[EloConfig] = Field(default=None, alias="eloConfig")
|
|
40
40
|
pair_maker_config: Optional[CompareWorkflowConfigPairMakerConfig] = Field(default=None, alias="pairMakerConfig")
|
|
41
41
|
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
@@ -127,7 +127,7 @@ class CompareWorkflowConfig(BaseModel):
|
|
|
127
127
|
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
128
128
|
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
129
129
|
"metadata": dict(
|
|
130
|
-
(_k,
|
|
130
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
131
131
|
for _k, _v in obj["metadata"].items()
|
|
132
132
|
)
|
|
133
133
|
if obj.get("metadata") is not None
|
|
@@ -19,11 +19,11 @@ 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.compare_workflow_config_metadata_value import CompareWorkflowConfigMetadataValue
|
|
23
22
|
from rapidata.api_client.models.compare_workflow_config_model_pair_maker_config import CompareWorkflowConfigModelPairMakerConfig
|
|
24
23
|
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
25
24
|
from rapidata.api_client.models.elo_config import EloConfig
|
|
26
25
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
26
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
27
27
|
from typing import Optional, Set
|
|
28
28
|
from typing_extensions import Self
|
|
29
29
|
|
|
@@ -37,7 +37,7 @@ class CompareWorkflowConfigModel(BaseModel):
|
|
|
37
37
|
referee: CompareWorkflowModel1Referee
|
|
38
38
|
target_country_codes: List[StrictStr] = Field(description="A list of country codes that this workflow is targeting.", alias="targetCountryCodes")
|
|
39
39
|
elo_config: Optional[EloConfig] = Field(default=None, alias="eloConfig")
|
|
40
|
-
metadata: Dict[str,
|
|
40
|
+
metadata: Dict[str, FileAssetMetadataValue] = Field(description="The metadata is attached to every single rapid and can be used for something like the prompt.")
|
|
41
41
|
feature_flags: List[FeatureFlag] = Field(description="The list of feature flags that will be applied to the rapids created by this workflow.", alias="featureFlags")
|
|
42
42
|
__properties: ClassVar[List[str]] = ["_t", "criteria", "pairMakerConfig", "referee", "targetCountryCodes", "eloConfig", "metadata", "featureFlags"]
|
|
43
43
|
|
|
@@ -129,7 +129,7 @@ class CompareWorkflowConfigModel(BaseModel):
|
|
|
129
129
|
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
130
130
|
"eloConfig": EloConfig.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None,
|
|
131
131
|
"metadata": dict(
|
|
132
|
-
(_k,
|
|
132
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
133
133
|
for _k, _v in obj["metadata"].items()
|
|
134
134
|
)
|
|
135
135
|
if obj.get("metadata") is not None
|
|
@@ -28,14 +28,14 @@ from typing_extensions import Self
|
|
|
28
28
|
|
|
29
29
|
class CompareWorkflowModel(BaseModel):
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
CompareWorkflowModel
|
|
32
32
|
""" # noqa: E501
|
|
33
33
|
t: StrictStr = Field(description="Discriminator value for CompareWorkflow", alias="_t")
|
|
34
|
-
criteria: StrictStr
|
|
34
|
+
criteria: StrictStr
|
|
35
35
|
pair_maker_config: Optional[CompareWorkflowModelPairMakerConfig] = Field(default=None, alias="pairMakerConfig")
|
|
36
36
|
elo_config: Optional[EloConfigModel] = Field(default=None, alias="eloConfig")
|
|
37
|
-
metadata: Optional[List[DatasetDatasetIdDatapointsPostRequestMetadataInner]] =
|
|
38
|
-
feature_flags: Optional[List[FeatureFlag]] = Field(default=None,
|
|
37
|
+
metadata: Optional[List[DatasetDatasetIdDatapointsPostRequestMetadataInner]] = None
|
|
38
|
+
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
39
39
|
__properties: ClassVar[List[str]] = ["_t", "criteria", "pairMakerConfig", "eloConfig", "metadata", "featureFlags"]
|
|
40
40
|
|
|
41
41
|
@field_validator('t')
|
|
@@ -26,7 +26,7 @@ COMPAREWORKFLOWMODELPAIRMAKERCONFIG_ONE_OF_SCHEMAS = ["OnlinePairMakerConfigMode
|
|
|
26
26
|
|
|
27
27
|
class CompareWorkflowModelPairMakerConfig(BaseModel):
|
|
28
28
|
"""
|
|
29
|
-
|
|
29
|
+
CompareWorkflowModelPairMakerConfig
|
|
30
30
|
"""
|
|
31
31
|
# data type: OnlinePairMakerConfigModel
|
|
32
32
|
oneof_schema_1_validator: Optional[OnlinePairMakerConfigModel] = None
|
|
@@ -29,10 +29,10 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
29
29
|
"""
|
|
30
30
|
The referee is used to determine how many votes will be collected.
|
|
31
31
|
"""
|
|
32
|
-
# data type: NaiveRefereeModel
|
|
33
|
-
oneof_schema_1_validator: Optional[NaiveRefereeModel] = None
|
|
34
32
|
# data type: EarlyStoppingRefereeModel
|
|
35
|
-
|
|
33
|
+
oneof_schema_1_validator: Optional[EarlyStoppingRefereeModel] = None
|
|
34
|
+
# data type: NaiveRefereeModel
|
|
35
|
+
oneof_schema_2_validator: Optional[NaiveRefereeModel] = None
|
|
36
36
|
actual_instance: Optional[Union[EarlyStoppingRefereeModel, NaiveRefereeModel]] = None
|
|
37
37
|
one_of_schemas: Set[str] = { "EarlyStoppingRefereeModel", "NaiveRefereeModel" }
|
|
38
38
|
|
|
@@ -60,16 +60,16 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
60
60
|
instance = CreateOrderModelReferee.model_construct()
|
|
61
61
|
error_messages = []
|
|
62
62
|
match = 0
|
|
63
|
-
# validate data type: NaiveRefereeModel
|
|
64
|
-
if not isinstance(v, NaiveRefereeModel):
|
|
65
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `NaiveRefereeModel`")
|
|
66
|
-
else:
|
|
67
|
-
match += 1
|
|
68
63
|
# validate data type: EarlyStoppingRefereeModel
|
|
69
64
|
if not isinstance(v, EarlyStoppingRefereeModel):
|
|
70
65
|
error_messages.append(f"Error! Input type `{type(v)}` is not `EarlyStoppingRefereeModel`")
|
|
71
66
|
else:
|
|
72
67
|
match += 1
|
|
68
|
+
# validate data type: NaiveRefereeModel
|
|
69
|
+
if not isinstance(v, NaiveRefereeModel):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NaiveRefereeModel`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
73
|
if match > 1:
|
|
74
74
|
# more than 1 match
|
|
75
75
|
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelReferee with oneOf schemas: EarlyStoppingRefereeModel, NaiveRefereeModel. Details: " + ", ".join(error_messages))
|
|
@@ -90,15 +90,15 @@ class CreateOrderModelReferee(BaseModel):
|
|
|
90
90
|
error_messages = []
|
|
91
91
|
match = 0
|
|
92
92
|
|
|
93
|
-
# deserialize data into
|
|
93
|
+
# deserialize data into EarlyStoppingRefereeModel
|
|
94
94
|
try:
|
|
95
|
-
instance.actual_instance =
|
|
95
|
+
instance.actual_instance = EarlyStoppingRefereeModel.from_json(json_str)
|
|
96
96
|
match += 1
|
|
97
97
|
except (ValidationError, ValueError) as e:
|
|
98
98
|
error_messages.append(str(e))
|
|
99
|
-
# deserialize data into
|
|
99
|
+
# deserialize data into NaiveRefereeModel
|
|
100
100
|
try:
|
|
101
|
-
instance.actual_instance =
|
|
101
|
+
instance.actual_instance = NaiveRefereeModel.from_json(json_str)
|
|
102
102
|
match += 1
|
|
103
103
|
except (ValidationError, ValueError) as e:
|
|
104
104
|
error_messages.append(str(e))
|
|
@@ -30,12 +30,12 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
30
30
|
"""
|
|
31
31
|
The workflow helps to determine the tasks that need to be completed by the users.
|
|
32
32
|
"""
|
|
33
|
+
# data type: CompareWorkflowModel
|
|
34
|
+
oneof_schema_1_validator: Optional[CompareWorkflowModel] = None
|
|
33
35
|
# data type: EvaluationWorkflowModel
|
|
34
|
-
|
|
36
|
+
oneof_schema_2_validator: Optional[EvaluationWorkflowModel] = None
|
|
35
37
|
# data type: SimpleWorkflowModel
|
|
36
|
-
|
|
37
|
-
# data type: CompareWorkflowModel
|
|
38
|
-
oneof_schema_3_validator: Optional[CompareWorkflowModel] = None
|
|
38
|
+
oneof_schema_3_validator: Optional[SimpleWorkflowModel] = None
|
|
39
39
|
actual_instance: Optional[Union[CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel]] = None
|
|
40
40
|
one_of_schemas: Set[str] = { "CompareWorkflowModel", "EvaluationWorkflowModel", "SimpleWorkflowModel" }
|
|
41
41
|
|
|
@@ -63,6 +63,11 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
63
63
|
instance = CreateOrderModelWorkflow.model_construct()
|
|
64
64
|
error_messages = []
|
|
65
65
|
match = 0
|
|
66
|
+
# validate data type: CompareWorkflowModel
|
|
67
|
+
if not isinstance(v, CompareWorkflowModel):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareWorkflowModel`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
66
71
|
# validate data type: EvaluationWorkflowModel
|
|
67
72
|
if not isinstance(v, EvaluationWorkflowModel):
|
|
68
73
|
error_messages.append(f"Error! Input type `{type(v)}` is not `EvaluationWorkflowModel`")
|
|
@@ -73,11 +78,6 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
73
78
|
error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowModel`")
|
|
74
79
|
else:
|
|
75
80
|
match += 1
|
|
76
|
-
# validate data type: CompareWorkflowModel
|
|
77
|
-
if not isinstance(v, CompareWorkflowModel):
|
|
78
|
-
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareWorkflowModel`")
|
|
79
|
-
else:
|
|
80
|
-
match += 1
|
|
81
81
|
if match > 1:
|
|
82
82
|
# more than 1 match
|
|
83
83
|
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
@@ -98,21 +98,21 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
98
98
|
error_messages = []
|
|
99
99
|
match = 0
|
|
100
100
|
|
|
101
|
-
# deserialize data into
|
|
101
|
+
# deserialize data into CompareWorkflowModel
|
|
102
102
|
try:
|
|
103
|
-
instance.actual_instance =
|
|
103
|
+
instance.actual_instance = CompareWorkflowModel.from_json(json_str)
|
|
104
104
|
match += 1
|
|
105
105
|
except (ValidationError, ValueError) as e:
|
|
106
106
|
error_messages.append(str(e))
|
|
107
|
-
# deserialize data into
|
|
107
|
+
# deserialize data into EvaluationWorkflowModel
|
|
108
108
|
try:
|
|
109
|
-
instance.actual_instance =
|
|
109
|
+
instance.actual_instance = EvaluationWorkflowModel.from_json(json_str)
|
|
110
110
|
match += 1
|
|
111
111
|
except (ValidationError, ValueError) as e:
|
|
112
112
|
error_messages.append(str(e))
|
|
113
|
-
# deserialize data into
|
|
113
|
+
# deserialize data into SimpleWorkflowModel
|
|
114
114
|
try:
|
|
115
|
-
instance.actual_instance =
|
|
115
|
+
instance.actual_instance = SimpleWorkflowModel.from_json(json_str)
|
|
116
116
|
match += 1
|
|
117
117
|
except (ValidationError, ValueError) as e:
|
|
118
118
|
error_messages.append(str(e))
|
|
@@ -24,11 +24,11 @@ from typing_extensions import Self
|
|
|
24
24
|
|
|
25
25
|
class EarlyStoppingRefereeModel(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
EarlyStoppingRefereeModel
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for EarlyStoppingReferee", alias="_t")
|
|
30
|
-
max_votes: StrictInt = Field(
|
|
31
|
-
threshold: Union[StrictFloat, StrictInt]
|
|
30
|
+
max_votes: StrictInt = Field(alias="maxVotes")
|
|
31
|
+
threshold: Union[StrictFloat, StrictInt]
|
|
32
32
|
__properties: ClassVar[List[str]] = ["_t", "maxVotes", "threshold"]
|
|
33
33
|
|
|
34
34
|
@field_validator('t')
|
|
@@ -24,11 +24,11 @@ from typing_extensions import Self
|
|
|
24
24
|
|
|
25
25
|
class EloConfigModel(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
|
|
27
|
+
EloConfigModel
|
|
28
28
|
""" # noqa: E501
|
|
29
|
-
starting_elo: Optional[StrictInt] = Field(default=None,
|
|
30
|
-
k_factor: Optional[StrictInt] = Field(default=None,
|
|
31
|
-
scaling_factor: Optional[StrictInt] = Field(default=None,
|
|
29
|
+
starting_elo: Optional[StrictInt] = Field(default=None, alias="startingElo")
|
|
30
|
+
k_factor: Optional[StrictInt] = Field(default=None, alias="kFactor")
|
|
31
|
+
scaling_factor: Optional[StrictInt] = Field(default=None, alias="scalingFactor")
|
|
32
32
|
__properties: ClassVar[List[str]] = ["startingElo", "kFactor", "scalingFactor"]
|
|
33
33
|
|
|
34
34
|
model_config = ConfigDict(
|
|
@@ -25,12 +25,12 @@ from typing_extensions import Self
|
|
|
25
25
|
|
|
26
26
|
class EvaluationWorkflowModel(BaseModel):
|
|
27
27
|
"""
|
|
28
|
-
|
|
28
|
+
EvaluationWorkflowModel
|
|
29
29
|
""" # noqa: E501
|
|
30
30
|
t: StrictStr = Field(description="Discriminator value for EvaluationWorkflow", alias="_t")
|
|
31
|
-
validation_set_id: StrictStr = Field(
|
|
32
|
-
should_accept_incorrect: StrictBool = Field(
|
|
33
|
-
feature_flags: Optional[List[FeatureFlag]] = Field(default=None,
|
|
31
|
+
validation_set_id: StrictStr = Field(alias="validationSetId")
|
|
32
|
+
should_accept_incorrect: StrictBool = Field(alias="shouldAcceptIncorrect")
|
|
33
|
+
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
34
34
|
__properties: ClassVar[List[str]] = ["_t", "validationSetId", "shouldAcceptIncorrect", "featureFlags"]
|
|
35
35
|
|
|
36
36
|
@field_validator('t')
|
|
@@ -0,0 +1,100 @@
|
|
|
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, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class ExistingAssetInput(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
ExistingAssetInput
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for ExistingAssetInput", alias="_t")
|
|
30
|
+
identifier: Optional[StrictStr] = None
|
|
31
|
+
name: StrictStr
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "identifier", "name"]
|
|
33
|
+
|
|
34
|
+
@field_validator('t')
|
|
35
|
+
def t_validate_enum(cls, value):
|
|
36
|
+
"""Validates the enum"""
|
|
37
|
+
if value not in set(['ExistingAssetInput']):
|
|
38
|
+
raise ValueError("must be one of enum values ('ExistingAssetInput')")
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
model_config = ConfigDict(
|
|
42
|
+
populate_by_name=True,
|
|
43
|
+
validate_assignment=True,
|
|
44
|
+
protected_namespaces=(),
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def to_str(self) -> str:
|
|
49
|
+
"""Returns the string representation of the model using alias"""
|
|
50
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
51
|
+
|
|
52
|
+
def to_json(self) -> str:
|
|
53
|
+
"""Returns the JSON representation of the model using alias"""
|
|
54
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
55
|
+
return json.dumps(self.to_dict())
|
|
56
|
+
|
|
57
|
+
@classmethod
|
|
58
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
59
|
+
"""Create an instance of ExistingAssetInput from a JSON string"""
|
|
60
|
+
return cls.from_dict(json.loads(json_str))
|
|
61
|
+
|
|
62
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
63
|
+
"""Return the dictionary representation of the model using alias.
|
|
64
|
+
|
|
65
|
+
This has the following differences from calling pydantic's
|
|
66
|
+
`self.model_dump(by_alias=True)`:
|
|
67
|
+
|
|
68
|
+
* `None` is only added to the output dict for nullable fields that
|
|
69
|
+
were set at model initialization. Other fields with value `None`
|
|
70
|
+
are ignored.
|
|
71
|
+
* OpenAPI `readOnly` fields are excluded.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
"identifier",
|
|
75
|
+
])
|
|
76
|
+
|
|
77
|
+
_dict = self.model_dump(
|
|
78
|
+
by_alias=True,
|
|
79
|
+
exclude=excluded_fields,
|
|
80
|
+
exclude_none=True,
|
|
81
|
+
)
|
|
82
|
+
return _dict
|
|
83
|
+
|
|
84
|
+
@classmethod
|
|
85
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
86
|
+
"""Create an instance of ExistingAssetInput from a dict"""
|
|
87
|
+
if obj is None:
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
if not isinstance(obj, dict):
|
|
91
|
+
return cls.model_validate(obj)
|
|
92
|
+
|
|
93
|
+
_obj = cls.model_validate({
|
|
94
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'ExistingAssetInput',
|
|
95
|
+
"identifier": obj.get("identifier"),
|
|
96
|
+
"name": obj.get("name")
|
|
97
|
+
})
|
|
98
|
+
return _obj
|
|
99
|
+
|
|
100
|
+
|
|
@@ -28,7 +28,7 @@ class FileAsset(BaseModel):
|
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for FileAsset", alias="_t")
|
|
30
30
|
file_name: StrictStr = Field(alias="fileName")
|
|
31
|
-
metadata: Optional[Dict[str,
|
|
31
|
+
metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
|
|
32
32
|
__properties: ClassVar[List[str]] = ["_t", "fileName", "metadata"]
|
|
33
33
|
|
|
34
34
|
@field_validator('t')
|
|
@@ -99,7 +99,7 @@ class FileAsset(BaseModel):
|
|
|
99
99
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'FileAsset',
|
|
100
100
|
"fileName": obj.get("fileName"),
|
|
101
101
|
"metadata": dict(
|
|
102
|
-
(_k,
|
|
102
|
+
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
103
103
|
for _k, _v in obj["metadata"].items()
|
|
104
104
|
)
|
|
105
105
|
if obj.get("metadata") is not None
|
|
@@ -107,7 +107,7 @@ class FileAsset(BaseModel):
|
|
|
107
107
|
})
|
|
108
108
|
return _obj
|
|
109
109
|
|
|
110
|
-
from rapidata.api_client.models.
|
|
110
|
+
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
111
111
|
# TODO: Rewrite to not use raise_errors
|
|
112
112
|
FileAsset.model_rebuild(raise_errors=False)
|
|
113
113
|
|