rapidata 1.2.1__py3-none-any.whl → 1.2.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 +4 -0
- rapidata/api_client/__init__.py +4 -0
- rapidata/api_client/api/identity_api.py +289 -11
- rapidata/api_client/models/__init__.py +4 -0
- rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
- rapidata/api_client/models/create_client_model.py +9 -6
- rapidata/api_client/models/create_client_result.py +89 -0
- rapidata/api_client/models/create_complex_order_result.py +6 -1
- rapidata/api_client/models/create_legacy_client_model.py +89 -0
- rapidata/api_client/models/create_order_model_workflow.py +24 -10
- rapidata/api_client/models/evaluation_workflow_config.py +102 -0
- rapidata/api_client/models/evaluation_workflow_model.py +96 -0
- rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py +23 -9
- rapidata/api_client_README.md +6 -1
- rapidata/rapidata_client/__init__.py +10 -0
- rapidata/rapidata_client/dataset/rapidata_validation_set.py +26 -6
- rapidata/rapidata_client/dataset/validation_set_builder.py +1 -1
- rapidata/rapidata_client/filter/__init__.py +7 -0
- rapidata/rapidata_client/filter/age_filter.py +16 -0
- rapidata/rapidata_client/filter/base_filter.py +9 -0
- rapidata/rapidata_client/filter/campaign_filter.py +17 -0
- rapidata/rapidata_client/filter/country_filter.py +16 -0
- rapidata/rapidata_client/filter/gender_filter.py +16 -0
- rapidata/rapidata_client/filter/language_filter.py +18 -0
- rapidata/rapidata_client/filter/user_score_filter.py +19 -0
- rapidata/rapidata_client/order/rapidata_order_builder.py +84 -56
- {rapidata-1.2.1.dist-info → rapidata-1.2.3.dist-info}/METADATA +1 -1
- {rapidata-1.2.1.dist-info → rapidata-1.2.3.dist-info}/RECORD +30 -18
- {rapidata-1.2.1.dist-info → rapidata-1.2.3.dist-info}/LICENSE +0 -0
- {rapidata-1.2.1.dist-info → rapidata-1.2.3.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
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 typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class CreateLegacyClientModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
The model for creating a new client.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
name: StrictStr = Field(description="A human-readable name for the client used for easy identification.")
|
|
30
|
+
customer_id: StrictStr = Field(description="The id of the customer that owns the client.", alias="customerId")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["name", "customerId"]
|
|
32
|
+
|
|
33
|
+
model_config = ConfigDict(
|
|
34
|
+
populate_by_name=True,
|
|
35
|
+
validate_assignment=True,
|
|
36
|
+
protected_namespaces=(),
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def to_str(self) -> str:
|
|
41
|
+
"""Returns the string representation of the model using alias"""
|
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
43
|
+
|
|
44
|
+
def to_json(self) -> str:
|
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
47
|
+
return json.dumps(self.to_dict())
|
|
48
|
+
|
|
49
|
+
@classmethod
|
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
51
|
+
"""Create an instance of CreateLegacyClientModel from a JSON string"""
|
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
|
56
|
+
|
|
57
|
+
This has the following differences from calling pydantic's
|
|
58
|
+
`self.model_dump(by_alias=True)`:
|
|
59
|
+
|
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
|
61
|
+
were set at model initialization. Other fields with value `None`
|
|
62
|
+
are ignored.
|
|
63
|
+
"""
|
|
64
|
+
excluded_fields: Set[str] = set([
|
|
65
|
+
])
|
|
66
|
+
|
|
67
|
+
_dict = self.model_dump(
|
|
68
|
+
by_alias=True,
|
|
69
|
+
exclude=excluded_fields,
|
|
70
|
+
exclude_none=True,
|
|
71
|
+
)
|
|
72
|
+
return _dict
|
|
73
|
+
|
|
74
|
+
@classmethod
|
|
75
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
76
|
+
"""Create an instance of CreateLegacyClientModel from a dict"""
|
|
77
|
+
if obj is None:
|
|
78
|
+
return None
|
|
79
|
+
|
|
80
|
+
if not isinstance(obj, dict):
|
|
81
|
+
return cls.model_validate(obj)
|
|
82
|
+
|
|
83
|
+
_obj = cls.model_validate({
|
|
84
|
+
"name": obj.get("name"),
|
|
85
|
+
"customerId": obj.get("customerId")
|
|
86
|
+
})
|
|
87
|
+
return _obj
|
|
88
|
+
|
|
89
|
+
|
|
@@ -18,23 +18,26 @@ import pprint
|
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.compare_workflow_model import CompareWorkflowModel
|
|
21
|
+
from rapidata.api_client.models.evaluation_workflow_model import EvaluationWorkflowModel
|
|
21
22
|
from rapidata.api_client.models.simple_workflow_model import SimpleWorkflowModel
|
|
22
23
|
from pydantic import StrictStr, Field
|
|
23
24
|
from typing import Union, List, Set, Optional, Dict
|
|
24
25
|
from typing_extensions import Literal, Self
|
|
25
26
|
|
|
26
|
-
CREATEORDERMODELWORKFLOW_ONE_OF_SCHEMAS = ["CompareWorkflowModel", "SimpleWorkflowModel"]
|
|
27
|
+
CREATEORDERMODELWORKFLOW_ONE_OF_SCHEMAS = ["CompareWorkflowModel", "EvaluationWorkflowModel", "SimpleWorkflowModel"]
|
|
27
28
|
|
|
28
29
|
class CreateOrderModelWorkflow(BaseModel):
|
|
29
30
|
"""
|
|
30
31
|
The workflow helps to determine the tasks that need to be completed by the users.
|
|
31
32
|
"""
|
|
33
|
+
# data type: EvaluationWorkflowModel
|
|
34
|
+
oneof_schema_1_validator: Optional[EvaluationWorkflowModel] = None
|
|
32
35
|
# data type: SimpleWorkflowModel
|
|
33
|
-
|
|
36
|
+
oneof_schema_2_validator: Optional[SimpleWorkflowModel] = None
|
|
34
37
|
# data type: CompareWorkflowModel
|
|
35
|
-
|
|
36
|
-
actual_instance: Optional[Union[CompareWorkflowModel, SimpleWorkflowModel]] = None
|
|
37
|
-
one_of_schemas: Set[str] = { "CompareWorkflowModel", "SimpleWorkflowModel" }
|
|
38
|
+
oneof_schema_3_validator: Optional[CompareWorkflowModel] = None
|
|
39
|
+
actual_instance: Optional[Union[CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "CompareWorkflowModel", "EvaluationWorkflowModel", "SimpleWorkflowModel" }
|
|
38
41
|
|
|
39
42
|
model_config = ConfigDict(
|
|
40
43
|
validate_assignment=True,
|
|
@@ -60,6 +63,11 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
60
63
|
instance = CreateOrderModelWorkflow.model_construct()
|
|
61
64
|
error_messages = []
|
|
62
65
|
match = 0
|
|
66
|
+
# validate data type: EvaluationWorkflowModel
|
|
67
|
+
if not isinstance(v, EvaluationWorkflowModel):
|
|
68
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `EvaluationWorkflowModel`")
|
|
69
|
+
else:
|
|
70
|
+
match += 1
|
|
63
71
|
# validate data type: SimpleWorkflowModel
|
|
64
72
|
if not isinstance(v, SimpleWorkflowModel):
|
|
65
73
|
error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowModel`")
|
|
@@ -72,10 +80,10 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
72
80
|
match += 1
|
|
73
81
|
if match > 1:
|
|
74
82
|
# more than 1 match
|
|
75
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
76
84
|
elif match == 0:
|
|
77
85
|
# no match
|
|
78
|
-
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
79
87
|
else:
|
|
80
88
|
return v
|
|
81
89
|
|
|
@@ -90,6 +98,12 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
90
98
|
error_messages = []
|
|
91
99
|
match = 0
|
|
92
100
|
|
|
101
|
+
# deserialize data into EvaluationWorkflowModel
|
|
102
|
+
try:
|
|
103
|
+
instance.actual_instance = EvaluationWorkflowModel.from_json(json_str)
|
|
104
|
+
match += 1
|
|
105
|
+
except (ValidationError, ValueError) as e:
|
|
106
|
+
error_messages.append(str(e))
|
|
93
107
|
# deserialize data into SimpleWorkflowModel
|
|
94
108
|
try:
|
|
95
109
|
instance.actual_instance = SimpleWorkflowModel.from_json(json_str)
|
|
@@ -105,10 +119,10 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
105
119
|
|
|
106
120
|
if match > 1:
|
|
107
121
|
# more than 1 match
|
|
108
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
122
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
109
123
|
elif match == 0:
|
|
110
124
|
# no match
|
|
111
|
-
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
125
|
+
raise ValueError("No match found when deserializing the JSON string into CreateOrderModelWorkflow with oneOf schemas: CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel. Details: " + ", ".join(error_messages))
|
|
112
126
|
else:
|
|
113
127
|
return instance
|
|
114
128
|
|
|
@@ -122,7 +136,7 @@ class CreateOrderModelWorkflow(BaseModel):
|
|
|
122
136
|
else:
|
|
123
137
|
return json.dumps(self.actual_instance)
|
|
124
138
|
|
|
125
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowModel, SimpleWorkflowModel]]:
|
|
139
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowModel, EvaluationWorkflowModel, SimpleWorkflowModel]]:
|
|
126
140
|
"""Returns the dict representation of the actual instance"""
|
|
127
141
|
if self.actual_instance is None:
|
|
128
142
|
return None
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from rapidata.api_client.models.compare_workflow_model1_referee import CompareWorkflowModel1Referee
|
|
23
|
+
from typing import Optional, Set
|
|
24
|
+
from typing_extensions import Self
|
|
25
|
+
|
|
26
|
+
class EvaluationWorkflowConfig(BaseModel):
|
|
27
|
+
"""
|
|
28
|
+
EvaluationWorkflowConfig
|
|
29
|
+
""" # noqa: E501
|
|
30
|
+
t: StrictStr = Field(description="Discriminator value for EvaluationWorkflowConfig", alias="_t")
|
|
31
|
+
validation_set_id: StrictStr = Field(alias="validationSetId")
|
|
32
|
+
referee: CompareWorkflowModel1Referee
|
|
33
|
+
__properties: ClassVar[List[str]] = ["_t", "validationSetId", "referee"]
|
|
34
|
+
|
|
35
|
+
@field_validator('t')
|
|
36
|
+
def t_validate_enum(cls, value):
|
|
37
|
+
"""Validates the enum"""
|
|
38
|
+
if value not in set(['EvaluationWorkflowConfig']):
|
|
39
|
+
raise ValueError("must be one of enum values ('EvaluationWorkflowConfig')")
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
model_config = ConfigDict(
|
|
43
|
+
populate_by_name=True,
|
|
44
|
+
validate_assignment=True,
|
|
45
|
+
protected_namespaces=(),
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
def to_str(self) -> str:
|
|
50
|
+
"""Returns the string representation of the model using alias"""
|
|
51
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
52
|
+
|
|
53
|
+
def to_json(self) -> str:
|
|
54
|
+
"""Returns the JSON representation of the model using alias"""
|
|
55
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
56
|
+
return json.dumps(self.to_dict())
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
60
|
+
"""Create an instance of EvaluationWorkflowConfig from a JSON string"""
|
|
61
|
+
return cls.from_dict(json.loads(json_str))
|
|
62
|
+
|
|
63
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
64
|
+
"""Return the dictionary representation of the model using alias.
|
|
65
|
+
|
|
66
|
+
This has the following differences from calling pydantic's
|
|
67
|
+
`self.model_dump(by_alias=True)`:
|
|
68
|
+
|
|
69
|
+
* `None` is only added to the output dict for nullable fields that
|
|
70
|
+
were set at model initialization. Other fields with value `None`
|
|
71
|
+
are ignored.
|
|
72
|
+
"""
|
|
73
|
+
excluded_fields: Set[str] = set([
|
|
74
|
+
])
|
|
75
|
+
|
|
76
|
+
_dict = self.model_dump(
|
|
77
|
+
by_alias=True,
|
|
78
|
+
exclude=excluded_fields,
|
|
79
|
+
exclude_none=True,
|
|
80
|
+
)
|
|
81
|
+
# override the default output from pydantic by calling `to_dict()` of referee
|
|
82
|
+
if self.referee:
|
|
83
|
+
_dict['referee'] = self.referee.to_dict()
|
|
84
|
+
return _dict
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
88
|
+
"""Create an instance of EvaluationWorkflowConfig from a dict"""
|
|
89
|
+
if obj is None:
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
if not isinstance(obj, dict):
|
|
93
|
+
return cls.model_validate(obj)
|
|
94
|
+
|
|
95
|
+
_obj = cls.model_validate({
|
|
96
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'EvaluationWorkflowConfig',
|
|
97
|
+
"validationSetId": obj.get("validationSetId"),
|
|
98
|
+
"referee": CompareWorkflowModel1Referee.from_dict(obj["referee"]) if obj.get("referee") is not None else None
|
|
99
|
+
})
|
|
100
|
+
return _obj
|
|
101
|
+
|
|
102
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
|
|
3
|
+
"""
|
|
4
|
+
Rapidata.Dataset
|
|
5
|
+
|
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
|
7
|
+
|
|
8
|
+
The version of the OpenAPI document: v1
|
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
10
|
+
|
|
11
|
+
Do not edit the class manually.
|
|
12
|
+
""" # noqa: E501
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
import pprint
|
|
17
|
+
import re # noqa: F401
|
|
18
|
+
import json
|
|
19
|
+
|
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, field_validator
|
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
|
22
|
+
from typing import Optional, Set
|
|
23
|
+
from typing_extensions import Self
|
|
24
|
+
|
|
25
|
+
class EvaluationWorkflowModel(BaseModel):
|
|
26
|
+
"""
|
|
27
|
+
If the EvaluationWorkflow is chosen a validation set will be used as a source for all tasks. It functions similarly to the SimpleWorkflow as there is a 1:1 mapping between validation rapids and tasks.
|
|
28
|
+
""" # noqa: E501
|
|
29
|
+
t: StrictStr = Field(description="Discriminator value for EvaluationWorkflow", alias="_t")
|
|
30
|
+
validation_set_id: StrictStr = Field(description="The Validation Set Id is used to as a source for the tasks that will be sent to the user.", alias="validationSetId")
|
|
31
|
+
__properties: ClassVar[List[str]] = ["_t", "validationSetId"]
|
|
32
|
+
|
|
33
|
+
@field_validator('t')
|
|
34
|
+
def t_validate_enum(cls, value):
|
|
35
|
+
"""Validates the enum"""
|
|
36
|
+
if value not in set(['EvaluationWorkflow']):
|
|
37
|
+
raise ValueError("must be one of enum values ('EvaluationWorkflow')")
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(
|
|
41
|
+
populate_by_name=True,
|
|
42
|
+
validate_assignment=True,
|
|
43
|
+
protected_namespaces=(),
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def to_str(self) -> str:
|
|
48
|
+
"""Returns the string representation of the model using alias"""
|
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
|
50
|
+
|
|
51
|
+
def to_json(self) -> str:
|
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
|
54
|
+
return json.dumps(self.to_dict())
|
|
55
|
+
|
|
56
|
+
@classmethod
|
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
|
58
|
+
"""Create an instance of EvaluationWorkflowModel from a JSON string"""
|
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
|
60
|
+
|
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
|
63
|
+
|
|
64
|
+
This has the following differences from calling pydantic's
|
|
65
|
+
`self.model_dump(by_alias=True)`:
|
|
66
|
+
|
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
|
68
|
+
were set at model initialization. Other fields with value `None`
|
|
69
|
+
are ignored.
|
|
70
|
+
"""
|
|
71
|
+
excluded_fields: Set[str] = set([
|
|
72
|
+
])
|
|
73
|
+
|
|
74
|
+
_dict = self.model_dump(
|
|
75
|
+
by_alias=True,
|
|
76
|
+
exclude=excluded_fields,
|
|
77
|
+
exclude_none=True,
|
|
78
|
+
)
|
|
79
|
+
return _dict
|
|
80
|
+
|
|
81
|
+
@classmethod
|
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
|
83
|
+
"""Create an instance of EvaluationWorkflowModel from a dict"""
|
|
84
|
+
if obj is None:
|
|
85
|
+
return None
|
|
86
|
+
|
|
87
|
+
if not isinstance(obj, dict):
|
|
88
|
+
return cls.model_validate(obj)
|
|
89
|
+
|
|
90
|
+
_obj = cls.model_validate({
|
|
91
|
+
"_t": obj.get("_t") if obj.get("_t") is not None else 'EvaluationWorkflow',
|
|
92
|
+
"validationSetId": obj.get("validationSetId")
|
|
93
|
+
})
|
|
94
|
+
return _obj
|
|
95
|
+
|
|
96
|
+
|
|
@@ -18,12 +18,13 @@ import pprint
|
|
|
18
18
|
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
|
19
19
|
from typing import Any, List, Optional
|
|
20
20
|
from rapidata.api_client.models.compare_workflow_config import CompareWorkflowConfig
|
|
21
|
+
from rapidata.api_client.models.evaluation_workflow_config import EvaluationWorkflowConfig
|
|
21
22
|
from rapidata.api_client.models.simple_workflow_config import SimpleWorkflowConfig
|
|
22
23
|
from pydantic import StrictStr, Field
|
|
23
24
|
from typing import Union, List, Set, Optional, Dict
|
|
24
25
|
from typing_extensions import Literal, Self
|
|
25
26
|
|
|
26
|
-
WORKFLOWCONFIGARTIFACTMODELWORKFLOWCONFIG_ONE_OF_SCHEMAS = ["CompareWorkflowConfig", "SimpleWorkflowConfig"]
|
|
27
|
+
WORKFLOWCONFIGARTIFACTMODELWORKFLOWCONFIG_ONE_OF_SCHEMAS = ["CompareWorkflowConfig", "EvaluationWorkflowConfig", "SimpleWorkflowConfig"]
|
|
27
28
|
|
|
28
29
|
class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
29
30
|
"""
|
|
@@ -31,10 +32,12 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
31
32
|
"""
|
|
32
33
|
# data type: CompareWorkflowConfig
|
|
33
34
|
oneof_schema_1_validator: Optional[CompareWorkflowConfig] = None
|
|
35
|
+
# data type: EvaluationWorkflowConfig
|
|
36
|
+
oneof_schema_2_validator: Optional[EvaluationWorkflowConfig] = None
|
|
34
37
|
# data type: SimpleWorkflowConfig
|
|
35
|
-
|
|
36
|
-
actual_instance: Optional[Union[CompareWorkflowConfig, SimpleWorkflowConfig]] = None
|
|
37
|
-
one_of_schemas: Set[str] = { "CompareWorkflowConfig", "SimpleWorkflowConfig" }
|
|
38
|
+
oneof_schema_3_validator: Optional[SimpleWorkflowConfig] = None
|
|
39
|
+
actual_instance: Optional[Union[CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig]] = None
|
|
40
|
+
one_of_schemas: Set[str] = { "CompareWorkflowConfig", "EvaluationWorkflowConfig", "SimpleWorkflowConfig" }
|
|
38
41
|
|
|
39
42
|
model_config = ConfigDict(
|
|
40
43
|
validate_assignment=True,
|
|
@@ -65,6 +68,11 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
65
68
|
error_messages.append(f"Error! Input type `{type(v)}` is not `CompareWorkflowConfig`")
|
|
66
69
|
else:
|
|
67
70
|
match += 1
|
|
71
|
+
# validate data type: EvaluationWorkflowConfig
|
|
72
|
+
if not isinstance(v, EvaluationWorkflowConfig):
|
|
73
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `EvaluationWorkflowConfig`")
|
|
74
|
+
else:
|
|
75
|
+
match += 1
|
|
68
76
|
# validate data type: SimpleWorkflowConfig
|
|
69
77
|
if not isinstance(v, SimpleWorkflowConfig):
|
|
70
78
|
error_messages.append(f"Error! Input type `{type(v)}` is not `SimpleWorkflowConfig`")
|
|
@@ -72,10 +80,10 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
72
80
|
match += 1
|
|
73
81
|
if match > 1:
|
|
74
82
|
# more than 1 match
|
|
75
|
-
raise ValueError("Multiple matches found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
83
|
+
raise ValueError("Multiple matches found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
76
84
|
elif match == 0:
|
|
77
85
|
# no match
|
|
78
|
-
raise ValueError("No match found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
86
|
+
raise ValueError("No match found when setting `actual_instance` in WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
79
87
|
else:
|
|
80
88
|
return v
|
|
81
89
|
|
|
@@ -96,6 +104,12 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
96
104
|
match += 1
|
|
97
105
|
except (ValidationError, ValueError) as e:
|
|
98
106
|
error_messages.append(str(e))
|
|
107
|
+
# deserialize data into EvaluationWorkflowConfig
|
|
108
|
+
try:
|
|
109
|
+
instance.actual_instance = EvaluationWorkflowConfig.from_json(json_str)
|
|
110
|
+
match += 1
|
|
111
|
+
except (ValidationError, ValueError) as e:
|
|
112
|
+
error_messages.append(str(e))
|
|
99
113
|
# deserialize data into SimpleWorkflowConfig
|
|
100
114
|
try:
|
|
101
115
|
instance.actual_instance = SimpleWorkflowConfig.from_json(json_str)
|
|
@@ -105,10 +119,10 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
105
119
|
|
|
106
120
|
if match > 1:
|
|
107
121
|
# more than 1 match
|
|
108
|
-
raise ValueError("Multiple matches found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
122
|
+
raise ValueError("Multiple matches found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
109
123
|
elif match == 0:
|
|
110
124
|
# no match
|
|
111
|
-
raise ValueError("No match found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
125
|
+
raise ValueError("No match found when deserializing the JSON string into WorkflowConfigArtifactModelWorkflowConfig with oneOf schemas: CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig. Details: " + ", ".join(error_messages))
|
|
112
126
|
else:
|
|
113
127
|
return instance
|
|
114
128
|
|
|
@@ -122,7 +136,7 @@ class WorkflowConfigArtifactModelWorkflowConfig(BaseModel):
|
|
|
122
136
|
else:
|
|
123
137
|
return json.dumps(self.actual_instance)
|
|
124
138
|
|
|
125
|
-
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowConfig, SimpleWorkflowConfig]]:
|
|
139
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], CompareWorkflowConfig, EvaluationWorkflowConfig, SimpleWorkflowConfig]]:
|
|
126
140
|
"""Returns the dict representation of the actual instance"""
|
|
127
141
|
if self.actual_instance is None:
|
|
128
142
|
return None
|
rapidata/api_client_README.md
CHANGED
|
@@ -90,7 +90,8 @@ Class | Method | HTTP request | Description
|
|
|
90
90
|
*DatasetApi* | [**dataset_upload_files_from_s3_post**](rapidata/api_client/docs/DatasetApi.md#dataset_upload_files_from_s3_post) | **POST** /Dataset/UploadFilesFromS3 | Uploads files from an S3 bucket to a dataset.
|
|
91
91
|
*DatasetApi* | [**dataset_upload_images_to_dataset_post**](rapidata/api_client/docs/DatasetApi.md#dataset_upload_images_to_dataset_post) | **POST** /Dataset/UploadImagesToDataset | Uploads images to a dataset.
|
|
92
92
|
*IdentityApi* | [**identity_confirm_get**](rapidata/api_client/docs/IdentityApi.md#identity_confirm_get) | **GET** /Identity/Confirm | Confirms a user's signup by a token.
|
|
93
|
-
*IdentityApi* | [**identity_create_client_post**](rapidata/api_client/docs/IdentityApi.md#identity_create_client_post) | **POST** /Identity/CreateClient | Creates a new client for
|
|
93
|
+
*IdentityApi* | [**identity_create_client_post**](rapidata/api_client/docs/IdentityApi.md#identity_create_client_post) | **POST** /Identity/CreateClient | Creates a new client for the current customer.
|
|
94
|
+
*IdentityApi* | [**identity_create_legacy_client_post**](rapidata/api_client/docs/IdentityApi.md#identity_create_legacy_client_post) | **POST** /Identity/CreateLegacyClient | Creates a new client for a customer.
|
|
94
95
|
*IdentityApi* | [**identity_external_login_callback_get**](rapidata/api_client/docs/IdentityApi.md#identity_external_login_callback_get) | **GET** /Identity/ExternalLoginCallback | Logs in a user using after receiving a grant from an external provider.
|
|
95
96
|
*IdentityApi* | [**identity_external_login_post**](rapidata/api_client/docs/IdentityApi.md#identity_external_login_post) | **POST** /Identity/ExternalLogin | Logs in a user using an external provider.
|
|
96
97
|
*IdentityApi* | [**identity_get_auth_token_get**](rapidata/api_client/docs/IdentityApi.md#identity_get_auth_token_get) | **GET** /Identity/GetAuthToken | Issues a new auth token using the refresh token.
|
|
@@ -205,6 +206,7 @@ Class | Method | HTTP request | Description
|
|
|
205
206
|
- [CountMetadataModel](rapidata/api_client/docs/CountMetadataModel.md)
|
|
206
207
|
- [CountryUserFilterModel](rapidata/api_client/docs/CountryUserFilterModel.md)
|
|
207
208
|
- [CreateClientModel](rapidata/api_client/docs/CreateClientModel.md)
|
|
209
|
+
- [CreateClientResult](rapidata/api_client/docs/CreateClientResult.md)
|
|
208
210
|
- [CreateComplexOrderModel](rapidata/api_client/docs/CreateComplexOrderModel.md)
|
|
209
211
|
- [CreateComplexOrderModelPipeline](rapidata/api_client/docs/CreateComplexOrderModelPipeline.md)
|
|
210
212
|
- [CreateComplexOrderResult](rapidata/api_client/docs/CreateComplexOrderResult.md)
|
|
@@ -212,6 +214,7 @@ Class | Method | HTTP request | Description
|
|
|
212
214
|
- [CreateDatasetArtifactModelDataset](rapidata/api_client/docs/CreateDatasetArtifactModelDataset.md)
|
|
213
215
|
- [CreateDemographicRapidModel](rapidata/api_client/docs/CreateDemographicRapidModel.md)
|
|
214
216
|
- [CreateEmptyValidationSetResult](rapidata/api_client/docs/CreateEmptyValidationSetResult.md)
|
|
217
|
+
- [CreateLegacyClientModel](rapidata/api_client/docs/CreateLegacyClientModel.md)
|
|
215
218
|
- [CreateOrderModel](rapidata/api_client/docs/CreateOrderModel.md)
|
|
216
219
|
- [CreateOrderModelReferee](rapidata/api_client/docs/CreateOrderModelReferee.md)
|
|
217
220
|
- [CreateOrderModelUserFiltersInner](rapidata/api_client/docs/CreateOrderModelUserFiltersInner.md)
|
|
@@ -237,6 +240,8 @@ Class | Method | HTTP request | Description
|
|
|
237
240
|
- [EarlyStoppingRefereeModel](rapidata/api_client/docs/EarlyStoppingRefereeModel.md)
|
|
238
241
|
- [EmptyValidationTruth](rapidata/api_client/docs/EmptyValidationTruth.md)
|
|
239
242
|
- [ErrorType](rapidata/api_client/docs/ErrorType.md)
|
|
243
|
+
- [EvaluationWorkflowConfig](rapidata/api_client/docs/EvaluationWorkflowConfig.md)
|
|
244
|
+
- [EvaluationWorkflowModel](rapidata/api_client/docs/EvaluationWorkflowModel.md)
|
|
240
245
|
- [FeatureFlag](rapidata/api_client/docs/FeatureFlag.md)
|
|
241
246
|
- [FeatureFlagModel](rapidata/api_client/docs/FeatureFlagModel.md)
|
|
242
247
|
- [FeedbackModel](rapidata/api_client/docs/FeedbackModel.md)
|
|
@@ -22,3 +22,13 @@ from .metadata import (
|
|
|
22
22
|
from .feature_flags import FeatureFlags
|
|
23
23
|
from .country_codes import CountryCodes
|
|
24
24
|
from .assets import MediaAsset, TextAsset, MultiAsset
|
|
25
|
+
from .filter import (
|
|
26
|
+
CountryFilter,
|
|
27
|
+
LanguageFilter,
|
|
28
|
+
UserScoreFilter,
|
|
29
|
+
CampaignFilter,
|
|
30
|
+
AgeFilter,
|
|
31
|
+
AgeGroup,
|
|
32
|
+
GenderFilter,
|
|
33
|
+
Gender,
|
|
34
|
+
)
|
|
@@ -110,11 +110,6 @@ class RapidataValidationSet:
|
|
|
110
110
|
model=model, files=[asset.path]
|
|
111
111
|
)
|
|
112
112
|
|
|
113
|
-
elif isinstance(asset, MultiAsset):
|
|
114
|
-
self.openapi_service.validation_api.validation_add_validation_rapid_post(
|
|
115
|
-
model=model, files=[a.path for a in asset if isinstance(a, MediaAsset)]
|
|
116
|
-
)
|
|
117
|
-
|
|
118
113
|
elif isinstance(asset, TextAsset):
|
|
119
114
|
model = AddValidationTextRapidModel(
|
|
120
115
|
validationSetId=self.id,
|
|
@@ -125,11 +120,36 @@ class RapidataValidationSet:
|
|
|
125
120
|
for meta in metadata
|
|
126
121
|
],
|
|
127
122
|
randomCorrectProbability=randomCorrectProbability,
|
|
128
|
-
|
|
123
|
+
texts=[asset.text],
|
|
129
124
|
)
|
|
130
125
|
self.openapi_service.validation_api.validation_add_validation_text_rapid_post(
|
|
131
126
|
add_validation_text_rapid_model=model
|
|
132
127
|
)
|
|
128
|
+
|
|
129
|
+
elif isinstance(asset, MultiAsset):
|
|
130
|
+
files = [a.path for a in asset if isinstance(a, MediaAsset)]
|
|
131
|
+
texts = [a.text for a in asset if isinstance(a, TextAsset)]
|
|
132
|
+
if files:
|
|
133
|
+
self.openapi_service.validation_api.validation_add_validation_rapid_post(
|
|
134
|
+
model=model, files=files # type: ignore
|
|
135
|
+
)
|
|
136
|
+
if texts:
|
|
137
|
+
model = AddValidationTextRapidModel(
|
|
138
|
+
validationSetId=self.id,
|
|
139
|
+
payload=AddValidationRapidModelPayload(payload),
|
|
140
|
+
truth=AddValidationRapidModelTruth(truths),
|
|
141
|
+
metadata=[
|
|
142
|
+
DatapointMetadataModelMetadataInner(meta.to_model())
|
|
143
|
+
for meta in metadata
|
|
144
|
+
],
|
|
145
|
+
randomCorrectProbability=randomCorrectProbability,
|
|
146
|
+
texts=texts,
|
|
147
|
+
)
|
|
148
|
+
self.openapi_service.validation_api.validation_add_validation_text_rapid_post(
|
|
149
|
+
add_validation_text_rapid_model=model
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
|
|
133
153
|
else:
|
|
134
154
|
raise ValueError("Invalid asset type")
|
|
135
155
|
|
|
@@ -36,7 +36,7 @@ class ValidationSetBuilder:
|
|
|
36
36
|
self.validation_set_id: str | None = None
|
|
37
37
|
self._rapid_parts: list[ValidatioRapidParts] = []
|
|
38
38
|
|
|
39
|
-
def create(self):
|
|
39
|
+
def create(self) -> RapidataValidationSet:
|
|
40
40
|
"""Create the validation set by executing all HTTP requests. This should be the last method called on the builder.
|
|
41
41
|
|
|
42
42
|
Returns:
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
from .base_filter import Filter
|
|
2
|
+
from .age_filter import AgeFilter, AgeGroup
|
|
3
|
+
from .campaign_filter import CampaignFilter
|
|
4
|
+
from .country_filter import CountryFilter
|
|
5
|
+
from .gender_filter import GenderFilter, Gender
|
|
6
|
+
from .language_filter import LanguageFilter
|
|
7
|
+
from .user_score_filter import UserScoreFilter
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter.base_filter import Filter
|
|
3
|
+
from rapidata.api_client.models.age_user_filter_model import AgeUserFilterModel
|
|
4
|
+
from rapidata.api_client.models.age_group import AgeGroup
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class AgeFilter(Filter):
|
|
8
|
+
|
|
9
|
+
def __init__(self, age_groups: list[AgeGroup]):
|
|
10
|
+
self.age_groups = age_groups
|
|
11
|
+
|
|
12
|
+
def to_model(self):
|
|
13
|
+
return AgeUserFilterModel(
|
|
14
|
+
_t="AgeFilter",
|
|
15
|
+
ageGroups=self.age_groups,
|
|
16
|
+
)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter.base_filter import Filter
|
|
3
|
+
from rapidata.api_client.models.campaign_user_filter_model import (
|
|
4
|
+
CampaignUserFilterModel,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class CampaignFilter(Filter):
|
|
9
|
+
|
|
10
|
+
def __init__(self, campaign_ids: list[str]):
|
|
11
|
+
self.campaign_ids = campaign_ids
|
|
12
|
+
|
|
13
|
+
def to_model(self):
|
|
14
|
+
return CampaignUserFilterModel(
|
|
15
|
+
_t="CampaignFilter",
|
|
16
|
+
campaignIds=self.campaign_ids,
|
|
17
|
+
)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter.base_filter import Filter
|
|
3
|
+
from rapidata.api_client.models.country_user_filter_model import CountryUserFilterModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CountryFilter(Filter):
|
|
7
|
+
|
|
8
|
+
def __init__(self, country_codes: list[str]):
|
|
9
|
+
# check that all characters in the country codes are uppercase
|
|
10
|
+
if not all([code.isupper() for code in country_codes]):
|
|
11
|
+
raise ValueError("Country codes must be uppercase")
|
|
12
|
+
|
|
13
|
+
self.country_codes = country_codes
|
|
14
|
+
|
|
15
|
+
def to_model(self):
|
|
16
|
+
return CountryUserFilterModel(_t="CountryFilter", countries=self.country_codes)
|