rapidata 2.5.0__py3-none-any.whl → 2.7.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/api_client/__init__.py +17 -15
- rapidata/api_client/api/compare_workflow_api.py +49 -48
- rapidata/api_client/api/pipeline_api.py +559 -2
- rapidata/api_client/api/rapid_api.py +283 -0
- rapidata/api_client/api/simple_workflow_api.py +49 -82
- rapidata/api_client/api/workflow_api.py +0 -264
- rapidata/api_client/models/__init__.py +17 -15
- rapidata/api_client/models/ab_test_selection.py +122 -0
- rapidata/api_client/models/ab_test_selection_a_inner.py +212 -0
- rapidata/api_client/models/add_campaign_model.py +3 -3
- rapidata/api_client/models/capped_selection.py +3 -3
- rapidata/api_client/models/compare_match_status.py +39 -0
- rapidata/api_client/models/create_order_model.py +3 -3
- rapidata/api_client/models/get_compare_workflow_results_model.py +114 -0
- rapidata/api_client/models/get_compare_workflow_results_result.py +104 -0
- rapidata/api_client/models/get_compare_workflow_results_result_asset.py +170 -0
- rapidata/api_client/models/get_compare_workflow_results_result_paged_result.py +105 -0
- rapidata/api_client/models/get_simple_workflow_results_model.py +114 -0
- rapidata/api_client/models/get_simple_workflow_results_result.py +112 -0
- rapidata/api_client/models/get_simple_workflow_results_result_paged_result.py +105 -0
- rapidata/api_client/models/multi_asset_model2.py +3 -3
- rapidata/api_client/models/order_model.py +3 -1
- rapidata/api_client/models/preliminary_download_model.py +87 -0
- rapidata/api_client/models/preliminary_download_result.py +87 -0
- rapidata/api_client/models/query_validation_rapids_result.py +11 -2
- rapidata/api_client/models/rapid_response.py +101 -0
- rapidata/api_client/models/rapid_response_result.py +266 -0
- rapidata/api_client/models/rapid_state.py +40 -0
- rapidata/api_client/models/update_validation_rapid_model.py +105 -0
- rapidata/api_client/models/update_validation_rapid_model_truth.py +252 -0
- rapidata/api_client_README.md +22 -18
- rapidata/rapidata_client/order/_rapidata_order_builder.py +3 -3
- rapidata/rapidata_client/order/rapidata_order.py +41 -4
- rapidata/rapidata_client/selection/ab_test_selection.py +38 -0
- rapidata/rapidata_client/selection/capped_selection.py +3 -3
- {rapidata-2.5.0.dist-info → rapidata-2.7.0.dist-info}/METADATA +1 -1
- {rapidata-2.5.0.dist-info → rapidata-2.7.0.dist-info}/RECORD +39 -21
- {rapidata-2.5.0.dist-info → rapidata-2.7.0.dist-info}/LICENSE +0 -0
- {rapidata-2.5.0.dist-info → rapidata-2.7.0.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,105 @@
|
|
|
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, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.update_validation_rapid_model_truth import UpdateValidationRapidModelTruth
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class UpdateValidationRapidModel(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
The model for updating a validation rapid.
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
truth: UpdateValidationRapidModelTruth
|
|
31
|
+
explanation: Optional[StrictStr]
|
|
32
|
+
prompt: Optional[StrictStr]
|
|
33
|
+
__properties: ClassVar[List[str]] = ["truth", "explanation", "prompt"]
|
|
34
|
+
|
|
35
|
+
model_config = ConfigDict(
|
|
36
|
+
populate_by_name=True,
|
|
37
|
+
validate_assignment=True,
|
|
38
|
+
protected_namespaces=(),
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def to_str(self) -> str:
|
|
43
|
+
"""Returns the string representation of the model using alias"""
|
|
44
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
45
|
+
|
|
46
|
+
def to_json(self) -> str:
|
|
47
|
+
"""Returns the JSON representation of the model using alias"""
|
|
48
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
49
|
+
return json.dumps(self.to_dict())
|
|
50
|
+
|
|
51
|
+
@classmethod
|
|
52
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
53
|
+
"""Create an instance of UpdateValidationRapidModel from a JSON string"""
|
|
54
|
+
return cls.from_dict(json.loads(json_str))
|
|
55
|
+
|
|
56
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
57
|
+
"""Return the dictionary representation of the model using alias.
|
|
58
|
+
|
|
59
|
+
This has the following differences from calling pydantic's
|
|
60
|
+
`self.model_dump(by_alias=True)`:
|
|
61
|
+
|
|
62
|
+
* `None` is only added to the output dict for nullable fields that
|
|
63
|
+
were set at model initialization. Other fields with value `None`
|
|
64
|
+
are ignored.
|
|
65
|
+
"""
|
|
66
|
+
excluded_fields: Set[str] = set([
|
|
67
|
+
])
|
|
68
|
+
|
|
69
|
+
_dict = self.model_dump(
|
|
70
|
+
by_alias=True,
|
|
71
|
+
exclude=excluded_fields,
|
|
72
|
+
exclude_none=True,
|
|
73
|
+
)
|
|
74
|
+
# override the default output from pydantic by calling `to_dict()` of truth
|
|
75
|
+
if self.truth:
|
|
76
|
+
_dict['truth'] = self.truth.to_dict()
|
|
77
|
+
# set to None if explanation (nullable) is None
|
|
78
|
+
# and model_fields_set contains the field
|
|
79
|
+
if self.explanation is None and "explanation" in self.model_fields_set:
|
|
80
|
+
_dict['explanation'] = None
|
|
81
|
+
|
|
82
|
+
# set to None if prompt (nullable) is None
|
|
83
|
+
# and model_fields_set contains the field
|
|
84
|
+
if self.prompt is None and "prompt" in self.model_fields_set:
|
|
85
|
+
_dict['prompt'] = None
|
|
86
|
+
|
|
87
|
+
return _dict
|
|
88
|
+
|
|
89
|
+
@classmethod
|
|
90
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
91
|
+
"""Create an instance of UpdateValidationRapidModel from a dict"""
|
|
92
|
+
if obj is None:
|
|
93
|
+
return None
|
|
94
|
+
|
|
95
|
+
if not isinstance(obj, dict):
|
|
96
|
+
return cls.model_validate(obj)
|
|
97
|
+
|
|
98
|
+
_obj = cls.model_validate({
|
|
99
|
+
"truth": UpdateValidationRapidModelTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
|
|
100
|
+
"explanation": obj.get("explanation"),
|
|
101
|
+
"prompt": obj.get("prompt")
|
|
102
|
+
})
|
|
103
|
+
return _obj
|
|
104
|
+
|
|
105
|
+
|
|
@@ -0,0 +1,252 @@
|
|
|
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.attach_category_truth import AttachCategoryTruth
|
|
21
|
+
from rapidata.api_client.models.bounding_box_truth import BoundingBoxTruth
|
|
22
|
+
from rapidata.api_client.models.compare_truth import CompareTruth
|
|
23
|
+
from rapidata.api_client.models.empty_validation_truth import EmptyValidationTruth
|
|
24
|
+
from rapidata.api_client.models.line_truth import LineTruth
|
|
25
|
+
from rapidata.api_client.models.locate_box_truth import LocateBoxTruth
|
|
26
|
+
from rapidata.api_client.models.named_entity_truth import NamedEntityTruth
|
|
27
|
+
from rapidata.api_client.models.polygon_truth import PolygonTruth
|
|
28
|
+
from rapidata.api_client.models.scrub_truth import ScrubTruth
|
|
29
|
+
from rapidata.api_client.models.transcription_truth import TranscriptionTruth
|
|
30
|
+
from pydantic import StrictStr, Field
|
|
31
|
+
from typing import Union, List, Set, Optional, Dict
|
|
32
|
+
from typing_extensions import Literal, Self
|
|
33
|
+
|
|
34
|
+
UPDATEVALIDATIONRAPIDMODELTRUTH_ONE_OF_SCHEMAS = ["AttachCategoryTruth", "BoundingBoxTruth", "CompareTruth", "EmptyValidationTruth", "LineTruth", "LocateBoxTruth", "NamedEntityTruth", "PolygonTruth", "ScrubTruth", "TranscriptionTruth"]
|
|
35
|
+
|
|
36
|
+
class UpdateValidationRapidModelTruth(BaseModel):
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
"""
|
|
40
|
+
# data type: TranscriptionTruth
|
|
41
|
+
oneof_schema_1_validator: Optional[TranscriptionTruth] = None
|
|
42
|
+
# data type: ScrubTruth
|
|
43
|
+
oneof_schema_2_validator: Optional[ScrubTruth] = None
|
|
44
|
+
# data type: PolygonTruth
|
|
45
|
+
oneof_schema_3_validator: Optional[PolygonTruth] = None
|
|
46
|
+
# data type: NamedEntityTruth
|
|
47
|
+
oneof_schema_4_validator: Optional[NamedEntityTruth] = None
|
|
48
|
+
# data type: LocateBoxTruth
|
|
49
|
+
oneof_schema_5_validator: Optional[LocateBoxTruth] = None
|
|
50
|
+
# data type: LineTruth
|
|
51
|
+
oneof_schema_6_validator: Optional[LineTruth] = None
|
|
52
|
+
# data type: EmptyValidationTruth
|
|
53
|
+
oneof_schema_7_validator: Optional[EmptyValidationTruth] = None
|
|
54
|
+
# data type: CompareTruth
|
|
55
|
+
oneof_schema_8_validator: Optional[CompareTruth] = None
|
|
56
|
+
# data type: AttachCategoryTruth
|
|
57
|
+
oneof_schema_9_validator: Optional[AttachCategoryTruth] = None
|
|
58
|
+
# data type: BoundingBoxTruth
|
|
59
|
+
oneof_schema_10_validator: Optional[BoundingBoxTruth] = None
|
|
60
|
+
actual_instance: Optional[Union[AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth]] = None
|
|
61
|
+
one_of_schemas: Set[str] = { "AttachCategoryTruth", "BoundingBoxTruth", "CompareTruth", "EmptyValidationTruth", "LineTruth", "LocateBoxTruth", "NamedEntityTruth", "PolygonTruth", "ScrubTruth", "TranscriptionTruth" }
|
|
62
|
+
|
|
63
|
+
model_config = ConfigDict(
|
|
64
|
+
validate_assignment=True,
|
|
65
|
+
protected_namespaces=(),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
73
|
+
if args:
|
|
74
|
+
if len(args) > 1:
|
|
75
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
76
|
+
if kwargs:
|
|
77
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
78
|
+
super().__init__(actual_instance=args[0])
|
|
79
|
+
else:
|
|
80
|
+
super().__init__(**kwargs)
|
|
81
|
+
|
|
82
|
+
@field_validator('actual_instance')
|
|
83
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
84
|
+
instance = UpdateValidationRapidModelTruth.model_construct()
|
|
85
|
+
error_messages = []
|
|
86
|
+
match = 0
|
|
87
|
+
# validate data type: TranscriptionTruth
|
|
88
|
+
if not isinstance(v, TranscriptionTruth):
|
|
89
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionTruth`")
|
|
90
|
+
else:
|
|
91
|
+
match += 1
|
|
92
|
+
# validate data type: ScrubTruth
|
|
93
|
+
if not isinstance(v, ScrubTruth):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `ScrubTruth`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
97
|
+
# validate data type: PolygonTruth
|
|
98
|
+
if not isinstance(v, PolygonTruth):
|
|
99
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonTruth`")
|
|
100
|
+
else:
|
|
101
|
+
match += 1
|
|
102
|
+
# validate data type: NamedEntityTruth
|
|
103
|
+
if not isinstance(v, NamedEntityTruth):
|
|
104
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityTruth`")
|
|
105
|
+
else:
|
|
106
|
+
match += 1
|
|
107
|
+
# validate data type: LocateBoxTruth
|
|
108
|
+
if not isinstance(v, LocateBoxTruth):
|
|
109
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocateBoxTruth`")
|
|
110
|
+
else:
|
|
111
|
+
match += 1
|
|
112
|
+
# validate data type: LineTruth
|
|
113
|
+
if not isinstance(v, LineTruth):
|
|
114
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LineTruth`")
|
|
115
|
+
else:
|
|
116
|
+
match += 1
|
|
117
|
+
# validate data type: EmptyValidationTruth
|
|
118
|
+
if not isinstance(v, EmptyValidationTruth):
|
|
119
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `EmptyValidationTruth`")
|
|
120
|
+
else:
|
|
121
|
+
match += 1
|
|
122
|
+
# validate data type: CompareTruth
|
|
123
|
+
if not isinstance(v, CompareTruth):
|
|
124
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareTruth`")
|
|
125
|
+
else:
|
|
126
|
+
match += 1
|
|
127
|
+
# validate data type: AttachCategoryTruth
|
|
128
|
+
if not isinstance(v, AttachCategoryTruth):
|
|
129
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AttachCategoryTruth`")
|
|
130
|
+
else:
|
|
131
|
+
match += 1
|
|
132
|
+
# validate data type: BoundingBoxTruth
|
|
133
|
+
if not isinstance(v, BoundingBoxTruth):
|
|
134
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxTruth`")
|
|
135
|
+
else:
|
|
136
|
+
match += 1
|
|
137
|
+
if match > 1:
|
|
138
|
+
# more than 1 match
|
|
139
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in UpdateValidationRapidModelTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
|
|
140
|
+
elif match == 0:
|
|
141
|
+
# no match
|
|
142
|
+
raise ValueError("No match found when setting `actual_instance` in UpdateValidationRapidModelTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
|
|
143
|
+
else:
|
|
144
|
+
return v
|
|
145
|
+
|
|
146
|
+
@classmethod
|
|
147
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
148
|
+
return cls.from_json(json.dumps(obj))
|
|
149
|
+
|
|
150
|
+
@classmethod
|
|
151
|
+
def from_json(cls, json_str: str) -> Self:
|
|
152
|
+
"""Returns the object represented by the json string"""
|
|
153
|
+
instance = cls.model_construct()
|
|
154
|
+
error_messages = []
|
|
155
|
+
match = 0
|
|
156
|
+
|
|
157
|
+
# deserialize data into TranscriptionTruth
|
|
158
|
+
try:
|
|
159
|
+
instance.actual_instance = TranscriptionTruth.from_json(json_str)
|
|
160
|
+
match += 1
|
|
161
|
+
except (ValidationError, ValueError) as e:
|
|
162
|
+
error_messages.append(str(e))
|
|
163
|
+
# deserialize data into ScrubTruth
|
|
164
|
+
try:
|
|
165
|
+
instance.actual_instance = ScrubTruth.from_json(json_str)
|
|
166
|
+
match += 1
|
|
167
|
+
except (ValidationError, ValueError) as e:
|
|
168
|
+
error_messages.append(str(e))
|
|
169
|
+
# deserialize data into PolygonTruth
|
|
170
|
+
try:
|
|
171
|
+
instance.actual_instance = PolygonTruth.from_json(json_str)
|
|
172
|
+
match += 1
|
|
173
|
+
except (ValidationError, ValueError) as e:
|
|
174
|
+
error_messages.append(str(e))
|
|
175
|
+
# deserialize data into NamedEntityTruth
|
|
176
|
+
try:
|
|
177
|
+
instance.actual_instance = NamedEntityTruth.from_json(json_str)
|
|
178
|
+
match += 1
|
|
179
|
+
except (ValidationError, ValueError) as e:
|
|
180
|
+
error_messages.append(str(e))
|
|
181
|
+
# deserialize data into LocateBoxTruth
|
|
182
|
+
try:
|
|
183
|
+
instance.actual_instance = LocateBoxTruth.from_json(json_str)
|
|
184
|
+
match += 1
|
|
185
|
+
except (ValidationError, ValueError) as e:
|
|
186
|
+
error_messages.append(str(e))
|
|
187
|
+
# deserialize data into LineTruth
|
|
188
|
+
try:
|
|
189
|
+
instance.actual_instance = LineTruth.from_json(json_str)
|
|
190
|
+
match += 1
|
|
191
|
+
except (ValidationError, ValueError) as e:
|
|
192
|
+
error_messages.append(str(e))
|
|
193
|
+
# deserialize data into EmptyValidationTruth
|
|
194
|
+
try:
|
|
195
|
+
instance.actual_instance = EmptyValidationTruth.from_json(json_str)
|
|
196
|
+
match += 1
|
|
197
|
+
except (ValidationError, ValueError) as e:
|
|
198
|
+
error_messages.append(str(e))
|
|
199
|
+
# deserialize data into CompareTruth
|
|
200
|
+
try:
|
|
201
|
+
instance.actual_instance = CompareTruth.from_json(json_str)
|
|
202
|
+
match += 1
|
|
203
|
+
except (ValidationError, ValueError) as e:
|
|
204
|
+
error_messages.append(str(e))
|
|
205
|
+
# deserialize data into AttachCategoryTruth
|
|
206
|
+
try:
|
|
207
|
+
instance.actual_instance = AttachCategoryTruth.from_json(json_str)
|
|
208
|
+
match += 1
|
|
209
|
+
except (ValidationError, ValueError) as e:
|
|
210
|
+
error_messages.append(str(e))
|
|
211
|
+
# deserialize data into BoundingBoxTruth
|
|
212
|
+
try:
|
|
213
|
+
instance.actual_instance = BoundingBoxTruth.from_json(json_str)
|
|
214
|
+
match += 1
|
|
215
|
+
except (ValidationError, ValueError) as e:
|
|
216
|
+
error_messages.append(str(e))
|
|
217
|
+
|
|
218
|
+
if match > 1:
|
|
219
|
+
# more than 1 match
|
|
220
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into UpdateValidationRapidModelTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
|
|
221
|
+
elif match == 0:
|
|
222
|
+
# no match
|
|
223
|
+
raise ValueError("No match found when deserializing the JSON string into UpdateValidationRapidModelTruth with oneOf schemas: AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth. Details: " + ", ".join(error_messages))
|
|
224
|
+
else:
|
|
225
|
+
return instance
|
|
226
|
+
|
|
227
|
+
def to_json(self) -> str:
|
|
228
|
+
"""Returns the JSON representation of the actual instance"""
|
|
229
|
+
if self.actual_instance is None:
|
|
230
|
+
return "null"
|
|
231
|
+
|
|
232
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
233
|
+
return self.actual_instance.to_json()
|
|
234
|
+
else:
|
|
235
|
+
return json.dumps(self.actual_instance)
|
|
236
|
+
|
|
237
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], AttachCategoryTruth, BoundingBoxTruth, CompareTruth, EmptyValidationTruth, LineTruth, LocateBoxTruth, NamedEntityTruth, PolygonTruth, ScrubTruth, TranscriptionTruth]]:
|
|
238
|
+
"""Returns the dict representation of the actual instance"""
|
|
239
|
+
if self.actual_instance is None:
|
|
240
|
+
return None
|
|
241
|
+
|
|
242
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
243
|
+
return self.actual_instance.to_dict()
|
|
244
|
+
else:
|
|
245
|
+
# primitive type
|
|
246
|
+
return self.actual_instance
|
|
247
|
+
|
|
248
|
+
def to_str(self) -> str:
|
|
249
|
+
"""Returns the string representation of the actual instance"""
|
|
250
|
+
return pprint.pformat(self.model_dump())
|
|
251
|
+
|
|
252
|
+
|
rapidata/api_client_README.md
CHANGED
|
@@ -81,7 +81,7 @@ Class | Method | HTTP request | Description
|
|
|
81
81
|
*ClientApi* | [**client_set_referrer_post**](rapidata/api_client/docs/ClientApi.md#client_set_referrer_post) | **POST** /Client/SetReferrer | Sets the referrer for the current customer.
|
|
82
82
|
*CocoApi* | [**coco_submit_post**](rapidata/api_client/docs/CocoApi.md#coco_submit_post) | **POST** /Coco/Submit | Creates a new validation set based on a previously uploaded CoCo set.
|
|
83
83
|
*CocoApi* | [**coco_upload_post**](rapidata/api_client/docs/CocoApi.md#coco_upload_post) | **POST** /Coco/Upload | Uploads a CoCo set to the system.
|
|
84
|
-
*CompareWorkflowApi* | [**
|
|
84
|
+
*CompareWorkflowApi* | [**workflow_compare_id_results_get**](rapidata/api_client/docs/CompareWorkflowApi.md#workflow_compare_id_results_get) | **GET** /workflow/compare/{id}/results | Get the result overview for a compare workflow.
|
|
85
85
|
*DatapointApi* | [**datapoint_delete_delete**](rapidata/api_client/docs/DatapointApi.md#datapoint_delete_delete) | **DELETE** /Datapoint/Delete | Delete a datapoint.
|
|
86
86
|
*DatapointApi* | [**datapoint_get_all_datapoints_by_dataset_id_get**](rapidata/api_client/docs/DatapointApi.md#datapoint_get_all_datapoints_by_dataset_id_get) | **GET** /Datapoint/GetAllDatapointsByDatasetId | Get all datapoints of a dataset.
|
|
87
87
|
*DatapointApi* | [**datapoint_get_by_id_get**](rapidata/api_client/docs/DatapointApi.md#datapoint_get_by_id_get) | **GET** /Datapoint/GetById | Get a datapoint by its id.
|
|
@@ -124,14 +124,17 @@ Class | Method | HTTP request | Description
|
|
|
124
124
|
*PipelineApi* | [**pipeline_id_get**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_get) | **GET** /Pipeline/{id} | Gets a pipeline by its id.
|
|
125
125
|
*PipelineApi* | [**pipeline_id_workflow_artifact_id_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_workflow_artifact_id_put) | **PUT** /pipeline/{id}/workflow/{artifact-id} | Updates the workflow configuration for a pipeline.
|
|
126
126
|
*PipelineApi* | [**pipeline_id_workflow_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_workflow_put) | **PUT** /pipeline/{id}/workflow | Updates the workflow configuration for a pipeline.
|
|
127
|
+
*PipelineApi* | [**pipeline_pipeline_id_preliminary_download_post**](rapidata/api_client/docs/PipelineApi.md#pipeline_pipeline_id_preliminary_download_post) | **POST** /pipeline/{pipelineId}/preliminary-download | Initiates a preliminary download of the pipeline.
|
|
128
|
+
*PipelineApi* | [**pipeline_preliminary_download_preliminary_download_id_get**](rapidata/api_client/docs/PipelineApi.md#pipeline_preliminary_download_preliminary_download_id_get) | **GET** /pipeline/preliminary-download/{preliminaryDownloadId} | Gets the preliminary download. If it's still processing the request will return 202 Accepted.
|
|
127
129
|
*RapidApi* | [**rapid_add_user_guess_post**](rapidata/api_client/docs/RapidApi.md#rapid_add_user_guess_post) | **POST** /Rapid/AddUserGuess | Submits a user guess for a Rapid.
|
|
128
130
|
*RapidApi* | [**rapid_create_demographic_rapid_post**](rapidata/api_client/docs/RapidApi.md#rapid_create_demographic_rapid_post) | **POST** /Rapid/CreateDemographicRapid | Creates a new Demographic Rapid.
|
|
129
131
|
*RapidApi* | [**rapid_query_validation_rapids_get**](rapidata/api_client/docs/RapidApi.md#rapid_query_validation_rapids_get) | **GET** /Rapid/QueryValidationRapids | Queries the validation rapids for a specific validation set.
|
|
130
132
|
*RapidApi* | [**rapid_report_post**](rapidata/api_client/docs/RapidApi.md#rapid_report_post) | **POST** /Rapid/Report | Used to report an issue with a rapid.
|
|
131
133
|
*RapidApi* | [**rapid_skip_user_guess_post**](rapidata/api_client/docs/RapidApi.md#rapid_skip_user_guess_post) | **POST** /Rapid/SkipUserGuess | Skips a Rapid for the user.
|
|
132
134
|
*RapidApi* | [**rapid_validate_current_rapid_bag_get**](rapidata/api_client/docs/RapidApi.md#rapid_validate_current_rapid_bag_get) | **GET** /Rapid/ValidateCurrentRapidBag | Validates that the rapids associated with the current user are active.
|
|
135
|
+
*RapidApi* | [**rapid_validation_rapid_id_put**](rapidata/api_client/docs/RapidApi.md#rapid_validation_rapid_id_put) | **PUT** /rapid/validation/{rapidId} | Updates the validation information of a rapid.
|
|
133
136
|
*RapidataIdentityAPIApi* | [**root_get**](rapidata/api_client/docs/RapidataIdentityAPIApi.md#root_get) | **GET** / |
|
|
134
|
-
*SimpleWorkflowApi* | [**
|
|
137
|
+
*SimpleWorkflowApi* | [**workflow_simple_id_results_get**](rapidata/api_client/docs/SimpleWorkflowApi.md#workflow_simple_id_results_get) | **GET** /workflow/simple/{id}/results | Get the result overview for a simple workflow.
|
|
135
138
|
*UserInfoApi* | [**connect_userinfo_get**](rapidata/api_client/docs/UserInfoApi.md#connect_userinfo_get) | **GET** /connect/userinfo | Retrieves information about the authenticated user.
|
|
136
139
|
*ValidationApi* | [**validation_add_validation_rapid_post**](rapidata/api_client/docs/ValidationApi.md#validation_add_validation_rapid_post) | **POST** /Validation/AddValidationRapid | Adds a new validation rapid to the specified validation set.
|
|
137
140
|
*ValidationApi* | [**validation_add_validation_text_rapid_post**](rapidata/api_client/docs/ValidationApi.md#validation_add_validation_text_rapid_post) | **POST** /Validation/AddValidationTextRapid | Adds a new validation rapid to the specified validation set.
|
|
@@ -144,12 +147,13 @@ Class | Method | HTTP request | Description
|
|
|
144
147
|
*WorkflowApi* | [**workflow_delete_delete**](rapidata/api_client/docs/WorkflowApi.md#workflow_delete_delete) | **DELETE** /Workflow/Delete | Deletes a workflow.
|
|
145
148
|
*WorkflowApi* | [**workflow_get_by_id_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_by_id_get) | **GET** /Workflow/GetById | Get a workflow by its ID.
|
|
146
149
|
*WorkflowApi* | [**workflow_get_progress_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_progress_get) | **GET** /Workflow/GetProgress | Get the progress of a workflow.
|
|
147
|
-
*WorkflowApi* | [**workflow_get_result_overview_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_result_overview_get) | **GET** /Workflow/GetResultOverview | Get the result overview for a workflow.
|
|
148
150
|
*WorkflowApi* | [**workflow_query_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_query_get) | **GET** /Workflow/Query | Queries workflows based on the provided filter, page, and sort criteria.
|
|
149
151
|
|
|
150
152
|
|
|
151
153
|
## Documentation For Models
|
|
152
154
|
|
|
155
|
+
- [AbTestSelection](rapidata/api_client/docs/AbTestSelection.md)
|
|
156
|
+
- [AbTestSelectionAInner](rapidata/api_client/docs/AbTestSelectionAInner.md)
|
|
153
157
|
- [AddCampaignArtifactResult](rapidata/api_client/docs/AddCampaignArtifactResult.md)
|
|
154
158
|
- [AddCampaignModel](rapidata/api_client/docs/AddCampaignModel.md)
|
|
155
159
|
- [AddValidationRapidModel](rapidata/api_client/docs/AddValidationRapidModel.md)
|
|
@@ -175,7 +179,6 @@ Class | Method | HTTP request | Description
|
|
|
175
179
|
- [CampaignStatus](rapidata/api_client/docs/CampaignStatus.md)
|
|
176
180
|
- [CampaignUserFilterModel](rapidata/api_client/docs/CampaignUserFilterModel.md)
|
|
177
181
|
- [CappedSelection](rapidata/api_client/docs/CappedSelection.md)
|
|
178
|
-
- [CappedSelectionSelectionsInner](rapidata/api_client/docs/CappedSelectionSelectionsInner.md)
|
|
179
182
|
- [ClassificationMetadata](rapidata/api_client/docs/ClassificationMetadata.md)
|
|
180
183
|
- [ClassificationMetadataFilterConfig](rapidata/api_client/docs/ClassificationMetadataFilterConfig.md)
|
|
181
184
|
- [ClassificationMetadataModel](rapidata/api_client/docs/ClassificationMetadataModel.md)
|
|
@@ -185,6 +188,7 @@ Class | Method | HTTP request | Description
|
|
|
185
188
|
- [CloneDatasetModel](rapidata/api_client/docs/CloneDatasetModel.md)
|
|
186
189
|
- [CloneOrderModel](rapidata/api_client/docs/CloneOrderModel.md)
|
|
187
190
|
- [CloneOrderResult](rapidata/api_client/docs/CloneOrderResult.md)
|
|
191
|
+
- [CompareMatchStatus](rapidata/api_client/docs/CompareMatchStatus.md)
|
|
188
192
|
- [ComparePayload](rapidata/api_client/docs/ComparePayload.md)
|
|
189
193
|
- [CompareRapidBlueprint](rapidata/api_client/docs/CompareRapidBlueprint.md)
|
|
190
194
|
- [CompareResult](rapidata/api_client/docs/CompareResult.md)
|
|
@@ -193,14 +197,11 @@ Class | Method | HTTP request | Description
|
|
|
193
197
|
- [CompareWorkflowConfigModel](rapidata/api_client/docs/CompareWorkflowConfigModel.md)
|
|
194
198
|
- [CompareWorkflowConfigModelPairMakerConfig](rapidata/api_client/docs/CompareWorkflowConfigModelPairMakerConfig.md)
|
|
195
199
|
- [CompareWorkflowConfigPairMakerConfig](rapidata/api_client/docs/CompareWorkflowConfigPairMakerConfig.md)
|
|
196
|
-
- [CompareWorkflowGetResultOverviewGet200Response](rapidata/api_client/docs/CompareWorkflowGetResultOverviewGet200Response.md)
|
|
197
200
|
- [CompareWorkflowModel](rapidata/api_client/docs/CompareWorkflowModel.md)
|
|
198
201
|
- [CompareWorkflowModel1](rapidata/api_client/docs/CompareWorkflowModel1.md)
|
|
199
202
|
- [CompareWorkflowModel1PairMakerInformation](rapidata/api_client/docs/CompareWorkflowModel1PairMakerInformation.md)
|
|
200
203
|
- [CompareWorkflowModel1Referee](rapidata/api_client/docs/CompareWorkflowModel1Referee.md)
|
|
201
204
|
- [CompareWorkflowModelPairMakerConfig](rapidata/api_client/docs/CompareWorkflowModelPairMakerConfig.md)
|
|
202
|
-
- [CompletedRapidModel](rapidata/api_client/docs/CompletedRapidModel.md)
|
|
203
|
-
- [CompletedRapidModelAsset](rapidata/api_client/docs/CompletedRapidModelAsset.md)
|
|
204
205
|
- [ConditionalValidationSelection](rapidata/api_client/docs/ConditionalValidationSelection.md)
|
|
205
206
|
- [Coordinate](rapidata/api_client/docs/Coordinate.md)
|
|
206
207
|
- [CountClassificationMetadataFilterConfig](rapidata/api_client/docs/CountClassificationMetadataFilterConfig.md)
|
|
@@ -261,28 +262,29 @@ Class | Method | HTTP request | Description
|
|
|
261
262
|
- [Gender](rapidata/api_client/docs/Gender.md)
|
|
262
263
|
- [GenderUserFilterModel](rapidata/api_client/docs/GenderUserFilterModel.md)
|
|
263
264
|
- [GetAvailableValidationSetsResult](rapidata/api_client/docs/GetAvailableValidationSetsResult.md)
|
|
264
|
-
- [
|
|
265
|
-
- [
|
|
266
|
-
- [
|
|
265
|
+
- [GetCompareWorkflowResultsModel](rapidata/api_client/docs/GetCompareWorkflowResultsModel.md)
|
|
266
|
+
- [GetCompareWorkflowResultsResult](rapidata/api_client/docs/GetCompareWorkflowResultsResult.md)
|
|
267
|
+
- [GetCompareWorkflowResultsResultAsset](rapidata/api_client/docs/GetCompareWorkflowResultsResultAsset.md)
|
|
268
|
+
- [GetCompareWorkflowResultsResultPagedResult](rapidata/api_client/docs/GetCompareWorkflowResultsResultPagedResult.md)
|
|
267
269
|
- [GetDatapointsByDatasetIdResult](rapidata/api_client/docs/GetDatapointsByDatasetIdResult.md)
|
|
268
270
|
- [GetDatasetByIdResult](rapidata/api_client/docs/GetDatasetByIdResult.md)
|
|
269
271
|
- [GetOrderByIdResult](rapidata/api_client/docs/GetOrderByIdResult.md)
|
|
270
272
|
- [GetPipelineByIdResult](rapidata/api_client/docs/GetPipelineByIdResult.md)
|
|
271
273
|
- [GetPipelineByIdResultArtifactsValue](rapidata/api_client/docs/GetPipelineByIdResultArtifactsValue.md)
|
|
272
274
|
- [GetPublicOrdersResult](rapidata/api_client/docs/GetPublicOrdersResult.md)
|
|
273
|
-
- [
|
|
275
|
+
- [GetSimpleWorkflowResultsModel](rapidata/api_client/docs/GetSimpleWorkflowResultsModel.md)
|
|
276
|
+
- [GetSimpleWorkflowResultsResult](rapidata/api_client/docs/GetSimpleWorkflowResultsResult.md)
|
|
277
|
+
- [GetSimpleWorkflowResultsResultPagedResult](rapidata/api_client/docs/GetSimpleWorkflowResultsResultPagedResult.md)
|
|
274
278
|
- [GetValidationSetByIdResult](rapidata/api_client/docs/GetValidationSetByIdResult.md)
|
|
275
279
|
- [GetWorkflowByIdResult](rapidata/api_client/docs/GetWorkflowByIdResult.md)
|
|
276
280
|
- [GetWorkflowByIdResultWorkflow](rapidata/api_client/docs/GetWorkflowByIdResultWorkflow.md)
|
|
277
281
|
- [GetWorkflowProgressResult](rapidata/api_client/docs/GetWorkflowProgressResult.md)
|
|
278
|
-
- [GetWorkflowResultOverviewResult](rapidata/api_client/docs/GetWorkflowResultOverviewResult.md)
|
|
279
282
|
- [IWorkflowModelPagedResult](rapidata/api_client/docs/IWorkflowModelPagedResult.md)
|
|
280
283
|
- [IdentityReadBridgeTokenGet202Response](rapidata/api_client/docs/IdentityReadBridgeTokenGet202Response.md)
|
|
281
284
|
- [ImageDimensionMetadata](rapidata/api_client/docs/ImageDimensionMetadata.md)
|
|
282
285
|
- [ImageDimensionMetadataModel](rapidata/api_client/docs/ImageDimensionMetadataModel.md)
|
|
283
286
|
- [ImportFromFileResult](rapidata/api_client/docs/ImportFromFileResult.md)
|
|
284
287
|
- [ImportValidationSetFromFileResult](rapidata/api_client/docs/ImportValidationSetFromFileResult.md)
|
|
285
|
-
- [InProgressRapidModel](rapidata/api_client/docs/InProgressRapidModel.md)
|
|
286
288
|
- [LabelingSelection](rapidata/api_client/docs/LabelingSelection.md)
|
|
287
289
|
- [LanguageUserFilterModel](rapidata/api_client/docs/LanguageUserFilterModel.md)
|
|
288
290
|
- [Line](rapidata/api_client/docs/Line.md)
|
|
@@ -316,7 +318,6 @@ Class | Method | HTTP request | Description
|
|
|
316
318
|
- [NeverEndingRefereeConfig](rapidata/api_client/docs/NeverEndingRefereeConfig.md)
|
|
317
319
|
- [NewsletterModel](rapidata/api_client/docs/NewsletterModel.md)
|
|
318
320
|
- [NotAvailableYetResult](rapidata/api_client/docs/NotAvailableYetResult.md)
|
|
319
|
-
- [NotStartedRapidModel](rapidata/api_client/docs/NotStartedRapidModel.md)
|
|
320
321
|
- [NullAsset](rapidata/api_client/docs/NullAsset.md)
|
|
321
322
|
- [NullAssetModel](rapidata/api_client/docs/NullAssetModel.md)
|
|
322
323
|
- [NullAssetModel1](rapidata/api_client/docs/NullAssetModel1.md)
|
|
@@ -338,6 +339,8 @@ Class | Method | HTTP request | Description
|
|
|
338
339
|
- [PreArrangedPairMakerConfig](rapidata/api_client/docs/PreArrangedPairMakerConfig.md)
|
|
339
340
|
- [PreArrangedPairMakerConfigModel](rapidata/api_client/docs/PreArrangedPairMakerConfigModel.md)
|
|
340
341
|
- [PreArrangedPairMakerInformation](rapidata/api_client/docs/PreArrangedPairMakerInformation.md)
|
|
342
|
+
- [PreliminaryDownloadModel](rapidata/api_client/docs/PreliminaryDownloadModel.md)
|
|
343
|
+
- [PreliminaryDownloadResult](rapidata/api_client/docs/PreliminaryDownloadResult.md)
|
|
341
344
|
- [PrivateTextMetadataInput](rapidata/api_client/docs/PrivateTextMetadataInput.md)
|
|
342
345
|
- [ProbabilisticAttachCategoryRefereeConfig](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeConfig.md)
|
|
343
346
|
- [ProblemDetails](rapidata/api_client/docs/ProblemDetails.md)
|
|
@@ -355,13 +358,13 @@ Class | Method | HTTP request | Description
|
|
|
355
358
|
- [QueryValidationRapidsResultTruth](rapidata/api_client/docs/QueryValidationRapidsResultTruth.md)
|
|
356
359
|
- [QueryValidationSetModel](rapidata/api_client/docs/QueryValidationSetModel.md)
|
|
357
360
|
- [QueryWorkflowsModel](rapidata/api_client/docs/QueryWorkflowsModel.md)
|
|
358
|
-
- [RankedDatapointModel](rapidata/api_client/docs/RankedDatapointModel.md)
|
|
359
|
-
- [RapidAnswer](rapidata/api_client/docs/RapidAnswer.md)
|
|
360
|
-
- [RapidAnswerResult](rapidata/api_client/docs/RapidAnswerResult.md)
|
|
361
361
|
- [RapidIssue](rapidata/api_client/docs/RapidIssue.md)
|
|
362
|
+
- [RapidResponse](rapidata/api_client/docs/RapidResponse.md)
|
|
363
|
+
- [RapidResponseResult](rapidata/api_client/docs/RapidResponseResult.md)
|
|
362
364
|
- [RapidResultModel](rapidata/api_client/docs/RapidResultModel.md)
|
|
363
365
|
- [RapidResultModelResult](rapidata/api_client/docs/RapidResultModelResult.md)
|
|
364
366
|
- [RapidSkippedModel](rapidata/api_client/docs/RapidSkippedModel.md)
|
|
367
|
+
- [RapidState](rapidata/api_client/docs/RapidState.md)
|
|
365
368
|
- [ReadBridgeTokenKeysResult](rapidata/api_client/docs/ReadBridgeTokenKeysResult.md)
|
|
366
369
|
- [RegisterTemporaryCustomerModel](rapidata/api_client/docs/RegisterTemporaryCustomerModel.md)
|
|
367
370
|
- [RegisterTemporaryCustomerResult](rapidata/api_client/docs/RegisterTemporaryCustomerResult.md)
|
|
@@ -377,7 +380,6 @@ Class | Method | HTTP request | Description
|
|
|
377
380
|
- [SimpleWorkflowConfig](rapidata/api_client/docs/SimpleWorkflowConfig.md)
|
|
378
381
|
- [SimpleWorkflowConfigModel](rapidata/api_client/docs/SimpleWorkflowConfigModel.md)
|
|
379
382
|
- [SimpleWorkflowConfigModelBlueprint](rapidata/api_client/docs/SimpleWorkflowConfigModelBlueprint.md)
|
|
380
|
-
- [SimpleWorkflowGetResultOverviewGet200Response](rapidata/api_client/docs/SimpleWorkflowGetResultOverviewGet200Response.md)
|
|
381
383
|
- [SimpleWorkflowModel](rapidata/api_client/docs/SimpleWorkflowModel.md)
|
|
382
384
|
- [SimpleWorkflowModel1](rapidata/api_client/docs/SimpleWorkflowModel1.md)
|
|
383
385
|
- [SimpleWorkflowModelBlueprint](rapidata/api_client/docs/SimpleWorkflowModelBlueprint.md)
|
|
@@ -407,6 +409,8 @@ Class | Method | HTTP request | Description
|
|
|
407
409
|
- [UpdateAccessModel](rapidata/api_client/docs/UpdateAccessModel.md)
|
|
408
410
|
- [UpdateCampaignModel](rapidata/api_client/docs/UpdateCampaignModel.md)
|
|
409
411
|
- [UpdateOrderModel](rapidata/api_client/docs/UpdateOrderModel.md)
|
|
412
|
+
- [UpdateValidationRapidModel](rapidata/api_client/docs/UpdateValidationRapidModel.md)
|
|
413
|
+
- [UpdateValidationRapidModelTruth](rapidata/api_client/docs/UpdateValidationRapidModelTruth.md)
|
|
410
414
|
- [UploadCocoResult](rapidata/api_client/docs/UploadCocoResult.md)
|
|
411
415
|
- [UploadDatapointsResult](rapidata/api_client/docs/UploadDatapointsResult.md)
|
|
412
416
|
- [UploadFilesFromS3BucketModel](rapidata/api_client/docs/UploadFilesFromS3BucketModel.md)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from rapidata.api_client.models.
|
|
2
|
-
|
|
1
|
+
from rapidata.api_client.models.ab_test_selection_a_inner import (
|
|
2
|
+
AbTestSelectionAInner,
|
|
3
3
|
)
|
|
4
4
|
from rapidata.api_client.models.create_order_model import CreateOrderModel
|
|
5
5
|
from rapidata.api_client.models.create_order_model_referee import (
|
|
@@ -92,7 +92,7 @@ class RapidataOrderBuilder:
|
|
|
92
92
|
else None
|
|
93
93
|
),
|
|
94
94
|
selections=[
|
|
95
|
-
|
|
95
|
+
AbTestSelectionAInner(selection._to_model())
|
|
96
96
|
for selection in self.__selections
|
|
97
97
|
],
|
|
98
98
|
priority=self.__priority,
|
|
@@ -6,6 +6,7 @@ from rapidata.api_client.exceptions import ApiException
|
|
|
6
6
|
from rapidata.api_client.models.order_state import OrderState
|
|
7
7
|
from typing import Optional, cast, Any
|
|
8
8
|
from rapidata.api_client.models.workflow_artifact_model import WorkflowArtifactModel
|
|
9
|
+
from rapidata.api_client.models.preliminary_download_model import PreliminaryDownloadModel
|
|
9
10
|
from tqdm import tqdm
|
|
10
11
|
|
|
11
12
|
class RapidataOrder:
|
|
@@ -34,6 +35,7 @@ class RapidataOrder:
|
|
|
34
35
|
self.__openapi_service = openapi_service
|
|
35
36
|
self.__dataset = dataset
|
|
36
37
|
self.__workflow_id = None
|
|
38
|
+
self.__pipeline_id = ""
|
|
37
39
|
|
|
38
40
|
def run(self, print_link: bool=True):
|
|
39
41
|
"""
|
|
@@ -103,20 +105,29 @@ class RapidataOrder:
|
|
|
103
105
|
|
|
104
106
|
sleep(refresh_rate)
|
|
105
107
|
|
|
108
|
+
def __get_pipeline_id(self):
|
|
109
|
+
if self.__pipeline_id:
|
|
110
|
+
return self.__pipeline_id
|
|
111
|
+
|
|
112
|
+
self.__pipeline_id = self.__openapi_service.order_api.order_get_by_id_get(self.order_id).pipeline_id
|
|
113
|
+
return self.__pipeline_id
|
|
114
|
+
|
|
106
115
|
def __get_workflow_id(self):
|
|
107
116
|
if self.__workflow_id:
|
|
108
117
|
return self.__workflow_id
|
|
109
118
|
|
|
110
119
|
for _ in range(10): # Try for 20 seconds to get the workflow id if workflow has not started by then, raise an exception
|
|
111
120
|
try:
|
|
112
|
-
|
|
113
|
-
pipeline = self.__openapi_service.pipeline_api.pipeline_id_get(
|
|
121
|
+
self.__get_pipeline_id()
|
|
122
|
+
pipeline = self.__openapi_service.pipeline_api.pipeline_id_get(self.__pipeline_id)
|
|
114
123
|
self.__workflow_id = cast(WorkflowArtifactModel, pipeline.artifacts["workflow-artifact"].actual_instance).workflow_id
|
|
115
124
|
break
|
|
116
125
|
except Exception:
|
|
117
126
|
sleep(2)
|
|
127
|
+
|
|
118
128
|
if not self.__workflow_id:
|
|
119
129
|
raise Exception("Something went wrong when trying to get the order progress.")
|
|
130
|
+
|
|
120
131
|
return self.__workflow_id
|
|
121
132
|
|
|
122
133
|
def __get_workflow_progress(self):
|
|
@@ -133,16 +144,42 @@ class RapidataOrder:
|
|
|
133
144
|
raise Exception(f"Failed to get progress. Please try again in a few seconds.")
|
|
134
145
|
|
|
135
146
|
return progress
|
|
136
|
-
|
|
147
|
+
|
|
148
|
+
def __get_preliminary_results(self) -> dict[str, Any]:
|
|
149
|
+
pipeline_id = self.__get_pipeline_id()
|
|
150
|
+
try:
|
|
151
|
+
download_id = self.__openapi_service.pipeline_api.pipeline_pipeline_id_preliminary_download_post(pipeline_id, PreliminaryDownloadModel(sendEmail=False)).download_id
|
|
152
|
+
while not (preliminary_results := self.__openapi_service.pipeline_api.pipeline_preliminary_download_preliminary_download_id_get(preliminary_download_id=download_id)):
|
|
153
|
+
sleep(1)
|
|
154
|
+
return json.loads(preliminary_results.decode())
|
|
137
155
|
|
|
138
|
-
|
|
156
|
+
except ApiException as e:
|
|
157
|
+
# Handle API exceptions
|
|
158
|
+
raise Exception(f"Failed to get preliminary order results: {str(e)}") from e
|
|
159
|
+
except json.JSONDecodeError as e:
|
|
160
|
+
# Handle JSON parsing errors
|
|
161
|
+
raise Exception(f"Failed to parse preliminary order results: {str(e)}") from e
|
|
162
|
+
|
|
163
|
+
def get_results(self, preliminary_results=False) -> dict[str, Any]:
|
|
139
164
|
"""
|
|
140
165
|
Gets the results of the order.
|
|
141
166
|
If the order is still processing, this method will block until the order is completed and then return the results.
|
|
142
167
|
|
|
168
|
+
Args:
|
|
169
|
+
preliminary_results: If True, returns the preliminary results of the order. Defaults to False.
|
|
170
|
+
Note that preliminary results are not final and may not contain all the datapoints & responses. Only the onese that are already available.
|
|
171
|
+
This will throw an exception if there are no responses available yet.
|
|
172
|
+
|
|
143
173
|
Returns:
|
|
144
174
|
The results of the order.
|
|
145
175
|
"""
|
|
176
|
+
|
|
177
|
+
if preliminary_results and self.get_status() not in [OrderState.COMPLETED]:
|
|
178
|
+
return self.__get_preliminary_results()
|
|
179
|
+
|
|
180
|
+
elif preliminary_results and self.get_status() in [OrderState.COMPLETED]:
|
|
181
|
+
print("Order is already completed. Returning final results.")
|
|
182
|
+
|
|
146
183
|
while self.get_status() not in [OrderState.COMPLETED, OrderState.PAUSED, OrderState.MANUALREVIEW, OrderState.FAILED]:
|
|
147
184
|
sleep(5)
|
|
148
185
|
|