rapidata 1.2.1__py3-none-any.whl → 1.2.2__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/models/add_validation_text_rapid_model.py +3 -3
- 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.2.dist-info}/METADATA +1 -1
- {rapidata-1.2.1.dist-info → rapidata-1.2.2.dist-info}/RECORD +18 -10
- {rapidata-1.2.1.dist-info → rapidata-1.2.2.dist-info}/LICENSE +0 -0
- {rapidata-1.2.1.dist-info → rapidata-1.2.2.dist-info}/WHEEL +0 -0
rapidata/__init__.py
CHANGED
|
@@ -33,9 +33,9 @@ class AddValidationTextRapidModel(BaseModel):
|
|
|
33
33
|
payload: AddValidationRapidModelPayload
|
|
34
34
|
metadata: List[DatapointMetadataModelMetadataInner] = Field(description="Some metadata to attach to the rapid.")
|
|
35
35
|
truth: AddValidationRapidModelTruth
|
|
36
|
-
|
|
36
|
+
texts: List[StrictStr]
|
|
37
37
|
random_correct_probability: Optional[Union[StrictFloat, StrictInt]] = Field(description="The probability for an answer to be correct when randomly guessing.", alias="randomCorrectProbability")
|
|
38
|
-
__properties: ClassVar[List[str]] = ["validationSetId", "payload", "metadata", "truth", "
|
|
38
|
+
__properties: ClassVar[List[str]] = ["validationSetId", "payload", "metadata", "truth", "texts", "randomCorrectProbability"]
|
|
39
39
|
|
|
40
40
|
model_config = ConfigDict(
|
|
41
41
|
populate_by_name=True,
|
|
@@ -110,7 +110,7 @@ class AddValidationTextRapidModel(BaseModel):
|
|
|
110
110
|
"payload": AddValidationRapidModelPayload.from_dict(obj["payload"]) if obj.get("payload") is not None else None,
|
|
111
111
|
"metadata": [DatapointMetadataModelMetadataInner.from_dict(_item) for _item in obj["metadata"]] if obj.get("metadata") is not None else None,
|
|
112
112
|
"truth": AddValidationRapidModelTruth.from_dict(obj["truth"]) if obj.get("truth") is not None else None,
|
|
113
|
-
"
|
|
113
|
+
"texts": obj.get("texts"),
|
|
114
114
|
"randomCorrectProbability": obj.get("randomCorrectProbability")
|
|
115
115
|
})
|
|
116
116
|
return _obj
|
|
@@ -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)
|
|
@@ -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.gender_user_filter_model import GenderUserFilterModel
|
|
4
|
+
from rapidata.api_client.models.gender import Gender
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class GenderFilter(Filter):
|
|
8
|
+
|
|
9
|
+
def __init__(self, genders: list[Gender]):
|
|
10
|
+
self.genders = genders
|
|
11
|
+
|
|
12
|
+
def to_model(self):
|
|
13
|
+
return GenderUserFilterModel(
|
|
14
|
+
_t="GenderFilter",
|
|
15
|
+
genders=self.genders,
|
|
16
|
+
)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter.base_filter import Filter
|
|
3
|
+
from rapidata.api_client.models.language_user_filter_model import (
|
|
4
|
+
LanguageUserFilterModel,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class LanguageFilter(Filter):
|
|
9
|
+
|
|
10
|
+
def __init__(self, language_codes: list[str]):
|
|
11
|
+
# check that all characters in the language codes are lowercase
|
|
12
|
+
if not all([code.islower() for code in language_codes]):
|
|
13
|
+
raise ValueError("Language codes must be lowercase")
|
|
14
|
+
|
|
15
|
+
self.languages = language_codes
|
|
16
|
+
|
|
17
|
+
def to_model(self):
|
|
18
|
+
return LanguageUserFilterModel(_t="LanguageFilter", languages=self.languages)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter.base_filter import Filter
|
|
3
|
+
from rapidata.api_client.models.user_score_user_filter_model import (
|
|
4
|
+
UserScoreUserFilterModel,
|
|
5
|
+
)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class UserScoreFilter(Filter):
|
|
9
|
+
|
|
10
|
+
def __init__(self, lower_bound: int = 0, upper_bound: int = 1):
|
|
11
|
+
self.upper_bound = upper_bound
|
|
12
|
+
self.lower_bound = lower_bound
|
|
13
|
+
|
|
14
|
+
def to_model(self):
|
|
15
|
+
return UserScoreUserFilterModel(
|
|
16
|
+
_t="UserScoreFilter",
|
|
17
|
+
upperbound=self.upper_bound,
|
|
18
|
+
lowerbound=self.lower_bound,
|
|
19
|
+
)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
from warnings import warn
|
|
2
|
+
|
|
1
3
|
from rapidata.api_client.models.aggregator_type import AggregatorType
|
|
2
4
|
from rapidata.api_client.models.capped_selection_selections_inner import (
|
|
3
5
|
CappedSelectionSelectionsInner,
|
|
@@ -21,6 +23,7 @@ from rapidata.rapidata_client.metadata.base_metadata import Metadata
|
|
|
21
23
|
from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
|
|
22
24
|
from rapidata.rapidata_client.referee.naive_referee import NaiveReferee
|
|
23
25
|
from rapidata.rapidata_client.selection.base_selection import Selection
|
|
26
|
+
from rapidata.rapidata_client.filter import Filter, CountryFilter, LanguageFilter
|
|
24
27
|
from rapidata.rapidata_client.workflow import Workflow
|
|
25
28
|
from rapidata.rapidata_client.order.rapidata_order import RapidataOrder
|
|
26
29
|
from rapidata.rapidata_client.referee import Referee
|
|
@@ -63,8 +66,7 @@ class RapidataOrderBuilder:
|
|
|
63
66
|
self._aggregator: AggregatorType | None = None
|
|
64
67
|
self._validation_set_id: str | None = None
|
|
65
68
|
self._feature_flags: FeatureFlags | None = None
|
|
66
|
-
self.
|
|
67
|
-
self._language_codes: list[str] | None = None
|
|
69
|
+
self._user_filters: list[Filter] = []
|
|
68
70
|
self._selections: list[Selection] = []
|
|
69
71
|
self._rapids_per_bag: int = 2
|
|
70
72
|
self._priority: int = 50
|
|
@@ -87,31 +89,14 @@ class RapidataOrderBuilder:
|
|
|
87
89
|
print("No referee provided, using default NaiveReferee.")
|
|
88
90
|
self._referee = NaiveReferee()
|
|
89
91
|
|
|
90
|
-
user_filters = []
|
|
91
|
-
|
|
92
|
-
if self._country_codes is not None:
|
|
93
|
-
user_filters.append(
|
|
94
|
-
CreateOrderModelUserFiltersInner(
|
|
95
|
-
CountryUserFilterModel(
|
|
96
|
-
_t="CountryFilter", countries=self._country_codes
|
|
97
|
-
)
|
|
98
|
-
)
|
|
99
|
-
)
|
|
100
|
-
|
|
101
|
-
if self._language_codes is not None:
|
|
102
|
-
user_filters.append(
|
|
103
|
-
CreateOrderModelUserFiltersInner(
|
|
104
|
-
LanguageUserFilterModel(
|
|
105
|
-
_t="LanguageFilter", languages=self._language_codes
|
|
106
|
-
)
|
|
107
|
-
)
|
|
108
|
-
)
|
|
109
|
-
|
|
110
92
|
return CreateOrderModel(
|
|
111
93
|
_t="CreateOrderModel",
|
|
112
94
|
orderName=self._name,
|
|
113
95
|
workflow=CreateOrderModelWorkflow(self._workflow.to_model()),
|
|
114
|
-
userFilters=
|
|
96
|
+
userFilters=[
|
|
97
|
+
CreateOrderModelUserFiltersInner(user_filter.to_model())
|
|
98
|
+
for user_filter in self._user_filters
|
|
99
|
+
],
|
|
115
100
|
referee=CreateOrderModelReferee(self._referee.to_model()),
|
|
116
101
|
validationSetId=self._validation_set_id,
|
|
117
102
|
featureFlags=(
|
|
@@ -149,9 +134,9 @@ class RapidataOrderBuilder:
|
|
|
149
134
|
if isinstance(
|
|
150
135
|
self._workflow, CompareWorkflow
|
|
151
136
|
): # Temporary fix; will be handled by backend in the future
|
|
152
|
-
assert all(
|
|
153
|
-
|
|
154
|
-
)
|
|
137
|
+
assert all(
|
|
138
|
+
isinstance(item, MultiAsset) for item in self._assets
|
|
139
|
+
), "The media paths must be of type MultiAsset for comparison tasks."
|
|
155
140
|
|
|
156
141
|
result = self._openapi_service.order_api.order_create_post(
|
|
157
142
|
create_order_model=order_model
|
|
@@ -167,22 +152,26 @@ class RapidataOrderBuilder:
|
|
|
167
152
|
|
|
168
153
|
if all(isinstance(item, MediaAsset) for item in self._assets):
|
|
169
154
|
assets = cast(list[MediaAsset], self._assets)
|
|
170
|
-
order.dataset.add_media_from_paths(
|
|
171
|
-
|
|
172
|
-
)
|
|
173
|
-
|
|
155
|
+
order.dataset.add_media_from_paths(assets, self._metadata, max_workers)
|
|
156
|
+
|
|
174
157
|
elif all(isinstance(item, TextAsset) for item in self._assets):
|
|
175
158
|
assets = cast(list[TextAsset], self._assets)
|
|
176
159
|
order.dataset.add_texts(assets)
|
|
177
160
|
|
|
178
161
|
elif all(isinstance(item, MultiAsset) for item in self._assets):
|
|
179
162
|
multi_assets = cast(list[MultiAsset], self._assets)
|
|
180
|
-
|
|
163
|
+
|
|
181
164
|
# Check if all MultiAssets contain the same type of assets
|
|
182
165
|
first_asset_type = type(multi_assets[0].assets[0])
|
|
183
|
-
if not all(
|
|
184
|
-
|
|
185
|
-
|
|
166
|
+
if not all(
|
|
167
|
+
isinstance(asset, first_asset_type)
|
|
168
|
+
for multi_asset in multi_assets
|
|
169
|
+
for asset in multi_asset.assets
|
|
170
|
+
):
|
|
171
|
+
raise ValueError(
|
|
172
|
+
"All MultiAssets must contain the same type of assets (either all MediaAssets or all TextAssets)."
|
|
173
|
+
)
|
|
174
|
+
|
|
186
175
|
# Process based on the asset type
|
|
187
176
|
if issubclass(first_asset_type, MediaAsset):
|
|
188
177
|
order.dataset.add_media_from_paths(
|
|
@@ -193,10 +182,14 @@ class RapidataOrderBuilder:
|
|
|
193
182
|
order.dataset.add_texts(multi_assets)
|
|
194
183
|
|
|
195
184
|
else:
|
|
196
|
-
raise ValueError(
|
|
197
|
-
|
|
185
|
+
raise ValueError(
|
|
186
|
+
"MultiAsset must contain MediaAssets or TextAssets objects."
|
|
187
|
+
)
|
|
188
|
+
|
|
198
189
|
else:
|
|
199
|
-
raise ValueError(
|
|
190
|
+
raise ValueError(
|
|
191
|
+
"Media paths must be of type MediaAsset, TextAsset, or MultiAsset."
|
|
192
|
+
)
|
|
200
193
|
|
|
201
194
|
if submit:
|
|
202
195
|
order.submit()
|
|
@@ -215,7 +208,7 @@ class RapidataOrderBuilder:
|
|
|
215
208
|
"""
|
|
216
209
|
if not isinstance(workflow, Workflow):
|
|
217
210
|
raise TypeError("Workflow must be of type Workflow.")
|
|
218
|
-
|
|
211
|
+
|
|
219
212
|
self._workflow = workflow
|
|
220
213
|
return self
|
|
221
214
|
|
|
@@ -231,7 +224,7 @@ class RapidataOrderBuilder:
|
|
|
231
224
|
"""
|
|
232
225
|
if not isinstance(referee, Referee):
|
|
233
226
|
raise TypeError("Referee must be of type Referee.")
|
|
234
|
-
|
|
227
|
+
|
|
235
228
|
self._referee = referee
|
|
236
229
|
return self
|
|
237
230
|
|
|
@@ -255,15 +248,17 @@ class RapidataOrderBuilder:
|
|
|
255
248
|
|
|
256
249
|
for a in asset:
|
|
257
250
|
if not isinstance(a, (MediaAsset, TextAsset, MultiAsset)):
|
|
258
|
-
raise TypeError(
|
|
251
|
+
raise TypeError(
|
|
252
|
+
"Media paths must be of type MediaAsset, TextAsset, or MultiAsset."
|
|
253
|
+
)
|
|
259
254
|
|
|
260
255
|
if metadata:
|
|
261
256
|
for data in metadata:
|
|
262
257
|
if not isinstance(data, Metadata):
|
|
263
258
|
raise TypeError("Metadata must be of type Metadata.")
|
|
264
|
-
|
|
259
|
+
|
|
265
260
|
self._assets = asset
|
|
266
|
-
self._metadata = metadata
|
|
261
|
+
self._metadata = metadata # type: ignore
|
|
267
262
|
return self
|
|
268
263
|
|
|
269
264
|
def feature_flags(self, feature_flags: FeatureFlags) -> "RapidataOrderBuilder":
|
|
@@ -278,10 +273,33 @@ class RapidataOrderBuilder:
|
|
|
278
273
|
"""
|
|
279
274
|
if not isinstance(feature_flags, FeatureFlags):
|
|
280
275
|
raise TypeError("Feature flags must be of type FeatureFlags.")
|
|
281
|
-
|
|
276
|
+
|
|
282
277
|
self._feature_flags = feature_flags
|
|
283
278
|
return self
|
|
284
279
|
|
|
280
|
+
def filters(self, filters: Sequence[Filter]) -> "RapidataOrderBuilder":
|
|
281
|
+
"""
|
|
282
|
+
Set the filters for the order, e.g., country, language, userscore, etc.
|
|
283
|
+
|
|
284
|
+
Args:
|
|
285
|
+
filters (Sequence[Filters]): The user filters to be set.
|
|
286
|
+
|
|
287
|
+
Returns:
|
|
288
|
+
RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
|
|
289
|
+
"""
|
|
290
|
+
if not isinstance(filters, list):
|
|
291
|
+
raise TypeError("Filters must be provided as a list of Filter objects.")
|
|
292
|
+
|
|
293
|
+
for f in filters:
|
|
294
|
+
if not isinstance(f, Filter):
|
|
295
|
+
raise TypeError("Filters must be of type Filter.")
|
|
296
|
+
|
|
297
|
+
if len(self._user_filters) > 0:
|
|
298
|
+
print("Overwriting existing user filters.")
|
|
299
|
+
|
|
300
|
+
self._user_filters = filters
|
|
301
|
+
return self
|
|
302
|
+
|
|
285
303
|
def country_filter(self, country_codes: list[str]) -> "RapidataOrderBuilder":
|
|
286
304
|
"""
|
|
287
305
|
Set the target country codes for the order. E.g. `country_codes=["DE", "CH", "AT"]` for Germany, Switzerland, and Austria.
|
|
@@ -292,14 +310,18 @@ class RapidataOrderBuilder:
|
|
|
292
310
|
Returns:
|
|
293
311
|
RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
|
|
294
312
|
"""
|
|
313
|
+
warn(
|
|
314
|
+
"The country_filter method is deprecated. Use the filters method instead.",
|
|
315
|
+
DeprecationWarning,
|
|
316
|
+
)
|
|
295
317
|
if not isinstance(country_codes, list):
|
|
296
318
|
raise TypeError("Country codes must be provided as a list of strings.")
|
|
297
|
-
|
|
319
|
+
|
|
298
320
|
for code in country_codes:
|
|
299
321
|
if not isinstance(code, str):
|
|
300
322
|
raise TypeError("Country codes must be of type str.")
|
|
301
|
-
|
|
302
|
-
self.
|
|
323
|
+
|
|
324
|
+
self._user_filters.append(CountryFilter(country_codes))
|
|
303
325
|
return self
|
|
304
326
|
|
|
305
327
|
def language_filter(self, language_codes: list[str]) -> "RapidataOrderBuilder":
|
|
@@ -312,13 +334,17 @@ class RapidataOrderBuilder:
|
|
|
312
334
|
Returns:
|
|
313
335
|
RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
|
|
314
336
|
"""
|
|
337
|
+
warn(
|
|
338
|
+
"The language_filter method is deprecated. Use the filters method instead.",
|
|
339
|
+
DeprecationWarning,
|
|
340
|
+
)
|
|
315
341
|
if not isinstance(language_codes, list):
|
|
316
342
|
raise TypeError("Language codes must be provided as a list of strings.")
|
|
317
|
-
|
|
343
|
+
|
|
318
344
|
if not all(isinstance(code, str) for code in language_codes):
|
|
319
345
|
raise TypeError("Language codes must be of type str.")
|
|
320
|
-
|
|
321
|
-
self.
|
|
346
|
+
|
|
347
|
+
self._user_filters.append(LanguageFilter(language_codes))
|
|
322
348
|
return self
|
|
323
349
|
|
|
324
350
|
def aggregator(self, aggregator: AggregatorType) -> "RapidataOrderBuilder":
|
|
@@ -333,7 +359,7 @@ class RapidataOrderBuilder:
|
|
|
333
359
|
"""
|
|
334
360
|
if not isinstance(aggregator, AggregatorType):
|
|
335
361
|
raise TypeError("Aggregator must be of type AggregatorType.")
|
|
336
|
-
|
|
362
|
+
|
|
337
363
|
self._aggregator = aggregator
|
|
338
364
|
return self
|
|
339
365
|
|
|
@@ -349,7 +375,7 @@ class RapidataOrderBuilder:
|
|
|
349
375
|
"""
|
|
350
376
|
if not isinstance(validation_set_id, str):
|
|
351
377
|
raise TypeError("Validation set ID must be of type str.")
|
|
352
|
-
|
|
378
|
+
|
|
353
379
|
self._validation_set_id = validation_set_id
|
|
354
380
|
return self
|
|
355
381
|
|
|
@@ -379,13 +405,15 @@ class RapidataOrderBuilder:
|
|
|
379
405
|
RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
|
|
380
406
|
"""
|
|
381
407
|
if not isinstance(selections, list):
|
|
382
|
-
raise TypeError(
|
|
383
|
-
|
|
408
|
+
raise TypeError(
|
|
409
|
+
"Selections must be provided as a list of Selection objects."
|
|
410
|
+
)
|
|
411
|
+
|
|
384
412
|
for selection in selections:
|
|
385
413
|
if not isinstance(selection, Selection):
|
|
386
414
|
raise TypeError("Selections must be of type Selection.")
|
|
387
|
-
|
|
388
|
-
self._selections = selections
|
|
415
|
+
|
|
416
|
+
self._selections = selections # type: ignore
|
|
389
417
|
return self
|
|
390
418
|
|
|
391
419
|
def priority(self, priority: int) -> "RapidataOrderBuilder":
|
|
@@ -400,6 +428,6 @@ class RapidataOrderBuilder:
|
|
|
400
428
|
"""
|
|
401
429
|
if not isinstance(priority, int):
|
|
402
430
|
raise TypeError("Priority must be of type int.")
|
|
403
|
-
|
|
431
|
+
|
|
404
432
|
self._priority = priority
|
|
405
433
|
return self
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
rapidata/__init__.py,sha256=
|
|
1
|
+
rapidata/__init__.py,sha256=vjmq4p45annpd9K5QbD_0RdcLIkDnNFkNb55ZVws56A,587
|
|
2
2
|
rapidata/api_client/__init__.py,sha256=Gkazug47JGG3dMjts-m-1FUwRDhFtUId-LJvxzgYLUo,23847
|
|
3
3
|
rapidata/api_client/api/__init__.py,sha256=S0oVoAVMys10M-Z1SqirMdnHMYSHH3Lz6iph1CfILc0,1004
|
|
4
4
|
rapidata/api_client/api/campaign_api.py,sha256=DxPFqt9F6c9OpXu_Uxhsrib2NVwnbcZFa3Vkrj7cIuA,40474
|
|
@@ -27,7 +27,7 @@ rapidata/api_client/models/add_validation_rapid_model.py,sha256=-HRHMK-o6dgGjUqf
|
|
|
27
27
|
rapidata/api_client/models/add_validation_rapid_model_payload.py,sha256=Ul_xSBMI4jlnbIKPZfyuYJ5x-f-mQik8hYD1ArVKCLw,11092
|
|
28
28
|
rapidata/api_client/models/add_validation_rapid_model_truth.py,sha256=TlaA5RbE2gJquDDm-d7c_fQxvWjYQtiJljZEWgZMWo8,11044
|
|
29
29
|
rapidata/api_client/models/add_validation_rapid_result.py,sha256=rNk2_4CERFNpCq4XExFEb6-9QVwGEJ62nTmpX4_kjXk,2563
|
|
30
|
-
rapidata/api_client/models/add_validation_text_rapid_model.py,sha256=
|
|
30
|
+
rapidata/api_client/models/add_validation_text_rapid_model.py,sha256=3s16qCGogFxPKxLwPf5pIDrqCNkffbOrtfiRUgvhr9U,5005
|
|
31
31
|
rapidata/api_client/models/admin_order_model.py,sha256=-QBgxsw7MTOYEjwOnKSndJTCWpdx5Os--dY4e6JSW9E,3730
|
|
32
32
|
rapidata/api_client/models/admin_order_model_paged_result.py,sha256=edgeuvJ8yDMjKDB8vYa2YdbO7brdcgj6AMXPQTLeRbc,3494
|
|
33
33
|
rapidata/api_client/models/age_group.py,sha256=k4gm2IPuwxXbU9wTvlat0yMwyz3HJ7tVG3Vqhda-e0g,846
|
|
@@ -304,7 +304,7 @@ rapidata/api_client/models/workflow_split_model_filter_configs_inner.py,sha256=1
|
|
|
304
304
|
rapidata/api_client/models/workflow_state.py,sha256=5LAK1se76RCoozeVB6oxMPb8p_5bhLZJqn7q5fFQWis,850
|
|
305
305
|
rapidata/api_client/rest.py,sha256=zmCIFQC2l1t-KZcq-TgEm3vco3y_LK6vRm3Q07K-xRI,9423
|
|
306
306
|
rapidata/api_client_README.md,sha256=1RYEnSbkgwk2PaTgWDqkpId3LhEysIuXbfIuxrBaZHo,37287
|
|
307
|
-
rapidata/rapidata_client/__init__.py,sha256=
|
|
307
|
+
rapidata/rapidata_client/__init__.py,sha256=mX25RNyeNqboIzCMz_Lm3SnMTXM8LJ_jpXuIRraafww,803
|
|
308
308
|
rapidata/rapidata_client/assets/__init__.py,sha256=T-XKvMSkmyI8iYLUYDdZ3LrrSInHsGMUY_Tz77hhnlE,240
|
|
309
309
|
rapidata/rapidata_client/assets/base_asset.py,sha256=B2YWH1NgaeYUYHDW3OPpHM_bqawHbH4EjnRCE2BYwiM,298
|
|
310
310
|
rapidata/rapidata_client/assets/media_asset.py,sha256=4xU1k2abdHGwbkJAYNOZYyOPB__5VBRDvRjklegFufQ,887
|
|
@@ -315,11 +315,19 @@ rapidata/rapidata_client/country_codes/__init__.py,sha256=FB9Dcks44J6C6YBSYmTmNZ
|
|
|
315
315
|
rapidata/rapidata_client/country_codes/country_codes.py,sha256=Q0HMX7uHJQDeLCFPP5bq4iYi6pgcDWEcl2ONGhjgoeU,286
|
|
316
316
|
rapidata/rapidata_client/dataset/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
317
317
|
rapidata/rapidata_client/dataset/rapidata_dataset.py,sha256=mIQBh7pANhFe2u3xEgsdDG_ZY7i-o8lKDAaRfACipMU,4921
|
|
318
|
-
rapidata/rapidata_client/dataset/rapidata_validation_set.py,sha256=
|
|
318
|
+
rapidata/rapidata_client/dataset/rapidata_validation_set.py,sha256=rSRZQ67-8XjLa1_pWutieBrQfmvPA0fOMK7QKQpxsX0,10970
|
|
319
319
|
rapidata/rapidata_client/dataset/validation_rapid_parts.py,sha256=uzpOZFqQu8bG6vmjcWWUNJPZsRe28OmnyalRE6ry8tk,2317
|
|
320
|
-
rapidata/rapidata_client/dataset/validation_set_builder.py,sha256=
|
|
320
|
+
rapidata/rapidata_client/dataset/validation_set_builder.py,sha256=xPZBzNRPausIbYNRVinIhsVGnKSIIuxP5tjKkV4hOyo,7990
|
|
321
321
|
rapidata/rapidata_client/feature_flags/__init__.py,sha256=IYkcK_bZCl5RfyQFiWjjUdz4y0jipiW9qfeopq4EjQQ,40
|
|
322
322
|
rapidata/rapidata_client/feature_flags/feature_flags.py,sha256=hcS9YRzpsPWpZfw-3QwSuf2TaVg-MOHBxY788oNqIW4,3957
|
|
323
|
+
rapidata/rapidata_client/filter/__init__.py,sha256=F3JsMCbAZWH7SNdgaj98ydTqgCCKXKBhLyt9gQ4x6tQ,301
|
|
324
|
+
rapidata/rapidata_client/filter/age_filter.py,sha256=hncr1zNM_HrO0fCta8h0LgTCB8Ufv_vI5_cGhMb-xr8,478
|
|
325
|
+
rapidata/rapidata_client/filter/base_filter.py,sha256=nXraj72cumyQjjYoo4MMpnlE0aWjAIOmGakKf0MNqps,135
|
|
326
|
+
rapidata/rapidata_client/filter/campaign_filter.py,sha256=DHWf2LIb7IFbgPm2XyFspwHwrz9a079FjiUOo4z3gtw,459
|
|
327
|
+
rapidata/rapidata_client/filter/country_filter.py,sha256=rPfTAZdsvuRyitygJz3UWAFEmsE6U9aUnSHUySFV6cA,612
|
|
328
|
+
rapidata/rapidata_client/filter/gender_filter.py,sha256=AG4JK8eIycp0iM9h21B_cmFBfgE6v9sU-rIFDCHFUeY,472
|
|
329
|
+
rapidata/rapidata_client/filter/language_filter.py,sha256=JRHw-BpA5ZqpGR-fjyVB6bJ56Ifi6PcM3yztvLFmrQY,623
|
|
330
|
+
rapidata/rapidata_client/filter/user_score_filter.py,sha256=YtZH0eFvo4SS96-R2PqT6at_qHFDlaztwOFOdpeZe5w,560
|
|
323
331
|
rapidata/rapidata_client/metadata/__init__.py,sha256=qMmo4wqScUCAJ6YXRWxvJLmbFA5YRbK39p9_exV1d50,246
|
|
324
332
|
rapidata/rapidata_client/metadata/base_metadata.py,sha256=BJoZT4lRs94lu7PE3__LcsMINHNDVKRKRART-EKzSaw,217
|
|
325
333
|
rapidata/rapidata_client/metadata/private_text_metadata.py,sha256=VJ_SJwp8OMFZLuUMRWvPeKOySXYJuGr-YgpwuLfTbmo,517
|
|
@@ -328,7 +336,7 @@ rapidata/rapidata_client/metadata/public_text_metadata.py,sha256=LTiBQHs6izxQ6-C
|
|
|
328
336
|
rapidata/rapidata_client/metadata/transcription_metadata.py,sha256=THtDEVCON4UlcXHmXrjilaOLHys4TrktUOPGWnXaCcc,631
|
|
329
337
|
rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
330
338
|
rapidata/rapidata_client/order/rapidata_order.py,sha256=Q2orpb1NV7XiEAOJD0md93uLpYI1RFfr7mqDJDLk4m4,4643
|
|
331
|
-
rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=
|
|
339
|
+
rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=YBTQ7iXsMF2ALjDRE_NRApKJJYvsJ1fGniJGrDJEN_g,15868
|
|
332
340
|
rapidata/rapidata_client/rapidata_client.py,sha256=s3TlhYlvMuxcyEDIFDqpwRsP0SIi9b158uIHLUyV1gY,4699
|
|
333
341
|
rapidata/rapidata_client/referee/__init__.py,sha256=Ow9MQsONhF4sX2wFK9jbvSBrpcJgtq3OglIQMkBUdIY,167
|
|
334
342
|
rapidata/rapidata_client/referee/base_referee.py,sha256=bMy7cw0a-pGNbFu6u_1_Jplu0A483Ubj4oDQzh8vu8k,493
|
|
@@ -357,7 +365,7 @@ rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5
|
|
|
357
365
|
rapidata/service/openapi_service.py,sha256=KwFJmgnyfrzmSjs6wGh5J6ESMLvtKazGcYoewWeL8PU,2038
|
|
358
366
|
rapidata/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
359
367
|
rapidata/utils/image_utils.py,sha256=TldO3eJWG8IhfJjm5MfNGO0mEDm1mQTsRoA0HLU1Uxs,404
|
|
360
|
-
rapidata-1.2.
|
|
361
|
-
rapidata-1.2.
|
|
362
|
-
rapidata-1.2.
|
|
363
|
-
rapidata-1.2.
|
|
368
|
+
rapidata-1.2.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
369
|
+
rapidata-1.2.2.dist-info/METADATA,sha256=KyBHzy-EMvOva9QYLwKuBk6OLE-Z8JSGNMSeMyXDNLc,1012
|
|
370
|
+
rapidata-1.2.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
|
|
371
|
+
rapidata-1.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|