rapidata 2.42.1__py3-none-any.whl → 2.42.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -1
- rapidata/api_client/__init__.py +8 -1
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/grouped_ranking_workflow_api.py +318 -0
- rapidata/api_client/models/__init__.py +7 -1
- rapidata/api_client/models/asset_metadata.py +2 -8
- rapidata/api_client/models/create_datapoint_model.py +10 -3
- rapidata/api_client/models/create_order_model_workflow.py +23 -9
- rapidata/api_client/models/file_asset.py +1 -3
- rapidata/api_client/models/file_asset_metadata_value.py +1 -3
- rapidata/api_client/models/get_grouped_ranking_workflow_results_model.py +106 -0
- rapidata/api_client/models/get_grouped_ranking_workflow_results_result.py +97 -0
- rapidata/api_client/models/get_grouped_ranking_workflow_results_result_paged_result.py +105 -0
- rapidata/api_client/models/get_workflow_by_id_result_workflow.py +23 -9
- rapidata/api_client/models/grouped_ranking_workflow_config.py +143 -0
- rapidata/api_client/models/grouped_ranking_workflow_model.py +135 -0
- rapidata/api_client/models/grouped_ranking_workflow_model1.py +121 -0
- rapidata/api_client/models/multi_asset.py +4 -4
- rapidata/api_client/models/multi_asset_assets_inner.py +170 -0
- rapidata/api_client/models/null_asset.py +1 -3
- rapidata/api_client/models/text_asset.py +1 -3
- rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +23 -9
- rapidata/api_client_README.md +8 -1
- rapidata/rapidata_client/order/_rapidata_order_builder.py +11 -12
- rapidata/rapidata_client/order/rapidata_order.py +16 -16
- rapidata/rapidata_client/order/rapidata_order_manager.py +16 -28
- rapidata/rapidata_client/validation/rapids/rapids.py +2 -2
- rapidata/rapidata_client/validation/validation_set_manager.py +3 -3
- rapidata/rapidata_client/workflow/_base_workflow.py +7 -0
- rapidata/rapidata_client/workflow/_classify_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_compare_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_draw_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_evaluation_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_free_text_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_locate_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_ranking_workflow.py +45 -3
- rapidata/rapidata_client/workflow/_select_words_workflow.py +3 -0
- rapidata/rapidata_client/workflow/_timestamp_workflow.py +3 -0
- {rapidata-2.42.1.dist-info → rapidata-2.42.3.dist-info}/METADATA +1 -1
- {rapidata-2.42.1.dist-info → rapidata-2.42.3.dist-info}/RECORD +42 -34
- {rapidata-2.42.1.dist-info → rapidata-2.42.3.dist-info}/WHEEL +0 -0
- {rapidata-2.42.1.dist-info → rapidata-2.42.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
23
|
+
from rapidata.api_client.models.elo_config import EloConfig
|
|
24
|
+
from typing import Optional, Set
|
|
25
|
+
from typing_extensions import Self
|
|
26
|
+
|
|
27
|
+
class GroupedRankingWorkflowModel1(BaseModel):
|
|
28
|
+
"""
|
|
29
|
+
GroupedRankingWorkflowModel1
|
|
30
|
+
""" # noqa: E501
|
|
31
|
+
t: StrictStr = Field(description="Discriminator value for GroupedRankingWorkflowModel", alias="_t")
|
|
32
|
+
id: StrictStr
|
|
33
|
+
referee: CompareWorkflowModel1Referee
|
|
34
|
+
state: StrictStr
|
|
35
|
+
criteria: StrictStr
|
|
36
|
+
name: StrictStr
|
|
37
|
+
owner_mail: Optional[StrictStr] = Field(default=None, alias="ownerMail")
|
|
38
|
+
elo_config: EloConfig = Field(alias="eloConfig")
|
|
39
|
+
__properties: ClassVar[List[str]] = ["_t", "id", "referee", "state", "criteria", "name", "ownerMail", "eloConfig"]
|
|
40
|
+
|
|
41
|
+
@field_validator('t')
|
|
42
|
+
def t_validate_enum(cls, value):
|
|
43
|
+
"""Validates the enum"""
|
|
44
|
+
if value not in set(['GroupedRankingWorkflowModel']):
|
|
45
|
+
raise ValueError("must be one of enum values ('GroupedRankingWorkflowModel')")
|
|
46
|
+
return value
|
|
47
|
+
|
|
48
|
+
model_config = ConfigDict(
|
|
49
|
+
populate_by_name=True,
|
|
50
|
+
validate_assignment=True,
|
|
51
|
+
protected_namespaces=(),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def to_str(self) -> str:
|
|
56
|
+
"""Returns the string representation of the model using alias"""
|
|
57
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
58
|
+
|
|
59
|
+
def to_json(self) -> str:
|
|
60
|
+
"""Returns the JSON representation of the model using alias"""
|
|
61
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
62
|
+
return json.dumps(self.to_dict())
|
|
63
|
+
|
|
64
|
+
@classmethod
|
|
65
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
66
|
+
"""Create an instance of GroupedRankingWorkflowModel1 from a JSON string"""
|
|
67
|
+
return cls.from_dict(json.loads(json_str))
|
|
68
|
+
|
|
69
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
70
|
+
"""Return the dictionary representation of the model using alias.
|
|
71
|
+
|
|
72
|
+
This has the following differences from calling pydantic's
|
|
73
|
+
`self.model_dump(by_alias=True)`:
|
|
74
|
+
|
|
75
|
+
* `None` is only added to the output dict for nullable fields that
|
|
76
|
+
were set at model initialization. Other fields with value `None`
|
|
77
|
+
are ignored.
|
|
78
|
+
"""
|
|
79
|
+
excluded_fields: Set[str] = set([
|
|
80
|
+
])
|
|
81
|
+
|
|
82
|
+
_dict = self.model_dump(
|
|
83
|
+
by_alias=True,
|
|
84
|
+
exclude=excluded_fields,
|
|
85
|
+
exclude_none=True,
|
|
86
|
+
)
|
|
87
|
+
# override the default output from pydantic by calling `to_dict()` of referee
|
|
88
|
+
if self.referee:
|
|
89
|
+
_dict['referee'] = self.referee.to_dict()
|
|
90
|
+
# override the default output from pydantic by calling `to_dict()` of elo_config
|
|
91
|
+
if self.elo_config:
|
|
92
|
+
_dict['eloConfig'] = self.elo_config.to_dict()
|
|
93
|
+
# set to None if owner_mail (nullable) is None
|
|
94
|
+
# and model_fields_set contains the field
|
|
95
|
+
if self.owner_mail is None and "owner_mail" in self.model_fields_set:
|
|
96
|
+
_dict['ownerMail'] = None
|
|
97
|
+
|
|
98
|
+
return _dict
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
102
|
+
"""Create an instance of GroupedRankingWorkflowModel1 from a dict"""
|
|
103
|
+
if obj is None:
|
|
104
|
+
return None
|
|
105
|
+
|
|
106
|
+
if not isinstance(obj, dict):
|
|
107
|
+
return cls.model_validate(obj)
|
|
108
|
+
|
|
109
|
+
_obj = cls.model_validate({
|
|
110
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'GroupedRankingWorkflowModel',
|
|
111
|
+
"id": obj.get("id"),
|
|
112
|
+
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None,
|
|
113
|
+
"state": obj.get("state"),
|
|
114
|
+
"criteria": obj.get("criteria"),
|
|
115
|
+
"name": obj.get("name"),
|
|
116
|
+
"ownerMail": obj.get("ownerMail"),
|
|
117
|
+
"eloConfig": EloConfig.from_dict(obj["eloConfig"]) if obj.get("eloConfig") is not None else None
|
|
118
|
+
})
|
|
119
|
+
return _obj
|
|
120
|
+
|
|
121
|
+
|
|
@@ -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.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ class MultiAsset(BaseModel):
|
|
|
27
28
|
MultiAsset
|
|
28
29
|
""" # noqa: E501
|
|
29
30
|
t: StrictStr = Field(description="Discriminator value for MultiAsset", alias="_t")
|
|
30
|
-
assets: List[
|
|
31
|
+
assets: List[MultiAssetAssetsInner]
|
|
31
32
|
metadata: Optional[Dict[str, FileAssetMetadataValue]] = None
|
|
32
33
|
__properties: ClassVar[List[str]] = ["_t", "assets", "metadata"]
|
|
33
34
|
|
|
@@ -104,7 +105,7 @@ class MultiAsset(BaseModel):
|
|
|
104
105
|
|
|
105
106
|
_obj = cls.model_validate({
|
|
106
107
|
"_t": obj.get("_t") if obj.get("_t") is not None else 'MultiAsset',
|
|
107
|
-
"assets": [
|
|
108
|
+
"assets": [MultiAssetAssetsInner.from_dict(_item) for _item in obj["assets"]] if obj.get("assets") is not None else None,
|
|
108
109
|
"metadata": dict(
|
|
109
110
|
(_k, FileAssetMetadataValue.from_dict(_v))
|
|
110
111
|
for _k, _v in obj["metadata"].items()
|
|
@@ -114,8 +115,7 @@ class MultiAsset(BaseModel):
|
|
|
114
115
|
})
|
|
115
116
|
return _obj
|
|
116
117
|
|
|
117
|
-
from rapidata.api_client.models.
|
|
118
|
-
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
118
|
+
from rapidata.api_client.models.multi_asset_assets_inner import MultiAssetAssetsInner
|
|
119
119
|
# TODO: Rewrite to not use raise_errors
|
|
120
120
|
MultiAsset.model_rebuild(raise_errors=False)
|
|
121
121
|
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import json
|
|
17
|
+
import pprint
|
|
18
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
|
+
from typing import Any, List, Optional
|
|
20
|
+
from rapidata.api_client.models.file_asset import FileAsset
|
|
21
|
+
from rapidata.api_client.models.null_asset import NullAsset
|
|
22
|
+
from rapidata.api_client.models.text_asset import TextAsset
|
|
23
|
+
from pydantic import StrictStr, Field
|
|
24
|
+
from typing import Union, List, Set, Optional, Dict
|
|
25
|
+
from typing_extensions import Literal, Self
|
|
26
|
+
|
|
27
|
+
MULTIASSETASSETSINNER_ONE_OF_SCHEMAS = ["FileAsset", "MultiAsset", "NullAsset", "TextAsset"]
|
|
28
|
+
|
|
29
|
+
class MultiAssetAssetsInner(BaseModel):
|
|
30
|
+
"""
|
|
31
|
+
MultiAssetAssetsInner
|
|
32
|
+
"""
|
|
33
|
+
# data type: FileAsset
|
|
34
|
+
oneof_schema_1_validator: Optional[FileAsset] = None
|
|
35
|
+
# data type: MultiAsset
|
|
36
|
+
oneof_schema_2_validator: Optional[MultiAsset] = None
|
|
37
|
+
# data type: NullAsset
|
|
38
|
+
oneof_schema_3_validator: Optional[NullAsset] = None
|
|
39
|
+
# data type: TextAsset
|
|
40
|
+
oneof_schema_4_validator: Optional[TextAsset] = None
|
|
41
|
+
actual_instance: Optional[Union[FileAsset, MultiAsset, NullAsset, TextAsset]] = None
|
|
42
|
+
one_of_schemas: Set[str] = { "FileAsset", "MultiAsset", "NullAsset", "TextAsset" }
|
|
43
|
+
|
|
44
|
+
model_config = ConfigDict(
|
|
45
|
+
validate_assignment=True,
|
|
46
|
+
protected_namespaces=(),
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
discriminator_value_class_map: Dict[str, str] = {
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
def __init__(self, *args, **kwargs) -> None:
|
|
54
|
+
if args:
|
|
55
|
+
if len(args) > 1:
|
|
56
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
|
57
|
+
if kwargs:
|
|
58
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
|
59
|
+
super().__init__(actual_instance=args[0])
|
|
60
|
+
else:
|
|
61
|
+
super().__init__(**kwargs)
|
|
62
|
+
|
|
63
|
+
@field_validator('actual_instance')
|
|
64
|
+
def actual_instance_must_validate_oneof(cls, v):
|
|
65
|
+
instance = MultiAssetAssetsInner.model_construct()
|
|
66
|
+
error_messages = []
|
|
67
|
+
match = 0
|
|
68
|
+
# validate data type: FileAsset
|
|
69
|
+
if not isinstance(v, FileAsset):
|
|
70
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FileAsset`")
|
|
71
|
+
else:
|
|
72
|
+
match += 1
|
|
73
|
+
# validate data type: MultiAsset
|
|
74
|
+
if not isinstance(v, MultiAsset):
|
|
75
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `MultiAsset`")
|
|
76
|
+
else:
|
|
77
|
+
match += 1
|
|
78
|
+
# validate data type: NullAsset
|
|
79
|
+
if not isinstance(v, NullAsset):
|
|
80
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `NullAsset`")
|
|
81
|
+
else:
|
|
82
|
+
match += 1
|
|
83
|
+
# validate data type: TextAsset
|
|
84
|
+
if not isinstance(v, TextAsset):
|
|
85
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `TextAsset`")
|
|
86
|
+
else:
|
|
87
|
+
match += 1
|
|
88
|
+
if match > 1:
|
|
89
|
+
# more than 1 match
|
|
90
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in MultiAssetAssetsInner with oneOf schemas: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
|
|
91
|
+
elif match == 0:
|
|
92
|
+
# no match
|
|
93
|
+
raise ValueError("No match found when setting `actual_instance` in MultiAssetAssetsInner with oneOf schemas: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
|
|
94
|
+
else:
|
|
95
|
+
return v
|
|
96
|
+
|
|
97
|
+
@classmethod
|
|
98
|
+
def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
|
|
99
|
+
return cls.from_json(json.dumps(obj))
|
|
100
|
+
|
|
101
|
+
@classmethod
|
|
102
|
+
def from_json(cls, json_str: str) -> Self:
|
|
103
|
+
"""Returns the object represented by the json string"""
|
|
104
|
+
instance = cls.model_construct()
|
|
105
|
+
error_messages = []
|
|
106
|
+
match = 0
|
|
107
|
+
|
|
108
|
+
# deserialize data into FileAsset
|
|
109
|
+
try:
|
|
110
|
+
instance.actual_instance = FileAsset.from_json(json_str)
|
|
111
|
+
match += 1
|
|
112
|
+
except (ValidationError, ValueError) as e:
|
|
113
|
+
error_messages.append(str(e))
|
|
114
|
+
# deserialize data into MultiAsset
|
|
115
|
+
try:
|
|
116
|
+
instance.actual_instance = MultiAsset.from_json(json_str)
|
|
117
|
+
match += 1
|
|
118
|
+
except (ValidationError, ValueError) as e:
|
|
119
|
+
error_messages.append(str(e))
|
|
120
|
+
# deserialize data into NullAsset
|
|
121
|
+
try:
|
|
122
|
+
instance.actual_instance = NullAsset.from_json(json_str)
|
|
123
|
+
match += 1
|
|
124
|
+
except (ValidationError, ValueError) as e:
|
|
125
|
+
error_messages.append(str(e))
|
|
126
|
+
# deserialize data into TextAsset
|
|
127
|
+
try:
|
|
128
|
+
instance.actual_instance = TextAsset.from_json(json_str)
|
|
129
|
+
match += 1
|
|
130
|
+
except (ValidationError, ValueError) as e:
|
|
131
|
+
error_messages.append(str(e))
|
|
132
|
+
|
|
133
|
+
if match > 1:
|
|
134
|
+
# more than 1 match
|
|
135
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into MultiAssetAssetsInner with oneOf schemas: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
|
|
136
|
+
elif match == 0:
|
|
137
|
+
# no match
|
|
138
|
+
raise ValueError("No match found when deserializing the JSON string into MultiAssetAssetsInner with oneOf schemas: FileAsset, MultiAsset, NullAsset, TextAsset. Details: " + ", ".join(error_messages))
|
|
139
|
+
else:
|
|
140
|
+
return instance
|
|
141
|
+
|
|
142
|
+
def to_json(self) -> str:
|
|
143
|
+
"""Returns the JSON representation of the actual instance"""
|
|
144
|
+
if self.actual_instance is None:
|
|
145
|
+
return "null"
|
|
146
|
+
|
|
147
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
|
148
|
+
return self.actual_instance.to_json()
|
|
149
|
+
else:
|
|
150
|
+
return json.dumps(self.actual_instance)
|
|
151
|
+
|
|
152
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], FileAsset, MultiAsset, NullAsset, TextAsset]]:
|
|
153
|
+
"""Returns the dict representation of the actual instance"""
|
|
154
|
+
if self.actual_instance is None:
|
|
155
|
+
return None
|
|
156
|
+
|
|
157
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
|
158
|
+
return self.actual_instance.to_dict()
|
|
159
|
+
else:
|
|
160
|
+
# primitive type
|
|
161
|
+
return self.actual_instance
|
|
162
|
+
|
|
163
|
+
def to_str(self) -> str:
|
|
164
|
+
"""Returns the string representation of the actual instance"""
|
|
165
|
+
return pprint.pformat(self.model_dump())
|
|
166
|
+
|
|
167
|
+
from rapidata.api_client.models.multi_asset import MultiAsset
|
|
168
|
+
# TODO: Rewrite to not use raise_errors
|
|
169
|
+
MultiAssetAssetsInner.model_rebuild(raise_errors=False)
|
|
170
|
+
|
|
@@ -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.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -105,7 +106,4 @@ class NullAsset(BaseModel):
|
|
|
105
106
|
})
|
|
106
107
|
return _obj
|
|
107
108
|
|
|
108
|
-
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
109
|
-
# TODO: Rewrite to not use raise_errors
|
|
110
|
-
NullAsset.model_rebuild(raise_errors=False)
|
|
111
109
|
|
|
@@ -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.file_asset_metadata_value import FileAssetMetadataValue
|
|
22
23
|
from typing import Optional, Set
|
|
23
24
|
from typing_extensions import Self
|
|
24
25
|
|
|
@@ -107,7 +108,4 @@ class TextAsset(BaseModel):
|
|
|
107
108
|
})
|
|
108
109
|
return _obj
|
|
109
110
|
|
|
110
|
-
from rapidata.api_client.models.file_asset_metadata_value import FileAssetMetadataValue
|
|
111
|
-
# TODO: Rewrite to not use raise_errors
|
|
112
|
-
TextAsset.model_rebuild(raise_errors=False)
|
|
113
111
|
|
|
@@ -19,12 +19,13 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, f
|
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.compare_workflow_config import CompareWorkflowConfig
|
|
21
21
|
from rapidata.api_client.models.evaluation_workflow_config import EvaluationWorkflowConfig
|
|
22
|
+
from rapidata.api_client.models.grouped_ranking_workflow_config import GroupedRankingWorkflowConfig
|
|
22
23
|
from rapidata.api_client.models.simple_workflow_config import SimpleWorkflowConfig
|
|
23
24
|
from pydantic import StrictStr, Field
|
|
24
25
|
from typing import Union, List, Set, Optional, Dict
|
|
25
26
|
from typing_extensions import Literal, Self
|
|
26
27
|
|
|
27
|
-
WORKFLOWCONFIGARTIFACTMODELWORKFLOWCONFIG_ONE_OF_SCHEMAS = ["CompareWorkflowConfig", "EvaluationWorkflowConfig", "SimpleWorkflowConfig"]
|
|
28
|
+
WORKFLOWCONFIGARTIFACTMODELWORKFLOWCONFIG_ONE_OF_SCHEMAS = ["CompareWorkflowConfig", "EvaluationWorkflowConfig", "GroupedRankingWorkflowConfig", "SimpleWorkflowConfig"]
|
|
28
29
|
|
|
29
30
|
class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
30
31
|
"""
|
|
@@ -34,10 +35,12 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
34
35
|
oneof_schema_1_validator: Optional[CompareWorkflowConfig] = None
|
|
35
36
|
# data type: EvaluationWorkflowConfig
|
|
36
37
|
oneof_schema_2_validator: Optional[EvaluationWorkflowConfig] = None
|
|
38
|
+
# data type: GroupedRankingWorkflowConfig
|
|
39
|
+
oneof_schema_3_validator: Optional[GroupedRankingWorkflowConfig] = None
|
|
37
40
|
# data type: SimpleWorkflowConfig
|
|
38
|
-
|
|
39
|
-
actual_instance: Optional[Union[CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig]] = None
|
|
40
|
-
one_of_schemas: Set[str] = { "CompareWorkflowConfig", "EvaluationWorkflowConfig", "SimpleWorkflowConfig" }
|
|
41
|
+
oneof_schema_4_validator: Optional[SimpleWorkflowConfig] = None
|
|
42
|
+
actual_instance: Optional[Union[CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig]] = None
|
|
43
|
+
one_of_schemas: Set[str] = { "CompareWorkflowConfig", "EvaluationWorkflowConfig", "GroupedRankingWorkflowConfig", "SimpleWorkflowConfig" }
|
|
41
44
|
|
|
42
45
|
model_config = ConfigDict(
|
|
43
46
|
validate_assignment=True,
|
|
@@ -73,6 +76,11 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
73
76
|
error_messages.append(f"Error! Input type `{type(v)}` is not `EvaluationWorkflowConfig`")
|
|
74
77
|
else:
|
|
75
78
|
match += 1
|
|
79
|
+
# validate data type: GroupedRankingWorkflowConfig
|
|
80
|
+
if not isinstance(v, GroupedRankingWorkflowConfig):
|
|
81
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `GroupedRankingWorkflowConfig`")
|
|
82
|
+
else:
|
|
83
|
+
match += 1
|
|
76
84
|
# validate data type: SimpleWorkflowConfig
|
|
77
85
|
if not isinstance(v, SimpleWorkflowConfig):
|
|
78
86
|
error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowConfig`")
|
|
@@ -80,10 +88,10 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
80
88
|
match += 1
|
|
81
89
|
if match > 1:
|
|
82
90
|
# more than 1 match
|
|
83
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
91
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
84
92
|
elif match == 0:
|
|
85
93
|
# no match
|
|
86
|
-
raise ValueError("No match found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
94
|
+
raise ValueError("No match found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
87
95
|
else:
|
|
88
96
|
return v
|
|
89
97
|
|
|
@@ -110,6 +118,12 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
110
118
|
match += 1
|
|
111
119
|
except (ValidationError, ValueError) as e:
|
|
112
120
|
error_messages.append(str(e))
|
|
121
|
+
# deserialize data into GroupedRankingWorkflowConfig
|
|
122
|
+
try:
|
|
123
|
+
instance.actual_instance = GroupedRankingWorkflowConfig.from_json(json_str)
|
|
124
|
+
match += 1
|
|
125
|
+
except (ValidationError, ValueError) as e:
|
|
126
|
+
error_messages.append(str(e))
|
|
113
127
|
# deserialize data into SimpleWorkflowConfig
|
|
114
128
|
try:
|
|
115
129
|
instance.actual_instance = SimpleWorkflowConfig.from_json(json_str)
|
|
@@ -119,10 +133,10 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
119
133
|
|
|
120
134
|
if match > 1:
|
|
121
135
|
# more than 1 match
|
|
122
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
136
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
123
137
|
elif match == 0:
|
|
124
138
|
# no match
|
|
125
|
-
raise ValueError("No match found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
139
|
+
raise ValueError("No match found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
126
140
|
else:
|
|
127
141
|
return instance
|
|
128
142
|
|
|
@@ -136,7 +150,7 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
136
150
|
else:
|
|
137
151
|
return json.dumps(self.actual_instance)
|
|
138
152
|
|
|
139
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig]]:
|
|
153
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowConfig, EvaluationWorkflowConfig, GroupedRankingWorkflowConfig, SimpleWorkflowConfig]]:
|
|
140
154
|
"""Returns the dict representation of the actual instance"""
|
|
141
155
|
if self.actual_instance is None:
|
|
142
156
|
return None
|
rapidata/api_client_README.md
CHANGED
|
@@ -128,6 +128,7 @@ Class | Method | HTTP request | Description
|
|
|
128
128
|
*DatasetApi* | [**dataset_dataset_id_progress_get**](rapidata/api_client/docs/DatasetApi.md#dataset_dataset_id_progress_get) | **GET** /dataset/{datasetId}/progress | Gets the upload progress of a dataset.
|
|
129
129
|
*EvaluationWorkflowApi* | [**workflow_evaluation_workflow_id_results_get**](rapidata/api_client/docs/EvaluationWorkflowApi.md#workflow_evaluation_workflow_id_results_get) | **GET** /workflow/evaluation/{workflowId}/results | Get the results for an evaluation workflow.
|
|
130
130
|
*FeedbackApi* | [**feedback_post**](rapidata/api_client/docs/FeedbackApi.md#feedback_post) | **POST** /feedback | Submits feedback about our services.
|
|
131
|
+
*GroupedRankingWorkflowApi* | [**workflow_grouped_ranking_workflow_id_results_get**](rapidata/api_client/docs/GroupedRankingWorkflowApi.md#workflow_grouped_ranking_workflow_id_results_get) | **GET** /workflow/grouped-ranking/{workflowId}/results | Get the result overview for a multi compare workflow.
|
|
131
132
|
*IdentityApi* | [**identity_bridge_token_get**](rapidata/api_client/docs/IdentityApi.md#identity_bridge_token_get) | **GET** /identity/bridge-token | Tries to read the bridge token keys for a given read key. The read key is used to retrieve the authentication result written by the write key.
|
|
132
133
|
*IdentityApi* | [**identity_bridge_token_post**](rapidata/api_client/docs/IdentityApi.md#identity_bridge_token_post) | **POST** /identity/bridge-token | Creates a pair of read and write keys for a client. The write key is used to store the authentication result. The read key is used to retrieve the authentication result.
|
|
133
134
|
*IdentityApi* | [**identity_google_one_tap_post**](rapidata/api_client/docs/IdentityApi.md#identity_google_one_tap_post) | **POST** /identity/google-one-tap | Signs in a user using a token received from Google One Tap.
|
|
@@ -228,7 +229,6 @@ Class | Method | HTTP request | Description
|
|
|
228
229
|
- [AndUserFilterModelFiltersInner](rapidata/api_client/docs/AndUserFilterModelFiltersInner.md)
|
|
229
230
|
- [AreRapidsActiveResult](rapidata/api_client/docs/AreRapidsActiveResult.md)
|
|
230
231
|
- [AssetMetadata](rapidata/api_client/docs/AssetMetadata.md)
|
|
231
|
-
- [AssetMetadataAsset](rapidata/api_client/docs/AssetMetadataAsset.md)
|
|
232
232
|
- [AssetMetadataModel](rapidata/api_client/docs/AssetMetadataModel.md)
|
|
233
233
|
- [AttachCategoryRapidBlueprint](rapidata/api_client/docs/AttachCategoryRapidBlueprint.md)
|
|
234
234
|
- [AttachCategoryResult](rapidata/api_client/docs/AttachCategoryResult.md)
|
|
@@ -378,6 +378,9 @@ Class | Method | HTTP request | Description
|
|
|
378
378
|
- [GetDatasetProgressResult](rapidata/api_client/docs/GetDatasetProgressResult.md)
|
|
379
379
|
- [GetEvaluationWorkflowResultsModel](rapidata/api_client/docs/GetEvaluationWorkflowResultsModel.md)
|
|
380
380
|
- [GetFailedDatapointsResult](rapidata/api_client/docs/GetFailedDatapointsResult.md)
|
|
381
|
+
- [GetGroupedRankingWorkflowResultsModel](rapidata/api_client/docs/GetGroupedRankingWorkflowResultsModel.md)
|
|
382
|
+
- [GetGroupedRankingWorkflowResultsResult](rapidata/api_client/docs/GetGroupedRankingWorkflowResultsResult.md)
|
|
383
|
+
- [GetGroupedRankingWorkflowResultsResultPagedResult](rapidata/api_client/docs/GetGroupedRankingWorkflowResultsResultPagedResult.md)
|
|
381
384
|
- [GetLeaderboardByIdResult](rapidata/api_client/docs/GetLeaderboardByIdResult.md)
|
|
382
385
|
- [GetOrderByIdResult](rapidata/api_client/docs/GetOrderByIdResult.md)
|
|
383
386
|
- [GetParticipantByIdResult](rapidata/api_client/docs/GetParticipantByIdResult.md)
|
|
@@ -403,6 +406,9 @@ Class | Method | HTTP request | Description
|
|
|
403
406
|
- [GetWorkflowResultsResult](rapidata/api_client/docs/GetWorkflowResultsResult.md)
|
|
404
407
|
- [GetWorkflowResultsResultPagedResult](rapidata/api_client/docs/GetWorkflowResultsResultPagedResult.md)
|
|
405
408
|
- [GoogleOneTapLoginModel](rapidata/api_client/docs/GoogleOneTapLoginModel.md)
|
|
409
|
+
- [GroupedRankingWorkflowConfig](rapidata/api_client/docs/GroupedRankingWorkflowConfig.md)
|
|
410
|
+
- [GroupedRankingWorkflowModel](rapidata/api_client/docs/GroupedRankingWorkflowModel.md)
|
|
411
|
+
- [GroupedRankingWorkflowModel1](rapidata/api_client/docs/GroupedRankingWorkflowModel1.md)
|
|
406
412
|
- [IWorkflowModelPagedResult](rapidata/api_client/docs/IWorkflowModelPagedResult.md)
|
|
407
413
|
- [ImageDimensionMetadata](rapidata/api_client/docs/ImageDimensionMetadata.md)
|
|
408
414
|
- [ImageDimensionMetadataModel](rapidata/api_client/docs/ImageDimensionMetadataModel.md)
|
|
@@ -431,6 +437,7 @@ Class | Method | HTTP request | Description
|
|
|
431
437
|
- [LocationMetadataModel](rapidata/api_client/docs/LocationMetadataModel.md)
|
|
432
438
|
- [LogicOperator](rapidata/api_client/docs/LogicOperator.md)
|
|
433
439
|
- [MultiAsset](rapidata/api_client/docs/MultiAsset.md)
|
|
440
|
+
- [MultiAssetAssetsInner](rapidata/api_client/docs/MultiAssetAssetsInner.md)
|
|
434
441
|
- [MultiAssetInput](rapidata/api_client/docs/MultiAssetInput.md)
|
|
435
442
|
- [MultiAssetInputAssetsInner](rapidata/api_client/docs/MultiAssetInputAssetsInner.md)
|
|
436
443
|
- [MultiAssetModel](rapidata/api_client/docs/MultiAssetModel.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Literal, Optional, Sequence
|
|
1
|
+
from typing import Literal, Optional, Sequence, get_args
|
|
2
2
|
import random
|
|
3
3
|
import urllib.parse
|
|
4
4
|
import webbrowser
|
|
@@ -43,6 +43,8 @@ from rapidata.rapidata_client.api.rapidata_api_client import (
|
|
|
43
43
|
suppress_rapidata_error_logging,
|
|
44
44
|
)
|
|
45
45
|
|
|
46
|
+
StickyStateLiteral = Literal["Temporary", "Permanent", "Passive"]
|
|
47
|
+
|
|
46
48
|
|
|
47
49
|
class RapidataOrderBuilder:
|
|
48
50
|
"""Builder object for creating Rapidata orders.
|
|
@@ -71,9 +73,7 @@ class RapidataOrderBuilder:
|
|
|
71
73
|
self.__selections: list[RapidataSelection] = []
|
|
72
74
|
self.__priority: int | None = None
|
|
73
75
|
self.__datapoints: list[Datapoint] = []
|
|
74
|
-
self.__sticky_state_value:
|
|
75
|
-
None
|
|
76
|
-
)
|
|
76
|
+
self.__sticky_state_value: StickyStateLiteral | None = None
|
|
77
77
|
self.__validation_set_manager: ValidationSetManager = ValidationSetManager(
|
|
78
78
|
self.__openapi_service
|
|
79
79
|
)
|
|
@@ -147,6 +147,7 @@ class RapidataOrderBuilder:
|
|
|
147
147
|
self.__openapi_service.validation_api.validation_set_recommended_get(
|
|
148
148
|
asset_type=[self.__datapoints[0].get_asset_type()],
|
|
149
149
|
modality=[self.__workflow.modality],
|
|
150
|
+
instruction=self.__workflow._get_instruction(),
|
|
150
151
|
prompt_type=[
|
|
151
152
|
t.value for t in self.__datapoints[0].get_prompt_type()
|
|
152
153
|
],
|
|
@@ -453,18 +454,16 @@ class RapidataOrderBuilder:
|
|
|
453
454
|
return self
|
|
454
455
|
|
|
455
456
|
def _sticky_state(
|
|
456
|
-
self, sticky_state:
|
|
457
|
+
self, sticky_state: StickyStateLiteral | None = None
|
|
457
458
|
) -> "RapidataOrderBuilder":
|
|
458
459
|
"""
|
|
459
460
|
Set the sticky state for the order.
|
|
460
461
|
"""
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
raise TypeError(
|
|
467
|
-
"Sticky state must be of type Literal['None', 'Temporary', 'Permanent']."
|
|
462
|
+
sticky_state_valid_values = get_args(StickyStateLiteral)
|
|
463
|
+
|
|
464
|
+
if sticky_state is not None and sticky_state not in sticky_state_valid_values:
|
|
465
|
+
raise ValueError(
|
|
466
|
+
f"Sticky state must be one of {sticky_state_valid_values} or None"
|
|
468
467
|
)
|
|
469
468
|
|
|
470
469
|
self.__sticky_state_value = sticky_state
|