rapidata 2.14.0__py3-none-any.whl → 2.14.1__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/api_client/__init__.py +12 -0
- rapidata/api_client/api/rapid_api.py +262 -0
- rapidata/api_client/api/workflow_api.py +3 -3
- rapidata/api_client/models/__init__.py +12 -0
- rapidata/api_client/models/classification_metadata.py +2 -4
- rapidata/api_client/models/compare_workflow_config.py +17 -2
- rapidata/api_client/models/compare_workflow_config_metadata_value.py +238 -0
- rapidata/api_client/models/compare_workflow_config_model.py +17 -2
- rapidata/api_client/models/compare_workflow_model.py +17 -2
- rapidata/api_client/models/count_metadata.py +1 -3
- rapidata/api_client/models/early_stopping_referee_model.py +1 -1
- rapidata/api_client/models/get_rapid_responses_result.py +112 -0
- rapidata/api_client/models/get_simple_workflow_results_result.py +7 -1
- rapidata/api_client/models/image_dimension_metadata.py +1 -3
- rapidata/api_client/models/location_metadata.py +2 -4
- rapidata/api_client/models/metadata_visibilities.py +1 -0
- rapidata/api_client/models/original_filename_metadata.py +2 -4
- rapidata/api_client/models/prompt_metadata.py +1 -3
- rapidata/api_client/models/scrub_result.py +4 -4
- rapidata/api_client/models/source_url_metadata.py +98 -0
- rapidata/api_client/models/text_metadata.py +3 -5
- rapidata/api_client/models/transcription_metadata.py +1 -3
- rapidata/api_client_README.md +14 -1
- rapidata/rapidata_client/filter/rapidata_filters.py +10 -2
- rapidata/rapidata_client/order/_rapidata_order_builder.py +5 -5
- rapidata/rapidata_client/order/rapidata_order.py +2 -2
- rapidata/rapidata_client/order/rapidata_order_manager.py +10 -19
- rapidata/rapidata_client/order/rapidata_results.py +2 -1
- rapidata/rapidata_client/rapidata_client.py +4 -0
- rapidata/rapidata_client/selection/rapidata_selections.py +10 -9
- rapidata/rapidata_client/settings/no_shuffle.py +2 -2
- rapidata/rapidata_client/settings/rapidata_settings.py +8 -0
- rapidata/rapidata_client/workflow/_ranking_workflow.py +15 -4
- rapidata/service/credential_manager.py +7 -0
- rapidata/service/openapi_service.py +6 -6
- {rapidata-2.14.0.dist-info → rapidata-2.14.1.dist-info}/METADATA +1 -1
- {rapidata-2.14.0.dist-info → rapidata-2.14.1.dist-info}/RECORD +39 -36
- {rapidata-2.14.0.dist-info → rapidata-2.14.1.dist-info}/LICENSE +0 -0
- {rapidata-2.14.0.dist-info → rapidata-2.14.1.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.classification_metadata import ClassificationMetadata
|
|
21
|
+
from rapidata.api_client.models.count_metadata import CountMetadata
|
|
22
|
+
from rapidata.api_client.models.image_dimension_metadata import ImageDimensionMetadata
|
|
23
|
+
from rapidata.api_client.models.location_metadata import LocationMetadata
|
|
24
|
+
from rapidata.api_client.models.original_filename_metadata import OriginalFilenameMetadata
|
|
25
|
+
from rapidata.api_client.models.prompt_metadata import PromptMetadata
|
|
26
|
+
from rapidata.api_client.models.source_url_metadata import SourceUrlMetadata
|
|
27
|
+
from rapidata.api_client.models.text_metadata import TextMetadata
|
|
28
|
+
from rapidata.api_client.models.transcription_metadata import TranscriptionMetadata
|
|
29
|
+
from pydantic import StrictStr, Field
|
|
30
|
+
from typing import Union, List, Set, Optional, Dict
|
|
31
|
+
from typing_extensions import Literal, Self
|
|
32
|
+
|
|
33
|
+
COMPAREWORKFLOWCONFIGMETADATAVALUE_ONE_OF_SCHEMAS = ["ClassificationMetadata", "CountMetadata", "ImageDimensionMetadata", "LocationMetadata", "OriginalFilenameMetadata", "PromptMetadata", "SourceUrlMetadata", "TextMetadata", "TranscriptionMetadata"]
|
|
34
|
+
|
|
35
|
+
class CompareWorkflowConfigMetadataValue(BaseModel):
|
|
36
|
+
"""
|
|
37
|
+
CompareWorkflowConfigMetadataValue
|
|
38
|
+
"""
|
|
39
|
+
# data type: ClassificationMetadata
|
|
40
|
+
oneof_schema_1_validator: Optional[ClassificationMetadata] = None
|
|
41
|
+
# data type: CountMetadata
|
|
42
|
+
oneof_schema_2_validator: Optional[CountMetadata] = None
|
|
43
|
+
# data type: ImageDimensionMetadata
|
|
44
|
+
oneof_schema_3_validator: Optional[ImageDimensionMetadata] = None
|
|
45
|
+
# data type: LocationMetadata
|
|
46
|
+
oneof_schema_4_validator: Optional[LocationMetadata] = None
|
|
47
|
+
# data type: OriginalFilenameMetadata
|
|
48
|
+
oneof_schema_5_validator: Optional[OriginalFilenameMetadata] = None
|
|
49
|
+
# data type: PromptMetadata
|
|
50
|
+
oneof_schema_6_validator: Optional[PromptMetadata] = None
|
|
51
|
+
# data type: SourceUrlMetadata
|
|
52
|
+
oneof_schema_7_validator: Optional[SourceUrlMetadata] = None
|
|
53
|
+
# data type: TextMetadata
|
|
54
|
+
oneof_schema_8_validator: Optional[TextMetadata] = None
|
|
55
|
+
# data type: TranscriptionMetadata
|
|
56
|
+
oneof_schema_9_validator: Optional[TranscriptionMetadata] = None
|
|
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" }
|
|
59
|
+
|
|
60
|
+
model_config = ConfigDict(
|
|
61
|
+
validate_assignment=True,
|
|
62
|
+
protected_namespaces=(),
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
70
|
+
if args:
|
|
71
|
+
if len(args) > 1:
|
|
72
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
73
|
+
if kwargs:
|
|
74
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
75
|
+
super().__init__(actual_instance=args[0])
|
|
76
|
+
else:
|
|
77
|
+
super().__init__(**kwargs)
|
|
78
|
+
|
|
79
|
+
@field_validator('actual_instance')
|
|
80
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
81
|
+
instance = CompareWorkflowConfigMetadataValue.model_construct()
|
|
82
|
+
error_messages = []
|
|
83
|
+
match = 0
|
|
84
|
+
# validate data type: ClassificationMetadata
|
|
85
|
+
if not isinstance(v, ClassificationMetadata):
|
|
86
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ClassificationMetadata`")
|
|
87
|
+
else:
|
|
88
|
+
match += 1
|
|
89
|
+
# validate data type: CountMetadata
|
|
90
|
+
if not isinstance(v, CountMetadata):
|
|
91
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CountMetadata`")
|
|
92
|
+
else:
|
|
93
|
+
match += 1
|
|
94
|
+
# validate data type: ImageDimensionMetadata
|
|
95
|
+
if not isinstance(v, ImageDimensionMetadata):
|
|
96
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ImageDimensionMetadata`")
|
|
97
|
+
else:
|
|
98
|
+
match += 1
|
|
99
|
+
# validate data type: LocationMetadata
|
|
100
|
+
if not isinstance(v, LocationMetadata):
|
|
101
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocationMetadata`")
|
|
102
|
+
else:
|
|
103
|
+
match += 1
|
|
104
|
+
# validate data type: OriginalFilenameMetadata
|
|
105
|
+
if not isinstance(v, OriginalFilenameMetadata):
|
|
106
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `OriginalFilenameMetadata`")
|
|
107
|
+
else:
|
|
108
|
+
match += 1
|
|
109
|
+
# validate data type: PromptMetadata
|
|
110
|
+
if not isinstance(v, PromptMetadata):
|
|
111
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PromptMetadata`")
|
|
112
|
+
else:
|
|
113
|
+
match += 1
|
|
114
|
+
# validate data type: SourceUrlMetadata
|
|
115
|
+
if not isinstance(v, SourceUrlMetadata):
|
|
116
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `SourceUrlMetadata`")
|
|
117
|
+
else:
|
|
118
|
+
match += 1
|
|
119
|
+
# validate data type: TextMetadata
|
|
120
|
+
if not isinstance(v, TextMetadata):
|
|
121
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextMetadata`")
|
|
122
|
+
else:
|
|
123
|
+
match += 1
|
|
124
|
+
# validate data type: TranscriptionMetadata
|
|
125
|
+
if not isinstance(v, TranscriptionMetadata):
|
|
126
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionMetadata`")
|
|
127
|
+
else:
|
|
128
|
+
match += 1
|
|
129
|
+
if match > 1:
|
|
130
|
+
# 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))
|
|
132
|
+
elif match == 0:
|
|
133
|
+
# 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))
|
|
135
|
+
else:
|
|
136
|
+
return v
|
|
137
|
+
|
|
138
|
+
@classmethod
|
|
139
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
140
|
+
return cls.from_json(json.dumps(obj))
|
|
141
|
+
|
|
142
|
+
@classmethod
|
|
143
|
+
def from_json(cls, json_str: str) -> Self:
|
|
144
|
+
"""Returns the object represented by the json string"""
|
|
145
|
+
instance = cls.model_construct()
|
|
146
|
+
error_messages = []
|
|
147
|
+
match = 0
|
|
148
|
+
|
|
149
|
+
# deserialize data into ClassificationMetadata
|
|
150
|
+
try:
|
|
151
|
+
instance.actual_instance = ClassificationMetadata.from_json(json_str)
|
|
152
|
+
match += 1
|
|
153
|
+
except (ValidationError, ValueError) as e:
|
|
154
|
+
error_messages.append(str(e))
|
|
155
|
+
# deserialize data into CountMetadata
|
|
156
|
+
try:
|
|
157
|
+
instance.actual_instance = CountMetadata.from_json(json_str)
|
|
158
|
+
match += 1
|
|
159
|
+
except (ValidationError, ValueError) as e:
|
|
160
|
+
error_messages.append(str(e))
|
|
161
|
+
# deserialize data into ImageDimensionMetadata
|
|
162
|
+
try:
|
|
163
|
+
instance.actual_instance = ImageDimensionMetadata.from_json(json_str)
|
|
164
|
+
match += 1
|
|
165
|
+
except (ValidationError, ValueError) as e:
|
|
166
|
+
error_messages.append(str(e))
|
|
167
|
+
# deserialize data into LocationMetadata
|
|
168
|
+
try:
|
|
169
|
+
instance.actual_instance = LocationMetadata.from_json(json_str)
|
|
170
|
+
match += 1
|
|
171
|
+
except (ValidationError, ValueError) as e:
|
|
172
|
+
error_messages.append(str(e))
|
|
173
|
+
# deserialize data into OriginalFilenameMetadata
|
|
174
|
+
try:
|
|
175
|
+
instance.actual_instance = OriginalFilenameMetadata.from_json(json_str)
|
|
176
|
+
match += 1
|
|
177
|
+
except (ValidationError, ValueError) as e:
|
|
178
|
+
error_messages.append(str(e))
|
|
179
|
+
# deserialize data into PromptMetadata
|
|
180
|
+
try:
|
|
181
|
+
instance.actual_instance = PromptMetadata.from_json(json_str)
|
|
182
|
+
match += 1
|
|
183
|
+
except (ValidationError, ValueError) as e:
|
|
184
|
+
error_messages.append(str(e))
|
|
185
|
+
# deserialize data into SourceUrlMetadata
|
|
186
|
+
try:
|
|
187
|
+
instance.actual_instance = SourceUrlMetadata.from_json(json_str)
|
|
188
|
+
match += 1
|
|
189
|
+
except (ValidationError, ValueError) as e:
|
|
190
|
+
error_messages.append(str(e))
|
|
191
|
+
# deserialize data into TextMetadata
|
|
192
|
+
try:
|
|
193
|
+
instance.actual_instance = TextMetadata.from_json(json_str)
|
|
194
|
+
match += 1
|
|
195
|
+
except (ValidationError, ValueError) as e:
|
|
196
|
+
error_messages.append(str(e))
|
|
197
|
+
# deserialize data into TranscriptionMetadata
|
|
198
|
+
try:
|
|
199
|
+
instance.actual_instance = TranscriptionMetadata.from_json(json_str)
|
|
200
|
+
match += 1
|
|
201
|
+
except (ValidationError, ValueError) as e:
|
|
202
|
+
error_messages.append(str(e))
|
|
203
|
+
|
|
204
|
+
if match > 1:
|
|
205
|
+
# 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))
|
|
207
|
+
elif match == 0:
|
|
208
|
+
# 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))
|
|
210
|
+
else:
|
|
211
|
+
return instance
|
|
212
|
+
|
|
213
|
+
def to_json(self) -> str:
|
|
214
|
+
"""Returns the JSON representation of the actual instance"""
|
|
215
|
+
if self.actual_instance is None:
|
|
216
|
+
return "null"
|
|
217
|
+
|
|
218
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
219
|
+
return self.actual_instance.to_json()
|
|
220
|
+
else:
|
|
221
|
+
return json.dumps(self.actual_instance)
|
|
222
|
+
|
|
223
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], ClassificationMetadata, CountMetadata, ImageDimensionMetadata, LocationMetadata, OriginalFilenameMetadata, PromptMetadata, SourceUrlMetadata, TextMetadata, TranscriptionMetadata]]:
|
|
224
|
+
"""Returns the dict representation of the actual instance"""
|
|
225
|
+
if self.actual_instance is None:
|
|
226
|
+
return None
|
|
227
|
+
|
|
228
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
229
|
+
return self.actual_instance.to_dict()
|
|
230
|
+
else:
|
|
231
|
+
# primitive type
|
|
232
|
+
return self.actual_instance
|
|
233
|
+
|
|
234
|
+
def to_str(self) -> str:
|
|
235
|
+
"""Returns the string representation of the actual instance"""
|
|
236
|
+
return pprint.pformat(self.model_dump())
|
|
237
|
+
|
|
238
|
+
|
|
@@ -19,6 +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.compare_workflow_config_metadata_value import CompareWorkflowConfigMetadataValue
|
|
22
23
|
from rapidata.api_client.models.compare_workflow_config_model_pair_maker_config import CompareWorkflowConfigModelPairMakerConfig
|
|
23
24
|
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
24
25
|
from rapidata.api_client.models.elo_config import EloConfig
|
|
@@ -35,7 +36,8 @@ class CompareWorkflowConfigModel(BaseModel):
|
|
|
35
36
|
referee: CompareWorkflowModel1Referee
|
|
36
37
|
target_country_codes: List[StrictStr] = Field(description="A list of country codes that this workflow is targeting.", alias="targetCountryCodes")
|
|
37
38
|
elo_config: Optional[EloConfig] = Field(default=None, alias="eloConfig")
|
|
38
|
-
|
|
39
|
+
metadata: Dict[str, CompareWorkflowConfigMetadataValue] = Field(description="The metadata is attached to every single rapid and can be used for something like the prompt.")
|
|
40
|
+
__properties: ClassVar[List[str]] = ["_t", "criteria", "pairMakerConfig", "referee", "targetCountryCodes", "eloConfig", "metadata"]
|
|
39
41
|
|
|
40
42
|
@field_validator('t')
|
|
41
43
|
def t_validate_enum(cls, value):
|
|
@@ -92,6 +94,13 @@ class CompareWorkflowConfigModel(BaseModel):
|
|
|
92
94
|
# override the default output from pydantic by calling `to_dict()` of elo_config
|
|
93
95
|
if self.elo_config:
|
|
94
96
|
_dict['eloConfig'] = self.elo_config.to_dict()
|
|
97
|
+
# override the default output from pydantic by calling `to_dict()` of each value in metadata (dict)
|
|
98
|
+
_field_dict = {}
|
|
99
|
+
if self.metadata:
|
|
100
|
+
for _key_metadata in self.metadata:
|
|
101
|
+
if self.metadata[_key_metadata]:
|
|
102
|
+
_field_dict[_key_metadata] = self.metadata[_key_metadata].to_dict()
|
|
103
|
+
_dict['metadata'] = _field_dict
|
|
95
104
|
return _dict
|
|
96
105
|
|
|
97
106
|
@classmethod
|
|
@@ -109,7 +118,13 @@ class CompareWorkflowConfigModel(BaseModel):
|
|
|
109
118
|
"pairMakerConfig": CompareWorkflowConfigModelPairMakerConfig.from_dict(obj["pairMakerConfig"]) if obj.get("pairMakerConfig") is not None else None,
|
|
110
119
|
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
111
120
|
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
112
|
-
"eloConfig": EloConfig.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None
|
|
121
|
+
"eloConfig": EloConfig.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None,
|
|
122
|
+
"metadata": dict(
|
|
123
|
+
(_k, CompareWorkflowConfigMetadataValue.from_dict(_v))
|
|
124
|
+
for _k, _v in obj["metadata"].items()
|
|
125
|
+
)
|
|
126
|
+
if obj.get("metadata") is not None
|
|
127
|
+
else None
|
|
113
128
|
})
|
|
114
129
|
return _obj
|
|
115
130
|
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
22
|
from rapidata.api_client.models.compare_workflow_model_pair_maker_config import CompareWorkflowModelPairMakerConfig
|
|
23
|
+
from rapidata.api_client.models.create_datapoint_from_urls_model_metadata_inner import CreateDatapointFromUrlsModelMetadataInner
|
|
23
24
|
from rapidata.api_client.models.elo_config_model import EloConfigModel
|
|
24
25
|
from typing import Optional, Set
|
|
25
26
|
from typing_extensions import Self
|
|
@@ -32,7 +33,8 @@ class CompareWorkflowModel(BaseModel):
|
|
|
32
33
|
criteria: StrictStr = Field(description="The criteria that the datapoints should be compared based on. No default value.")
|
|
33
34
|
pair_maker_config: Optional[CompareWorkflowModelPairMakerConfig] = Field(default=None, alias="pairMakerConfig")
|
|
34
35
|
elo_config: Optional[EloConfigModel] = Field(default=None, alias="eloConfig")
|
|
35
|
-
|
|
36
|
+
metadata: Optional[List[CreateDatapointFromUrlsModelMetadataInner]] = Field(default=None, description="The metadata is attached to every single rapid and can be used for something like the prompt.")
|
|
37
|
+
__properties: ClassVar[List[str]] = ["_t", "criteria", "pairMakerConfig", "eloConfig", "metadata"]
|
|
36
38
|
|
|
37
39
|
@field_validator('t')
|
|
38
40
|
def t_validate_enum(cls, value):
|
|
@@ -86,6 +88,18 @@ class CompareWorkflowModel(BaseModel):
|
|
|
86
88
|
# override the default output from pydantic by calling `to_dict()` of elo_config
|
|
87
89
|
if self.elo_config:
|
|
88
90
|
_dict['eloConfig'] = self.elo_config.to_dict()
|
|
91
|
+
# override the default output from pydantic by calling `to_dict()` of each item in metadata (list)
|
|
92
|
+
_items = []
|
|
93
|
+
if self.metadata:
|
|
94
|
+
for _item_metadata in self.metadata:
|
|
95
|
+
if _item_metadata:
|
|
96
|
+
_items.append(_item_metadata.to_dict())
|
|
97
|
+
_dict['metadata'] = _items
|
|
98
|
+
# set to None if metadata (nullable) is None
|
|
99
|
+
# and model_fields_set contains the field
|
|
100
|
+
if self.metadata is None and "metadata" in self.model_fields_set:
|
|
101
|
+
_dict['metadata'] = None
|
|
102
|
+
|
|
89
103
|
return _dict
|
|
90
104
|
|
|
91
105
|
@classmethod
|
|
@@ -101,7 +115,8 @@ class CompareWorkflowModel(BaseModel):
|
|
|
101
115
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'CompareWorkflow',
|
|
102
116
|
"criteria": obj.get("criteria"),
|
|
103
117
|
"pairMakerConfig": CompareWorkflowModelPairMakerConfig.from_dict(obj["pairMakerConfig"]) if obj.get("pairMakerConfig") is not None else None,
|
|
104
|
-
"eloConfig": EloConfigModel.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None
|
|
118
|
+
"eloConfig": EloConfigModel.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None,
|
|
119
|
+
"metadata": [CreateDatapointFromUrlsModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None
|
|
105
120
|
})
|
|
106
121
|
return _obj
|
|
107
122
|
|
|
@@ -28,9 +28,8 @@ class CountMetadata(BaseModel):
|
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for CountMetadata", alias="_t")
|
|
30
30
|
count: StrictInt
|
|
31
|
-
identifier: Optional[StrictStr] = None
|
|
32
31
|
visibilities: Optional[StrictStr] = None
|
|
33
|
-
__properties: ClassVar[List[str]] = ["_t", "count", "
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "count", "visibilities"]
|
|
34
33
|
|
|
35
34
|
@field_validator('t')
|
|
36
35
|
def t_validate_enum(cls, value):
|
|
@@ -92,7 +91,6 @@ class CountMetadata(BaseModel):
|
|
|
92
91
|
_obj = cls.model_validate({
|
|
93
92
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'CountMetadata',
|
|
94
93
|
"count": obj.get("count"),
|
|
95
|
-
"identifier": obj.get("identifier"),
|
|
96
94
|
"visibilities": obj.get("visibilities")
|
|
97
95
|
})
|
|
98
96
|
return _obj
|
|
@@ -24,7 +24,7 @@ from typing_extensions import Self
|
|
|
24
24
|
|
|
25
25
|
class EarlyStoppingRefereeModel(BaseModel):
|
|
26
26
|
"""
|
|
27
|
-
The Early Stopping Referee can currently only be used for classification tasks and will stop once a certain
|
|
27
|
+
The Early Stopping Referee can currently only be used for classification tasks and will stop once a certain threshold is reached or the maximum number of votes is collected.
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for EarlyStoppingReferee", alias="_t")
|
|
30
30
|
max_votes: StrictInt = Field(description="The upper limit of votes that will be collected for each task.", alias="maxVotes")
|
|
@@ -0,0 +1,112 @@
|
|
|
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
|
|
22
|
+
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
23
|
+
from rapidata.api_client.models.rapid_response import RapidResponse
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class GetRapidResponsesResult(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GetRapidResponsesResult
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
rapid_id: StrictStr = Field(alias="rapidId")
|
|
32
|
+
asset: DatapointAsset
|
|
33
|
+
responses: List[RapidResponse]
|
|
34
|
+
state: StrictStr
|
|
35
|
+
__properties: ClassVar[List[str]] = ["rapidId", "asset", "responses", "state"]
|
|
36
|
+
|
|
37
|
+
@field_validator('state')
|
|
38
|
+
def state_validate_enum(cls, value):
|
|
39
|
+
"""Validates the enum"""
|
|
40
|
+
if value not in set(['Labeling', 'Paused', 'Incomplete', 'Done', 'None']):
|
|
41
|
+
raise ValueError("must be one of enum values ('Labeling', 'Paused', 'Incomplete', 'Done', 'None')")
|
|
42
|
+
return value
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
populate_by_name=True,
|
|
46
|
+
validate_assignment=True,
|
|
47
|
+
protected_namespaces=(),
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def to_str(self) -> str:
|
|
52
|
+
"""Returns the string representation of the model using alias"""
|
|
53
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> str:
|
|
56
|
+
"""Returns the JSON representation of the model using alias"""
|
|
57
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
58
|
+
return json.dumps(self.to_dict())
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
62
|
+
"""Create an instance of GetRapidResponsesResult from a JSON string"""
|
|
63
|
+
return cls.from_dict(json.loads(json_str))
|
|
64
|
+
|
|
65
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
66
|
+
"""Return the dictionary representation of the model using alias.
|
|
67
|
+
|
|
68
|
+
This has the following differences from calling pydantic's
|
|
69
|
+
`self.model_dump(by_alias=True)`:
|
|
70
|
+
|
|
71
|
+
* `None` is only added to the output dict for nullable fields that
|
|
72
|
+
were set at model initialization. Other fields with value `None`
|
|
73
|
+
are ignored.
|
|
74
|
+
"""
|
|
75
|
+
excluded_fields: Set[str] = set([
|
|
76
|
+
])
|
|
77
|
+
|
|
78
|
+
_dict = self.model_dump(
|
|
79
|
+
by_alias=True,
|
|
80
|
+
exclude=excluded_fields,
|
|
81
|
+
exclude_none=True,
|
|
82
|
+
)
|
|
83
|
+
# override the default output from pydantic by calling `to_dict()` of asset
|
|
84
|
+
if self.asset:
|
|
85
|
+
_dict['asset'] = self.asset.to_dict()
|
|
86
|
+
# override the default output from pydantic by calling `to_dict()` of each item in responses (list)
|
|
87
|
+
_items = []
|
|
88
|
+
if self.responses:
|
|
89
|
+
for _item_responses in self.responses:
|
|
90
|
+
if _item_responses:
|
|
91
|
+
_items.append(_item_responses.to_dict())
|
|
92
|
+
_dict['responses'] = _items
|
|
93
|
+
return _dict
|
|
94
|
+
|
|
95
|
+
@classmethod
|
|
96
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
97
|
+
"""Create an instance of GetRapidResponsesResult from a dict"""
|
|
98
|
+
if obj is None:
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
if not isinstance(obj, dict):
|
|
102
|
+
return cls.model_validate(obj)
|
|
103
|
+
|
|
104
|
+
_obj = cls.model_validate({
|
|
105
|
+
"rapidId": obj.get("rapidId"),
|
|
106
|
+
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
107
|
+
"responses": [RapidResponse.from_dict(_item) for _item in obj["responses"]] if obj.get("responses") is not None else None,
|
|
108
|
+
"state": obj.get("state")
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -20,6 +20,7 @@ import json
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List
|
|
22
22
|
from rapidata.api_client.models.datapoint_asset import DatapointAsset
|
|
23
|
+
from rapidata.api_client.models.query_validation_rapids_result_payload import QueryValidationRapidsResultPayload
|
|
23
24
|
from rapidata.api_client.models.rapid_response import RapidResponse
|
|
24
25
|
from typing import Optional, Set
|
|
25
26
|
from typing_extensions import Self
|
|
@@ -29,10 +30,11 @@ class GetSimpleWorkflowResultsResult(BaseModel):
|
|
|
29
30
|
GetSimpleWorkflowResultsResult
|
|
30
31
|
""" # noqa: E501
|
|
31
32
|
rapid_id: StrictStr = Field(alias="rapidId")
|
|
33
|
+
payload: QueryValidationRapidsResultPayload
|
|
32
34
|
asset: DatapointAsset
|
|
33
35
|
responses: List[RapidResponse]
|
|
34
36
|
state: StrictStr
|
|
35
|
-
__properties: ClassVar[List[str]] = ["rapidId", "asset", "responses", "state"]
|
|
37
|
+
__properties: ClassVar[List[str]] = ["rapidId", "payload", "asset", "responses", "state"]
|
|
36
38
|
|
|
37
39
|
@field_validator('state')
|
|
38
40
|
def state_validate_enum(cls, value):
|
|
@@ -80,6 +82,9 @@ class GetSimpleWorkflowResultsResult(BaseModel):
|
|
|
80
82
|
exclude=excluded_fields,
|
|
81
83
|
exclude_none=True,
|
|
82
84
|
)
|
|
85
|
+
# override the default output from pydantic by calling `to_dict()` of payload
|
|
86
|
+
if self.payload:
|
|
87
|
+
_dict['payload'] = self.payload.to_dict()
|
|
83
88
|
# override the default output from pydantic by calling `to_dict()` of asset
|
|
84
89
|
if self.asset:
|
|
85
90
|
_dict['asset'] = self.asset.to_dict()
|
|
@@ -103,6 +108,7 @@ class GetSimpleWorkflowResultsResult(BaseModel):
|
|
|
103
108
|
|
|
104
109
|
_obj = cls.model_validate({
|
|
105
110
|
"rapidId": obj.get("rapidId"),
|
|
111
|
+
"payload": QueryValidationRapidsResultPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
106
112
|
"asset": DatapointAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
107
113
|
"responses": [RapidResponse.from_dict(_item) for _item in obj["responses"]] if obj.get("responses") is not None else None,
|
|
108
114
|
"state": obj.get("state")
|
|
@@ -29,9 +29,8 @@ class ImageDimensionMetadata(BaseModel):
|
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for ImageDimensionMetadata", alias="_t")
|
|
30
30
|
height: Optional[StrictInt] = None
|
|
31
31
|
width: Optional[StrictInt] = None
|
|
32
|
-
identifier: Optional[StrictStr] = None
|
|
33
32
|
visibilities: Optional[StrictStr] = None
|
|
34
|
-
__properties: ClassVar[List[str]] = ["_t", "height", "width", "
|
|
33
|
+
__properties: ClassVar[List[str]] = ["_t", "height", "width", "visibilities"]
|
|
35
34
|
|
|
36
35
|
@field_validator('t')
|
|
37
36
|
def t_validate_enum(cls, value):
|
|
@@ -94,7 +93,6 @@ class ImageDimensionMetadata(BaseModel):
|
|
|
94
93
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'ImageDimensionMetadata',
|
|
95
94
|
"height": obj.get("height"),
|
|
96
95
|
"width": obj.get("width"),
|
|
97
|
-
"identifier": obj.get("identifier"),
|
|
98
96
|
"visibilities": obj.get("visibilities")
|
|
99
97
|
})
|
|
100
98
|
return _obj
|
|
@@ -30,8 +30,7 @@ class LocationMetadata(BaseModel):
|
|
|
30
30
|
x: Union[StrictFloat, StrictInt]
|
|
31
31
|
y: Union[StrictFloat, StrictInt]
|
|
32
32
|
visibilities: Optional[StrictStr] = None
|
|
33
|
-
|
|
34
|
-
__properties: ClassVar[List[str]] = ["_t", "x", "y", "visibilities", "identifier"]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["_t", "x", "y", "visibilities"]
|
|
35
34
|
|
|
36
35
|
@field_validator('t')
|
|
37
36
|
def t_validate_enum(cls, value):
|
|
@@ -94,8 +93,7 @@ class LocationMetadata(BaseModel):
|
|
|
94
93
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'LocationMetadata',
|
|
95
94
|
"x": obj.get("x"),
|
|
96
95
|
"y": obj.get("y"),
|
|
97
|
-
"visibilities": obj.get("visibilities")
|
|
98
|
-
"identifier": obj.get("identifier")
|
|
96
|
+
"visibilities": obj.get("visibilities")
|
|
99
97
|
})
|
|
100
98
|
return _obj
|
|
101
99
|
|
|
@@ -29,8 +29,7 @@ class OriginalFilenameMetadata(BaseModel):
|
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for OriginalFilenameMetadata", alias="_t")
|
|
30
30
|
original_filename: StrictStr = Field(alias="originalFilename")
|
|
31
31
|
visibilities: Optional[StrictStr] = None
|
|
32
|
-
|
|
33
|
-
__properties: ClassVar[List[str]] = ["_t", "originalFilename", "visibilities", "identifier"]
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "originalFilename", "visibilities"]
|
|
34
33
|
|
|
35
34
|
@field_validator('t')
|
|
36
35
|
def t_validate_enum(cls, value):
|
|
@@ -92,8 +91,7 @@ class OriginalFilenameMetadata(BaseModel):
|
|
|
92
91
|
_obj = cls.model_validate({
|
|
93
92
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'OriginalFilenameMetadata',
|
|
94
93
|
"originalFilename": obj.get("originalFilename"),
|
|
95
|
-
"visibilities": obj.get("visibilities")
|
|
96
|
-
"identifier": obj.get("identifier")
|
|
94
|
+
"visibilities": obj.get("visibilities")
|
|
97
95
|
})
|
|
98
96
|
return _obj
|
|
99
97
|
|
|
@@ -28,9 +28,8 @@ class PromptMetadata(BaseModel):
|
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for PromptMetadata", alias="_t")
|
|
30
30
|
prompt: StrictStr
|
|
31
|
-
identifier: Optional[StrictStr] = None
|
|
32
31
|
visibilities: Optional[StrictStr] = None
|
|
33
|
-
__properties: ClassVar[List[str]] = ["_t", "prompt", "
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "prompt", "visibilities"]
|
|
34
33
|
|
|
35
34
|
@field_validator('t')
|
|
36
35
|
def t_validate_enum(cls, value):
|
|
@@ -92,7 +91,6 @@ class PromptMetadata(BaseModel):
|
|
|
92
91
|
_obj = cls.model_validate({
|
|
93
92
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'PromptMetadata',
|
|
94
93
|
"prompt": obj.get("prompt"),
|
|
95
|
-
"identifier": obj.get("identifier"),
|
|
96
94
|
"visibilities": obj.get("visibilities")
|
|
97
95
|
})
|
|
98
96
|
return _obj
|
|
@@ -27,9 +27,9 @@ class ScrubResult(BaseModel):
|
|
|
27
27
|
ScrubResult
|
|
28
28
|
""" # noqa: E501
|
|
29
29
|
t: StrictStr = Field(description="Discriminator value for ScrubResult", alias="_t")
|
|
30
|
-
rapid_id: StrictStr = Field(alias="rapidId")
|
|
31
30
|
timestamps: List[StrictInt]
|
|
32
|
-
|
|
31
|
+
rapid_id: StrictStr = Field(alias="rapidId")
|
|
32
|
+
__properties: ClassVar[List[str]] = ["_t", "timestamps", "rapidId"]
|
|
33
33
|
|
|
34
34
|
@field_validator('t')
|
|
35
35
|
def t_validate_enum(cls, value):
|
|
@@ -90,8 +90,8 @@ class ScrubResult(BaseModel):
|
|
|
90
90
|
|
|
91
91
|
_obj = cls.model_validate({
|
|
92
92
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'ScrubResult',
|
|
93
|
-
"
|
|
94
|
-
"
|
|
93
|
+
"timestamps": obj.get("timestamps"),
|
|
94
|
+
"rapidId": obj.get("rapidId")
|
|
95
95
|
})
|
|
96
96
|
return _obj
|
|
97
97
|
|