rapidata 0.4.0__py3-none-any.whl → 0.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +4 -3
- rapidata/api_client/__init__.py +51 -15
- rapidata/api_client/api/__init__.py +5 -0
- rapidata/api_client/api/campaign_api.py +1044 -0
- rapidata/api_client/api/compare_workflow_api.py +316 -0
- rapidata/api_client/api/dataset_api.py +24 -24
- rapidata/api_client/api/order_api.py +206 -536
- rapidata/api_client/api/pipeline_api.py +843 -0
- rapidata/api_client/api/rapid_api.py +6 -6
- rapidata/api_client/api/simple_workflow_api.py +350 -0
- rapidata/api_client/api/validation_api.py +6 -6
- rapidata/api_client/api/workflow_api.py +2386 -0
- rapidata/api_client/api_client.py +2 -2
- rapidata/api_client/models/__init__.py +46 -15
- rapidata/api_client/models/add_campaign_artifact_result.py +87 -0
- rapidata/api_client/models/add_campaign_model.py +149 -0
- rapidata/api_client/models/admin_order_model.py +8 -1
- rapidata/api_client/models/age_group.py +1 -1
- rapidata/api_client/models/age_user_filter_model.py +2 -2
- rapidata/api_client/models/campaign_artifact_model.py +98 -0
- rapidata/api_client/models/campaign_query_model.py +105 -0
- rapidata/api_client/models/campaign_query_model_paged_result.py +105 -0
- rapidata/api_client/models/campaign_status.py +39 -0
- rapidata/api_client/models/campaign_user_filter_model.py +2 -2
- rapidata/api_client/models/compare_workflow_config.py +2 -12
- rapidata/api_client/models/compare_workflow_config_model.py +138 -0
- rapidata/api_client/models/compare_workflow_get_result_overview_get200_response.py +137 -0
- rapidata/api_client/models/compare_workflow_model1.py +146 -0
- rapidata/api_client/models/completed_rapid_model.py +103 -0
- rapidata/api_client/models/conditional_validation_selection.py +106 -0
- rapidata/api_client/models/country_user_filter_model.py +2 -2
- rapidata/api_client/models/create_demographic_rapid_model.py +3 -3
- rapidata/api_client/models/create_independent_workflow_model.py +93 -0
- rapidata/api_client/models/create_independent_workflow_model_workflow_config.py +140 -0
- rapidata/api_client/models/create_independent_workflow_result.py +89 -0
- rapidata/api_client/models/create_order_model.py +40 -31
- rapidata/api_client/models/create_order_model_selections_inner.py +40 -12
- rapidata/api_client/models/create_order_model_user_filters_inner.py +35 -35
- rapidata/api_client/models/customer_order_model.py +8 -1
- rapidata/api_client/models/dataset_artifact_model.py +98 -0
- rapidata/api_client/models/demographic_rapid_selection_config.py +7 -5
- rapidata/api_client/models/demographic_selection.py +8 -6
- rapidata/api_client/models/feedback_model.py +1 -1
- rapidata/api_client/models/file_artifact_model.py +98 -0
- rapidata/api_client/models/gender.py +1 -1
- rapidata/api_client/models/gender_user_filter_model.py +2 -2
- rapidata/api_client/models/get_attach_category_workflow_result_overview_result.py +144 -0
- rapidata/api_client/models/get_compare_workflow_result_overview_result.py +125 -0
- rapidata/api_client/models/get_compare_workflow_result_overview_small_result.py +114 -0
- rapidata/api_client/models/get_pipeline_by_id_result.py +100 -0
- rapidata/api_client/models/get_pipeline_by_id_result_artifacts_value.py +182 -0
- rapidata/api_client/models/get_simple_workflow_result_overview_result.py +142 -0
- rapidata/api_client/models/get_workflow_by_id_result.py +91 -0
- rapidata/api_client/models/get_workflow_by_id_result_workflow.py +140 -0
- rapidata/api_client/models/get_workflow_progress_result.py +100 -0
- rapidata/api_client/models/get_workflow_result_overview_result.py +104 -0
- rapidata/api_client/models/i_workflow_model_paged_result.py +105 -0
- rapidata/api_client/models/in_progress_rapid_model.py +103 -0
- rapidata/api_client/models/labeling_selection.py +2 -2
- rapidata/api_client/models/language_user_filter_model.py +2 -2
- rapidata/api_client/models/not_started_rapid_model.py +93 -0
- rapidata/api_client/models/order_state.py +43 -0
- rapidata/api_client/models/query_campaigns_model.py +112 -0
- rapidata/api_client/models/query_workflows_model.py +112 -0
- rapidata/api_client/models/ranked_datapoint_model.py +95 -0
- rapidata/api_client/models/rapid_answer.py +97 -0
- rapidata/api_client/models/rapid_answer_result.py +252 -0
- rapidata/api_client/models/simple_workflow_config.py +2 -12
- rapidata/api_client/models/simple_workflow_config_model.py +132 -0
- rapidata/api_client/models/simple_workflow_config_model_blueprint.py +238 -0
- rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +137 -0
- rapidata/api_client/models/simple_workflow_model1.py +140 -0
- rapidata/api_client/models/static_selection.py +96 -0
- rapidata/api_client/models/update_workflow_config_request.py +107 -0
- rapidata/api_client/models/update_workflow_config_request_config.py +140 -0
- rapidata/api_client/models/user_score_user_filter_model.py +3 -3
- rapidata/api_client/models/validation_selection.py +3 -3
- rapidata/api_client/models/workflow_artifact_model.py +98 -0
- rapidata/api_client/models/workflow_config_artifact_model.py +102 -0
- rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +140 -0
- rapidata/api_client/models/workflow_state.py +41 -0
- rapidata/api_client/rest.py +1 -1
- rapidata/api_client_README.md +75 -29
- rapidata/rapidata_client/__init__.py +6 -1
- rapidata/rapidata_client/order/rapidata_order_builder.py +2 -1
- rapidata/rapidata_client/selection/__init__.py +1 -0
- rapidata/rapidata_client/selection/conditional_validation_rapid_selection.py +41 -0
- rapidata/rapidata_client/selection/demographic_selection.py +3 -5
- {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/METADATA +1 -1
- {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/RECORD +92 -40
- {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/LICENSE +0 -0
- {rapidata-0.4.0.dist-info → rapidata-0.5.0.dist-info}/WHEEL +0 -0
|
@@ -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
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.page_info import PageInfo
|
|
23
|
+
from rapidata.api_client.models.root_filter import RootFilter
|
|
24
|
+
from rapidata.api_client.models.sort_criterion import SortCriterion
|
|
25
|
+
from typing import Optional, Set
|
|
26
|
+
from typing_extensions import Self
|
|
27
|
+
|
|
28
|
+
class QueryWorkflowsModel(BaseModel):
|
|
29
|
+
"""
|
|
30
|
+
The model for the query request.
|
|
31
|
+
""" # noqa: E501
|
|
32
|
+
page: Optional[PageInfo] = None
|
|
33
|
+
filter: Optional[RootFilter] = None
|
|
34
|
+
sort_criteria: Optional[List[SortCriterion]] = Field(default=None, description="The sort criteria.", alias="sortCriteria")
|
|
35
|
+
__properties: ClassVar[List[str]] = ["page", "filter", "sortCriteria"]
|
|
36
|
+
|
|
37
|
+
model_config = ConfigDict(
|
|
38
|
+
populate_by_name=True,
|
|
39
|
+
validate_assignment=True,
|
|
40
|
+
protected_namespaces=(),
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
def to_str(self) -> str:
|
|
45
|
+
"""Returns the string representation of the model using alias"""
|
|
46
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
47
|
+
|
|
48
|
+
def to_json(self) -> str:
|
|
49
|
+
"""Returns the JSON representation of the model using alias"""
|
|
50
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
51
|
+
return json.dumps(self.to_dict())
|
|
52
|
+
|
|
53
|
+
@classmethod
|
|
54
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
55
|
+
"""Create an instance of QueryWorkflowsModel from a JSON string"""
|
|
56
|
+
return cls.from_dict(json.loads(json_str))
|
|
57
|
+
|
|
58
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
59
|
+
"""Return the dictionary representation of the model using alias.
|
|
60
|
+
|
|
61
|
+
This has the following differences from calling pydantic's
|
|
62
|
+
`self.model_dump(by_alias=True)`:
|
|
63
|
+
|
|
64
|
+
* `None` is only added to the output dict for nullable fields that
|
|
65
|
+
were set at model initialization. Other fields with value `None`
|
|
66
|
+
are ignored.
|
|
67
|
+
"""
|
|
68
|
+
excluded_fields: Set[str] = set([
|
|
69
|
+
])
|
|
70
|
+
|
|
71
|
+
_dict = self.model_dump(
|
|
72
|
+
by_alias=True,
|
|
73
|
+
exclude=excluded_fields,
|
|
74
|
+
exclude_none=True,
|
|
75
|
+
)
|
|
76
|
+
# override the default output from pydantic by calling `to_dict()` of page
|
|
77
|
+
if self.page:
|
|
78
|
+
_dict['page'] = self.page.to_dict()
|
|
79
|
+
# override the default output from pydantic by calling `to_dict()` of filter
|
|
80
|
+
if self.filter:
|
|
81
|
+
_dict['filter'] = self.filter.to_dict()
|
|
82
|
+
# override the default output from pydantic by calling `to_dict()` of each item in sort_criteria (list)
|
|
83
|
+
_items = []
|
|
84
|
+
if self.sort_criteria:
|
|
85
|
+
for _item_sort_criteria in self.sort_criteria:
|
|
86
|
+
if _item_sort_criteria:
|
|
87
|
+
_items.append(_item_sort_criteria.to_dict())
|
|
88
|
+
_dict['sortCriteria'] = _items
|
|
89
|
+
# set to None if sort_criteria (nullable) is None
|
|
90
|
+
# and model_fields_set contains the field
|
|
91
|
+
if self.sort_criteria is None and "sort_criteria" in self.model_fields_set:
|
|
92
|
+
_dict['sortCriteria'] = None
|
|
93
|
+
|
|
94
|
+
return _dict
|
|
95
|
+
|
|
96
|
+
@classmethod
|
|
97
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
98
|
+
"""Create an instance of QueryWorkflowsModel from a dict"""
|
|
99
|
+
if obj is None:
|
|
100
|
+
return None
|
|
101
|
+
|
|
102
|
+
if not isinstance(obj, dict):
|
|
103
|
+
return cls.model_validate(obj)
|
|
104
|
+
|
|
105
|
+
_obj = cls.model_validate({
|
|
106
|
+
"page": PageInfo.from_dict(obj["page"]) if obj.get("page") is not None else None,
|
|
107
|
+
"filter": RootFilter.from_dict(obj["filter"]) if obj.get("filter") is not None else None,
|
|
108
|
+
"sortCriteria": [SortCriterion.from_dict(_item) for _item in obj["sortCriteria"]] if obj.get("sortCriteria") is not None else None
|
|
109
|
+
})
|
|
110
|
+
return _obj
|
|
111
|
+
|
|
112
|
+
|
|
@@ -0,0 +1,95 @@
|
|
|
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, StrictInt, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.datapoint_model_asset import DatapointModelAsset
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RankedDatapointModel(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
RankedDatapointModel
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
workflow_datapoint_id: StrictStr = Field(alias="workflowDatapointId")
|
|
31
|
+
asset: DatapointModelAsset
|
|
32
|
+
elo: StrictInt
|
|
33
|
+
__properties: ClassVar[List[str]] = ["workflowDatapointId", "asset", "elo"]
|
|
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 RankedDatapointModel 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 asset
|
|
75
|
+
if self.asset:
|
|
76
|
+
_dict['asset'] = self.asset.to_dict()
|
|
77
|
+
return _dict
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
81
|
+
"""Create an instance of RankedDatapointModel from a dict"""
|
|
82
|
+
if obj is None:
|
|
83
|
+
return None
|
|
84
|
+
|
|
85
|
+
if not isinstance(obj, dict):
|
|
86
|
+
return cls.model_validate(obj)
|
|
87
|
+
|
|
88
|
+
_obj = cls.model_validate({
|
|
89
|
+
"workflowDatapointId": obj.get("workflowDatapointId"),
|
|
90
|
+
"asset": DatapointModelAsset.from_dict(obj["asset"]) if obj.get("asset") is not None else None,
|
|
91
|
+
"elo": obj.get("elo")
|
|
92
|
+
})
|
|
93
|
+
return _obj
|
|
94
|
+
|
|
95
|
+
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.rapid_answer_result import RapidAnswerResult
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class RapidAnswer(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
RapidAnswer
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
id: StrictStr
|
|
31
|
+
country: StrictStr
|
|
32
|
+
result: RapidAnswerResult
|
|
33
|
+
demographic_information: Dict[str, StrictStr] = Field(alias="demographicInformation")
|
|
34
|
+
__properties: ClassVar[List[str]] = ["id", "country", "result", "demographicInformation"]
|
|
35
|
+
|
|
36
|
+
model_config = ConfigDict(
|
|
37
|
+
populate_by_name=True,
|
|
38
|
+
validate_assignment=True,
|
|
39
|
+
protected_namespaces=(),
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def to_str(self) -> str:
|
|
44
|
+
"""Returns the string representation of the model using alias"""
|
|
45
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
46
|
+
|
|
47
|
+
def to_json(self) -> str:
|
|
48
|
+
"""Returns the JSON representation of the model using alias"""
|
|
49
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
50
|
+
return json.dumps(self.to_dict())
|
|
51
|
+
|
|
52
|
+
@classmethod
|
|
53
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
54
|
+
"""Create an instance of RapidAnswer from a JSON string"""
|
|
55
|
+
return cls.from_dict(json.loads(json_str))
|
|
56
|
+
|
|
57
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
58
|
+
"""Return the dictionary representation of the model using alias.
|
|
59
|
+
|
|
60
|
+
This has the following differences from calling pydantic's
|
|
61
|
+
`self.model_dump(by_alias=True)`:
|
|
62
|
+
|
|
63
|
+
* `None` is only added to the output dict for nullable fields that
|
|
64
|
+
were set at model initialization. Other fields with value `None`
|
|
65
|
+
are ignored.
|
|
66
|
+
"""
|
|
67
|
+
excluded_fields: Set[str] = set([
|
|
68
|
+
])
|
|
69
|
+
|
|
70
|
+
_dict = self.model_dump(
|
|
71
|
+
by_alias=True,
|
|
72
|
+
exclude=excluded_fields,
|
|
73
|
+
exclude_none=True,
|
|
74
|
+
)
|
|
75
|
+
# override the default output from pydantic by calling `to_dict()` of result
|
|
76
|
+
if self.result:
|
|
77
|
+
_dict['result'] = self.result.to_dict()
|
|
78
|
+
return _dict
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
82
|
+
"""Create an instance of RapidAnswer from a dict"""
|
|
83
|
+
if obj is None:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
if not isinstance(obj, dict):
|
|
87
|
+
return cls.model_validate(obj)
|
|
88
|
+
|
|
89
|
+
_obj = cls.model_validate({
|
|
90
|
+
"id": obj.get("id"),
|
|
91
|
+
"country": obj.get("country"),
|
|
92
|
+
"result": RapidAnswerResult.from_dict(obj["result"]) if obj.get("result") is not None else None,
|
|
93
|
+
"demographicInformation": obj.get("demographicInformation")
|
|
94
|
+
})
|
|
95
|
+
return _obj
|
|
96
|
+
|
|
97
|
+
|
|
@@ -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_result import AttachCategoryResult
|
|
21
|
+
from rapidata.api_client.models.bounding_box_result import BoundingBoxResult
|
|
22
|
+
from rapidata.api_client.models.compare_result import CompareResult
|
|
23
|
+
from rapidata.api_client.models.free_text_result import FreeTextResult
|
|
24
|
+
from rapidata.api_client.models.line_result import LineResult
|
|
25
|
+
from rapidata.api_client.models.locate_result import LocateResult
|
|
26
|
+
from rapidata.api_client.models.named_entity_result import NamedEntityResult
|
|
27
|
+
from rapidata.api_client.models.polygon_result import PolygonResult
|
|
28
|
+
from rapidata.api_client.models.skip_result import SkipResult
|
|
29
|
+
from rapidata.api_client.models.transcription_result import TranscriptionResult
|
|
30
|
+
from pydantic import StrictStr, Field
|
|
31
|
+
from typing import Union, List, Set, Optional, Dict
|
|
32
|
+
from typing_extensions import Literal, Self
|
|
33
|
+
|
|
34
|
+
RAPIDANSWERRESULT_ONE_OF_SCHEMAS = ["AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult"]
|
|
35
|
+
|
|
36
|
+
class RapidAnswerResult(BaseModel):
|
|
37
|
+
"""
|
|
38
|
+
RapidAnswerResult
|
|
39
|
+
"""
|
|
40
|
+
# data type: TranscriptionResult
|
|
41
|
+
oneof_schema_1_validator: Optional[TranscriptionResult] = None
|
|
42
|
+
# data type: PolygonResult
|
|
43
|
+
oneof_schema_2_validator: Optional[PolygonResult] = None
|
|
44
|
+
# data type: NamedEntityResult
|
|
45
|
+
oneof_schema_3_validator: Optional[NamedEntityResult] = None
|
|
46
|
+
# data type: LocateResult
|
|
47
|
+
oneof_schema_4_validator: Optional[LocateResult] = None
|
|
48
|
+
# data type: LineResult
|
|
49
|
+
oneof_schema_5_validator: Optional[LineResult] = None
|
|
50
|
+
# data type: FreeTextResult
|
|
51
|
+
oneof_schema_6_validator: Optional[FreeTextResult] = None
|
|
52
|
+
# data type: CompareResult
|
|
53
|
+
oneof_schema_7_validator: Optional[CompareResult] = None
|
|
54
|
+
# data type: SkipResult
|
|
55
|
+
oneof_schema_8_validator: Optional[SkipResult] = None
|
|
56
|
+
# data type: AttachCategoryResult
|
|
57
|
+
oneof_schema_9_validator: Optional[AttachCategoryResult] = None
|
|
58
|
+
# data type: BoundingBoxResult
|
|
59
|
+
oneof_schema_10_validator: Optional[BoundingBoxResult] = None
|
|
60
|
+
actual_instance: Optional[Union[AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]] = None
|
|
61
|
+
one_of_schemas: Set[str] = { "AttachCategoryResult", "BoundingBoxResult", "CompareResult", "FreeTextResult", "LineResult", "LocateResult", "NamedEntityResult", "PolygonResult", "SkipResult", "TranscriptionResult" }
|
|
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 = RapidAnswerResult.model_construct()
|
|
85
|
+
error_messages = []
|
|
86
|
+
match = 0
|
|
87
|
+
# validate data type: TranscriptionResult
|
|
88
|
+
if not isinstance(v, TranscriptionResult):
|
|
89
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TranscriptionResult`")
|
|
90
|
+
else:
|
|
91
|
+
match += 1
|
|
92
|
+
# validate data type: PolygonResult
|
|
93
|
+
if not isinstance(v, PolygonResult):
|
|
94
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `PolygonResult`")
|
|
95
|
+
else:
|
|
96
|
+
match += 1
|
|
97
|
+
# validate data type: NamedEntityResult
|
|
98
|
+
if not isinstance(v, NamedEntityResult):
|
|
99
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NamedEntityResult`")
|
|
100
|
+
else:
|
|
101
|
+
match += 1
|
|
102
|
+
# validate data type: LocateResult
|
|
103
|
+
if not isinstance(v, LocateResult):
|
|
104
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LocateResult`")
|
|
105
|
+
else:
|
|
106
|
+
match += 1
|
|
107
|
+
# validate data type: LineResult
|
|
108
|
+
if not isinstance(v, LineResult):
|
|
109
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `LineResult`")
|
|
110
|
+
else:
|
|
111
|
+
match += 1
|
|
112
|
+
# validate data type: FreeTextResult
|
|
113
|
+
if not isinstance(v, FreeTextResult):
|
|
114
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FreeTextResult`")
|
|
115
|
+
else:
|
|
116
|
+
match += 1
|
|
117
|
+
# validate data type: CompareResult
|
|
118
|
+
if not isinstance(v, CompareResult):
|
|
119
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareResult`")
|
|
120
|
+
else:
|
|
121
|
+
match += 1
|
|
122
|
+
# validate data type: SkipResult
|
|
123
|
+
if not isinstance(v, SkipResult):
|
|
124
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `SkipResult`")
|
|
125
|
+
else:
|
|
126
|
+
match += 1
|
|
127
|
+
# validate data type: AttachCategoryResult
|
|
128
|
+
if not isinstance(v, AttachCategoryResult):
|
|
129
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `AttachCategoryResult`")
|
|
130
|
+
else:
|
|
131
|
+
match += 1
|
|
132
|
+
# validate data type: BoundingBoxResult
|
|
133
|
+
if not isinstance(v, BoundingBoxResult):
|
|
134
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `BoundingBoxResult`")
|
|
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 RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
|
|
140
|
+
elif match == 0:
|
|
141
|
+
# no match
|
|
142
|
+
raise ValueError("No match found when setting `actual_instance` in RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. 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 TranscriptionResult
|
|
158
|
+
try:
|
|
159
|
+
instance.actual_instance = TranscriptionResult.from_json(json_str)
|
|
160
|
+
match += 1
|
|
161
|
+
except (ValidationError, ValueError) as e:
|
|
162
|
+
error_messages.append(str(e))
|
|
163
|
+
# deserialize data into PolygonResult
|
|
164
|
+
try:
|
|
165
|
+
instance.actual_instance = PolygonResult.from_json(json_str)
|
|
166
|
+
match += 1
|
|
167
|
+
except (ValidationError, ValueError) as e:
|
|
168
|
+
error_messages.append(str(e))
|
|
169
|
+
# deserialize data into NamedEntityResult
|
|
170
|
+
try:
|
|
171
|
+
instance.actual_instance = NamedEntityResult.from_json(json_str)
|
|
172
|
+
match += 1
|
|
173
|
+
except (ValidationError, ValueError) as e:
|
|
174
|
+
error_messages.append(str(e))
|
|
175
|
+
# deserialize data into LocateResult
|
|
176
|
+
try:
|
|
177
|
+
instance.actual_instance = LocateResult.from_json(json_str)
|
|
178
|
+
match += 1
|
|
179
|
+
except (ValidationError, ValueError) as e:
|
|
180
|
+
error_messages.append(str(e))
|
|
181
|
+
# deserialize data into LineResult
|
|
182
|
+
try:
|
|
183
|
+
instance.actual_instance = LineResult.from_json(json_str)
|
|
184
|
+
match += 1
|
|
185
|
+
except (ValidationError, ValueError) as e:
|
|
186
|
+
error_messages.append(str(e))
|
|
187
|
+
# deserialize data into FreeTextResult
|
|
188
|
+
try:
|
|
189
|
+
instance.actual_instance = FreeTextResult.from_json(json_str)
|
|
190
|
+
match += 1
|
|
191
|
+
except (ValidationError, ValueError) as e:
|
|
192
|
+
error_messages.append(str(e))
|
|
193
|
+
# deserialize data into CompareResult
|
|
194
|
+
try:
|
|
195
|
+
instance.actual_instance = CompareResult.from_json(json_str)
|
|
196
|
+
match += 1
|
|
197
|
+
except (ValidationError, ValueError) as e:
|
|
198
|
+
error_messages.append(str(e))
|
|
199
|
+
# deserialize data into SkipResult
|
|
200
|
+
try:
|
|
201
|
+
instance.actual_instance = SkipResult.from_json(json_str)
|
|
202
|
+
match += 1
|
|
203
|
+
except (ValidationError, ValueError) as e:
|
|
204
|
+
error_messages.append(str(e))
|
|
205
|
+
# deserialize data into AttachCategoryResult
|
|
206
|
+
try:
|
|
207
|
+
instance.actual_instance = AttachCategoryResult.from_json(json_str)
|
|
208
|
+
match += 1
|
|
209
|
+
except (ValidationError, ValueError) as e:
|
|
210
|
+
error_messages.append(str(e))
|
|
211
|
+
# deserialize data into BoundingBoxResult
|
|
212
|
+
try:
|
|
213
|
+
instance.actual_instance = BoundingBoxResult.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 RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. Details: " + ", ".join(error_messages))
|
|
221
|
+
elif match == 0:
|
|
222
|
+
# no match
|
|
223
|
+
raise ValueError("No match found when deserializing the JSON string into RapidAnswerResult with oneOf schemas: AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult. 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], AttachCategoryResult, BoundingBoxResult, CompareResult, FreeTextResult, LineResult, LocateResult, NamedEntityResult, PolygonResult, SkipResult, TranscriptionResult]]:
|
|
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
|
+
|
|
@@ -19,7 +19,6 @@ import json
|
|
|
19
19
|
|
|
20
20
|
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
|
|
21
21
|
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
-
from rapidata.api_client.models.compare_workflow_config_rapid_selection_configs_inner import CompareWorkflowConfigRapidSelectionConfigsInner
|
|
23
22
|
from rapidata.api_client.models.compare_workflow_config_referee import CompareWorkflowConfigReferee
|
|
24
23
|
from rapidata.api_client.models.feature_flag import FeatureFlag
|
|
25
24
|
from rapidata.api_client.models.simple_workflow_config_blueprint import SimpleWorkflowConfigBlueprint
|
|
@@ -37,8 +36,7 @@ class SimpleWorkflowConfig(BaseModel):
|
|
|
37
36
|
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
|
|
38
37
|
priority: Optional[StrictStr] = None
|
|
39
38
|
is_fallback: Optional[StrictBool] = Field(default=None, alias="isFallback")
|
|
40
|
-
|
|
41
|
-
__properties: ClassVar[List[str]] = ["_t", "referee", "blueprint", "targetCountryCodes", "featureFlags", "priority", "isFallback", "rapidSelectionConfigs"]
|
|
39
|
+
__properties: ClassVar[List[str]] = ["_t", "referee", "blueprint", "targetCountryCodes", "featureFlags", "priority", "isFallback"]
|
|
42
40
|
|
|
43
41
|
@field_validator('t')
|
|
44
42
|
def t_validate_enum(cls, value):
|
|
@@ -99,13 +97,6 @@ class SimpleWorkflowConfig(BaseModel):
|
|
|
99
97
|
if _item_feature_flags:
|
|
100
98
|
_items.append(_item_feature_flags.to_dict())
|
|
101
99
|
_dict['featureFlags'] = _items
|
|
102
|
-
# override the default output from pydantic by calling `to_dict()` of each item in rapid_selection_configs (list)
|
|
103
|
-
_items = []
|
|
104
|
-
if self.rapid_selection_configs:
|
|
105
|
-
for _item_rapid_selection_configs in self.rapid_selection_configs:
|
|
106
|
-
if _item_rapid_selection_configs:
|
|
107
|
-
_items.append(_item_rapid_selection_configs.to_dict())
|
|
108
|
-
_dict['rapidSelectionConfigs'] = _items
|
|
109
100
|
# set to None if priority (nullable) is None
|
|
110
101
|
# and model_fields_set contains the field
|
|
111
102
|
if self.priority is None and "priority" in self.model_fields_set:
|
|
@@ -129,8 +120,7 @@ class SimpleWorkflowConfig(BaseModel):
|
|
|
129
120
|
"targetCountryCodes": obj.get("targetCountryCodes"),
|
|
130
121
|
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
|
|
131
122
|
"priority": obj.get("priority"),
|
|
132
|
-
"isFallback": obj.get("isFallback")
|
|
133
|
-
"rapidSelectionConfigs": [CompareWorkflowConfigRapidSelectionConfigsInner.from_dict(_item) for _item in obj["rapidSelectionConfigs"]] if obj.get("rapidSelectionConfigs") is not None else None
|
|
123
|
+
"isFallback": obj.get("isFallback")
|
|
134
124
|
})
|
|
135
125
|
return _obj
|
|
136
126
|
|