rapidata 2.15.0__py3-none-any.whl → 2.17.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -0
- rapidata/api_client/__init__.py +17 -7
- rapidata/api_client/api/__init__.py +2 -1
- rapidata/api_client/api/campaign_api.py +554 -30
- rapidata/api_client/api/client_api.py +295 -23
- rapidata/api_client/api/coco_api.py +594 -8
- rapidata/api_client/api/compare_workflow_api.py +23 -23
- rapidata/api_client/api/datapoint_api.py +548 -26
- rapidata/api_client/api/dataset_api.py +2198 -186
- rapidata/api_client/api/feedback_api.py +306 -0
- rapidata/api_client/api/identity_api.py +1143 -78
- rapidata/api_client/api/newsletter_api.py +299 -11
- rapidata/api_client/api/order_api.py +5367 -565
- rapidata/api_client/api/pipeline_api.py +249 -510
- rapidata/api_client/api/rapid_api.py +1930 -254
- rapidata/api_client/api/simple_workflow_api.py +23 -23
- rapidata/api_client/api/validation_set_api.py +5259 -0
- rapidata/api_client/api/workflow_api.py +932 -137
- rapidata/api_client/models/__init__.py +15 -6
- rapidata/api_client/models/ab_test_selection_a_inner.py +24 -10
- rapidata/api_client/models/add_campaign_model.py +1 -1
- rapidata/api_client/models/add_user_response_result.py +106 -0
- rapidata/api_client/models/add_user_response_result_validation_truth.py +258 -0
- rapidata/api_client/models/add_validation_rapid_model.py +3 -3
- rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
- rapidata/api_client/models/are_rapids_active_result.py +87 -0
- rapidata/api_client/models/compare_workflow_config_model.py +1 -1
- rapidata/api_client/models/compare_workflow_model.py +4 -4
- rapidata/api_client/models/create_datapoint_from_files_model.py +102 -0
- rapidata/api_client/models/create_datapoint_from_files_model_metadata_inner.py +168 -0
- rapidata/api_client/models/create_datapoint_from_text_sources_model.py +109 -0
- rapidata/api_client/models/create_datapoint_from_urls_model.py +5 -5
- rapidata/api_client/models/create_datapoints_from_s3_bucket_model.py +124 -0
- rapidata/api_client/models/create_order_model.py +1 -1
- rapidata/api_client/models/create_rapid_result.py +87 -0
- rapidata/api_client/models/create_validation_set_model.py +87 -0
- rapidata/api_client/models/datapoint_metadata_model.py +3 -3
- rapidata/api_client/models/early_stopping_referee_model.py +1 -1
- rapidata/api_client/models/elo_config_model.py +2 -2
- rapidata/api_client/models/evaluation_workflow_model.py +2 -2
- rapidata/api_client/models/get_validation_rapids_query.py +123 -0
- rapidata/api_client/models/get_validation_rapids_query_paged_result.py +105 -0
- rapidata/api_client/models/online_pair_maker_config_model.py +1 -1
- rapidata/api_client/models/pipeline_id_workflow_artifact_id_put_request.py +140 -0
- rapidata/api_client/models/query_validation_rapids_result.py +3 -3
- rapidata/api_client/models/rapid_issue.py +4 -0
- rapidata/api_client/models/report_model.py +4 -4
- rapidata/api_client/models/shuffling_selection.py +106 -0
- rapidata/api_client/models/simple_workflow_config_model.py +1 -1
- rapidata/api_client/models/simple_workflow_config_model_blueprint.py +1 -1
- rapidata/api_client/models/simple_workflow_model.py +1 -1
- rapidata/api_client/models/simple_workflow_model_blueprint.py +1 -1
- rapidata/api_client/models/update_campaign_model.py +1 -1
- rapidata/api_client/models/update_dataset_name_model.py +87 -0
- rapidata/api_client/models/update_order_name_model.py +87 -0
- rapidata/api_client/models/upload_text_sources_to_dataset_model.py +3 -3
- rapidata/api_client/models/user_score_user_filter_model.py +9 -2
- rapidata/api_client_README.md +153 -88
- rapidata/rapidata_client/__init__.py +1 -0
- rapidata/rapidata_client/demographic/demographic_manager.py +1 -1
- rapidata/rapidata_client/filter/user_score_filter.py +4 -1
- rapidata/rapidata_client/order/_rapidata_dataset.py +10 -11
- rapidata/rapidata_client/order/_rapidata_order_builder.py +1 -1
- rapidata/rapidata_client/order/rapidata_order.py +5 -5
- rapidata/rapidata_client/order/rapidata_order_manager.py +1 -1
- rapidata/rapidata_client/order/rapidata_results.py +1 -1
- rapidata/rapidata_client/selection/__init__.py +1 -0
- rapidata/rapidata_client/selection/rapidata_selections.py +4 -1
- rapidata/rapidata_client/selection/shuffling_selection.py +36 -0
- rapidata/rapidata_client/validation/rapidata_validation_set.py +11 -0
- rapidata/rapidata_client/validation/rapids/rapids.py +3 -5
- rapidata/rapidata_client/validation/validation_set_manager.py +36 -21
- rapidata/rapidata_client/workflow/_ranking_workflow.py +2 -2
- {rapidata-2.15.0.dist-info → rapidata-2.17.0.dist-info}/METADATA +1 -1
- {rapidata-2.15.0.dist-info → rapidata-2.17.0.dist-info}/RECORD +77 -59
- {rapidata-2.15.0.dist-info → rapidata-2.17.0.dist-info}/LICENSE +0 -0
- {rapidata-2.15.0.dist-info → rapidata-2.17.0.dist-info}/WHEEL +0 -0
|
@@ -534,7 +534,7 @@ class RapidataOrderManager:
|
|
|
534
534
|
"""
|
|
535
535
|
|
|
536
536
|
try:
|
|
537
|
-
order = self._openapi_service.order_api.
|
|
537
|
+
order = self._openapi_service.order_api.order_order_id_get(order_id)
|
|
538
538
|
except Exception:
|
|
539
539
|
raise ValueError(f"Order with ID {order_id} not found.")
|
|
540
540
|
|
|
@@ -40,7 +40,7 @@ class RapidataResults(dict):
|
|
|
40
40
|
raise ValueError("No detailed results found in the data")
|
|
41
41
|
return self._to_pandas_with_detailed_results()
|
|
42
42
|
|
|
43
|
-
if self["info"].get("orderType") == "Compare":
|
|
43
|
+
if self["info"].get("orderType") == "Compare" or self["info"].get("orderType") == "Ranking":
|
|
44
44
|
return self._compare_to_pandas()
|
|
45
45
|
|
|
46
46
|
# Get the structure from first item
|
|
@@ -4,3 +4,4 @@ from .labeling_selection import LabelingSelection
|
|
|
4
4
|
from .validation_selection import ValidationSelection
|
|
5
5
|
from .conditional_validation_selection import ConditionalValidationSelection
|
|
6
6
|
from .capped_selection import CappedSelection
|
|
7
|
+
from .shuffling_selection import ShufflingSelection
|
|
@@ -3,7 +3,8 @@ from rapidata.rapidata_client.selection import (
|
|
|
3
3
|
LabelingSelection,
|
|
4
4
|
ValidationSelection,
|
|
5
5
|
ConditionalValidationSelection,
|
|
6
|
-
CappedSelection
|
|
6
|
+
CappedSelection,
|
|
7
|
+
ShufflingSelection)
|
|
7
8
|
|
|
8
9
|
class RapidataSelections:
|
|
9
10
|
"""RapidataSelections Classes
|
|
@@ -17,6 +18,7 @@ class RapidataSelections:
|
|
|
17
18
|
conditional_validation (ConditionalValidationSelection): The ConditionalValidationSelection instance.
|
|
18
19
|
demographic (DemographicSelection): The DemographicSelection instance.
|
|
19
20
|
capped (CappedSelection): The CappedSelection instance.
|
|
21
|
+
shuffling (ShufflingSelection): The ShufflingSelection instance.
|
|
20
22
|
|
|
21
23
|
Example:
|
|
22
24
|
```python
|
|
@@ -32,3 +34,4 @@ class RapidataSelections:
|
|
|
32
34
|
conditional_validation = ConditionalValidationSelection
|
|
33
35
|
demographic = DemographicSelection
|
|
34
36
|
capped = CappedSelection
|
|
37
|
+
shuffling = ShufflingSelection
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
|
|
3
|
+
from rapidata.api_client.models.shuffling_selection import ShufflingSelection as ShufflingSelectionModel
|
|
4
|
+
from rapidata.rapidata_client.selection._base_selection import RapidataSelection
|
|
5
|
+
|
|
6
|
+
from typing import Sequence
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class ShufflingSelection(RapidataSelection):
|
|
10
|
+
"""ShufflingSelection Class
|
|
11
|
+
|
|
12
|
+
Shuffles the selections provided in the list.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
selections (Sequence[RapidataSelection]): List of selections to shuffle.
|
|
16
|
+
|
|
17
|
+
Example:
|
|
18
|
+
```python
|
|
19
|
+
selection = ShufflingSelection(
|
|
20
|
+
[ValidSelections("validation_id", 1), LabelingSelection(2)])
|
|
21
|
+
```
|
|
22
|
+
This means that the users will get 1 validation task and 2 labeling tasks in a shuffled order.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
def __init__(self, selections: Sequence[RapidataSelection]):
|
|
26
|
+
self.selections = selections
|
|
27
|
+
|
|
28
|
+
def _to_model(self) -> ShufflingSelectionModel:
|
|
29
|
+
return ShufflingSelectionModel(
|
|
30
|
+
_t="ShufflingSelection",
|
|
31
|
+
selections=[
|
|
32
|
+
AbTestSelectionAInner(selection._to_model())
|
|
33
|
+
for selection in self.selections
|
|
34
|
+
]
|
|
35
|
+
)
|
|
36
|
+
|
|
@@ -2,6 +2,7 @@ from rapidata.rapidata_client.validation.rapids.rapids import Rapid
|
|
|
2
2
|
from rapidata.service.openapi_service import OpenAPIService
|
|
3
3
|
from requests.adapters import HTTPAdapter, Retry
|
|
4
4
|
import requests
|
|
5
|
+
from rapidata.api_client.models.update_dimensions_model import UpdateDimensionsModel
|
|
5
6
|
|
|
6
7
|
class RapidataValidationSet:
|
|
7
8
|
"""A class for interacting with a Rapidata validation set.
|
|
@@ -28,6 +29,16 @@ class RapidataValidationSet:
|
|
|
28
29
|
rapid (Rapid): The Rapid to add to the validation set.
|
|
29
30
|
"""
|
|
30
31
|
rapid._add_to_validation_set(self.id, self.__openapi_service, self.__session)
|
|
32
|
+
return self
|
|
33
|
+
|
|
34
|
+
def update_dimensions(self, dimensions: list[str] | None):
|
|
35
|
+
"""Update the dimensions of the validation set.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
dimensions (list[str]): The new dimensions of the validation set.
|
|
39
|
+
"""
|
|
40
|
+
self.__openapi_service.validation_api.validation_validation_set_id_dimensions_patch(self.id, UpdateDimensionsModel(dimensions=dimensions) if dimensions else None)
|
|
41
|
+
return self
|
|
31
42
|
|
|
32
43
|
def _get_session(self, max_retries: int = 5, max_workers: int = 10) -> requests.Session:
|
|
33
44
|
"""Get a requests session with retry logic.
|
|
@@ -15,10 +15,8 @@ from rapidata.api_client.models.add_validation_rapid_model_payload import (
|
|
|
15
15
|
from rapidata.api_client.models.add_validation_rapid_model_truth import (
|
|
16
16
|
AddValidationRapidModelTruth,
|
|
17
17
|
)
|
|
18
|
+
from rapidata.api_client.models.create_datapoint_from_files_model_metadata_inner import CreateDatapointFromFilesModelMetadataInner
|
|
18
19
|
|
|
19
|
-
from rapidata.api_client.models.create_datapoint_from_urls_model import (
|
|
20
|
-
CreateDatapointFromUrlsModelMetadataInner,
|
|
21
|
-
)
|
|
22
20
|
from rapidata.service.openapi_service import OpenAPIService
|
|
23
21
|
|
|
24
22
|
import requests
|
|
@@ -70,7 +68,7 @@ class Rapid():
|
|
|
70
68
|
payload=AddValidationRapidModelPayload(self.payload),
|
|
71
69
|
truth=AddValidationRapidModelTruth(self.truth),
|
|
72
70
|
metadata=[
|
|
73
|
-
|
|
71
|
+
CreateDatapointFromFilesModelMetadataInner(meta.to_model())
|
|
74
72
|
for meta in self.metadata
|
|
75
73
|
],
|
|
76
74
|
randomCorrectProbability=self.randomCorrectProbability,
|
|
@@ -97,7 +95,7 @@ class Rapid():
|
|
|
97
95
|
payload=AddValidationRapidModelPayload(self.payload),
|
|
98
96
|
truth=AddValidationRapidModelTruth(self.truth),
|
|
99
97
|
metadata=[
|
|
100
|
-
|
|
98
|
+
CreateDatapointFromFilesModelMetadataInner(meta.to_model())
|
|
101
99
|
for meta in self.metadata
|
|
102
100
|
],
|
|
103
101
|
randomCorrectProbability=self.randomCorrectProbability,
|
|
@@ -38,8 +38,9 @@ class ValidationSetManager:
|
|
|
38
38
|
truths: list[list[str]],
|
|
39
39
|
data_type: str = RapidataDataTypes.MEDIA,
|
|
40
40
|
contexts: list[str] | None = None,
|
|
41
|
-
print_confirmation: bool = True,
|
|
42
41
|
explanations: list[str | None] | None = None,
|
|
42
|
+
dimensions: list[str] | None = None,
|
|
43
|
+
print_confirmation: bool = True,
|
|
43
44
|
) -> RapidataValidationSet:
|
|
44
45
|
"""Create a classification validation set.
|
|
45
46
|
|
|
@@ -57,8 +58,9 @@ class ValidationSetManager:
|
|
|
57
58
|
contexts (list[str], optional): The contexts for each datapoint. Defaults to None.\n
|
|
58
59
|
If provided has to be the same length as datapoints and will be shown in addition to the instruction and answer options. (Therefore will be different for each datapoint)
|
|
59
60
|
Will be match up with the datapoints using the list index.
|
|
60
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
61
61
|
explanations (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
62
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
63
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
62
64
|
|
|
63
65
|
Example:
|
|
64
66
|
```python
|
|
@@ -95,7 +97,7 @@ class ValidationSetManager:
|
|
|
95
97
|
)
|
|
96
98
|
)
|
|
97
99
|
|
|
98
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
100
|
+
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation, dimensions=dimensions)
|
|
99
101
|
|
|
100
102
|
def create_compare_set(self,
|
|
101
103
|
name: str,
|
|
@@ -104,8 +106,9 @@ class ValidationSetManager:
|
|
|
104
106
|
truths: list[str],
|
|
105
107
|
data_type: str = RapidataDataTypes.MEDIA,
|
|
106
108
|
contexts: list[str] | None = None,
|
|
107
|
-
print_confirmation: bool = True,
|
|
108
109
|
explanation: list[str | None] | None = None,
|
|
110
|
+
dimensions: list[str] | None = None,
|
|
111
|
+
print_confirmation: bool = True,
|
|
109
112
|
) -> RapidataValidationSet:
|
|
110
113
|
"""Create a comparison validation set.
|
|
111
114
|
|
|
@@ -123,8 +126,9 @@ class ValidationSetManager:
|
|
|
123
126
|
contexts (list[str], optional): The contexts for each datapoint. Defaults to None.\n
|
|
124
127
|
If provided has to be the same length as datapoints and will be shown in addition to the instruction and truth. (Therefore will be different for each datapoint)
|
|
125
128
|
Will be match up with the datapoints using the list index.
|
|
126
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
127
129
|
explanation (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
130
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
131
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
128
132
|
|
|
129
133
|
Example:
|
|
130
134
|
```python
|
|
@@ -160,7 +164,7 @@ class ValidationSetManager:
|
|
|
160
164
|
)
|
|
161
165
|
)
|
|
162
166
|
|
|
163
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
167
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
164
168
|
|
|
165
169
|
def create_select_words_set(self,
|
|
166
170
|
name: str,
|
|
@@ -170,8 +174,9 @@ class ValidationSetManager:
|
|
|
170
174
|
sentences: list[str],
|
|
171
175
|
required_precision: float = 1.0,
|
|
172
176
|
required_completeness: float = 1.0,
|
|
173
|
-
print_confirmation: bool = True,
|
|
174
177
|
explanation: list[str | None] | None = None,
|
|
178
|
+
dimensions: list[str] | None = None,
|
|
179
|
+
print_confirmation: bool = True,
|
|
175
180
|
) -> RapidataValidationSet:
|
|
176
181
|
"""Create a select words validation set.
|
|
177
182
|
|
|
@@ -188,8 +193,9 @@ class ValidationSetManager:
|
|
|
188
193
|
Must be the same length as datapoints.
|
|
189
194
|
required_precision (float, optional): The required precision for the labeler to get the rapid correct (minimum ratio of the words selected that need to be correct). Defaults to 1.0 (no wrong word can be selected).
|
|
190
195
|
required_completeness (float, optional): The required completeness for the labeler to get the rapid correct (miminum ratio of total correct words selected). Defaults to 1.0 (all correct words need to be selected).
|
|
191
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
192
196
|
explanation (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
197
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
198
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
193
199
|
|
|
194
200
|
Example:
|
|
195
201
|
```python
|
|
@@ -223,7 +229,7 @@ class ValidationSetManager:
|
|
|
223
229
|
)
|
|
224
230
|
)
|
|
225
231
|
|
|
226
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
232
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
227
233
|
|
|
228
234
|
def create_locate_set(self,
|
|
229
235
|
name: str,
|
|
@@ -231,8 +237,9 @@ class ValidationSetManager:
|
|
|
231
237
|
truths: list[list[Box]],
|
|
232
238
|
datapoints: list[str],
|
|
233
239
|
contexts: list[str] | None = None,
|
|
234
|
-
print_confirmation: bool = True,
|
|
235
240
|
explanation: list[str | None] | None = None,
|
|
241
|
+
dimensions: list[str] | None = None,
|
|
242
|
+
print_confirmation: bool = True,
|
|
236
243
|
) -> RapidataValidationSet:
|
|
237
244
|
"""Create a locate validation set.
|
|
238
245
|
|
|
@@ -245,8 +252,9 @@ class ValidationSetManager:
|
|
|
245
252
|
truths: [[Box(0, 0, 100, 100)], [Box(50, 50, 150, 150)]] -> first datapoint the object is in the top left corner, second datapoint the object is in the center
|
|
246
253
|
datapoints (list[str]): The datapoints that will be used for validation.
|
|
247
254
|
contexts (list[str], optional): The contexts for each datapoint. Defaults to None.
|
|
248
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
249
255
|
explanation (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
256
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
257
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
250
258
|
|
|
251
259
|
Example:
|
|
252
260
|
```python
|
|
@@ -282,7 +290,7 @@ class ValidationSetManager:
|
|
|
282
290
|
)
|
|
283
291
|
)
|
|
284
292
|
|
|
285
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
293
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
286
294
|
|
|
287
295
|
def create_draw_set(self,
|
|
288
296
|
name: str,
|
|
@@ -290,8 +298,9 @@ class ValidationSetManager:
|
|
|
290
298
|
truths: list[list[Box]],
|
|
291
299
|
datapoints: list[str],
|
|
292
300
|
contexts: list[str] | None = None,
|
|
293
|
-
print_confirmation: bool = True,
|
|
294
301
|
explanation: list[str | None] | None = None,
|
|
302
|
+
dimensions: list[str] | None = None,
|
|
303
|
+
print_confirmation: bool = True,
|
|
295
304
|
) -> RapidataValidationSet:
|
|
296
305
|
"""Create a draw validation set.
|
|
297
306
|
|
|
@@ -304,8 +313,9 @@ class ValidationSetManager:
|
|
|
304
313
|
truths: [[Box(0, 0, 100, 100)], [Box(50, 50, 150, 150)]] -> first datapoint the object is in the top left corner, second datapoint the object is in the center
|
|
305
314
|
datapoints (list[str]): The datapoints that will be used for validation.
|
|
306
315
|
contexts (list[str], optional): The contexts for each datapoint. Defaults to None.
|
|
307
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
308
316
|
explanation (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
317
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
318
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
309
319
|
|
|
310
320
|
Example:
|
|
311
321
|
```python
|
|
@@ -340,7 +350,7 @@ class ValidationSetManager:
|
|
|
340
350
|
)
|
|
341
351
|
)
|
|
342
352
|
|
|
343
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
353
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
344
354
|
|
|
345
355
|
def create_timestamp_set(self,
|
|
346
356
|
name: str,
|
|
@@ -348,8 +358,9 @@ class ValidationSetManager:
|
|
|
348
358
|
truths: list[list[tuple[int, int]]],
|
|
349
359
|
datapoints: list[str],
|
|
350
360
|
contexts: list[str] | None = None,
|
|
351
|
-
print_confirmation: bool = True,
|
|
352
361
|
explanation: list[str | None] | None = None,
|
|
362
|
+
dimensions: list[str] | None = None,
|
|
363
|
+
print_confirmation: bool = True,
|
|
353
364
|
) -> RapidataValidationSet:
|
|
354
365
|
"""Create a timestamp validation set.
|
|
355
366
|
|
|
@@ -363,8 +374,9 @@ class ValidationSetManager:
|
|
|
363
374
|
truths: [[(0, 10)], [(20, 30)]] -> first datapoint the correct interval is from 0 to 10, second datapoint the correct interval is from 20 to 30
|
|
364
375
|
datapoints (list[str]): The datapoints that will be used for validation.
|
|
365
376
|
contexts (list[str], optional): The contexts for each datapoint. Defaults to None.
|
|
366
|
-
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
367
377
|
explanation (list[str | None], optional): The explanations for each datapoint. Will be given to the annotators in case the answer is wrong. Defaults to None.
|
|
378
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
379
|
+
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
368
380
|
|
|
369
381
|
Example:
|
|
370
382
|
```python
|
|
@@ -399,11 +411,12 @@ class ValidationSetManager:
|
|
|
399
411
|
)
|
|
400
412
|
)
|
|
401
413
|
|
|
402
|
-
return self._submit(name=name, rapids=rapids, print_confirmation=print_confirmation)
|
|
414
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
403
415
|
|
|
404
416
|
def create_mixed_set(self,
|
|
405
417
|
name: str,
|
|
406
418
|
rapids: list[Rapid],
|
|
419
|
+
dimensions: list[str] | None = None,
|
|
407
420
|
print_confirmation: bool = True
|
|
408
421
|
) -> RapidataValidationSet:
|
|
409
422
|
"""Create a validation set with a list of rapids.
|
|
@@ -411,10 +424,11 @@ class ValidationSetManager:
|
|
|
411
424
|
Args:
|
|
412
425
|
name (str): The name of the validation set. (will not be shown to the labeler)
|
|
413
426
|
rapids (list[Rapid]): The list of rapids to add to the validation set.
|
|
427
|
+
dimensions (list[str] | None, optional): The dimensions of the validation set. If not provided will be set to the default dimensions.
|
|
414
428
|
print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
|
|
415
429
|
"""
|
|
416
430
|
|
|
417
|
-
return self._submit(name, rapids, print_confirmation)
|
|
431
|
+
return self._submit(name=name, rapids=rapids, dimensions=dimensions, print_confirmation=print_confirmation)
|
|
418
432
|
|
|
419
433
|
def get_validation_set_by_id(self, validation_set_id: str) -> RapidataValidationSet:
|
|
420
434
|
"""Get a validation set by ID.
|
|
@@ -432,7 +446,7 @@ class ValidationSetManager:
|
|
|
432
446
|
|
|
433
447
|
return RapidataValidationSet(validation_set_id, validation_set.name, self.__openapi_service)
|
|
434
448
|
|
|
435
|
-
def _submit(self, name: str, rapids: list[Rapid], print_confirmation: bool) -> RapidataValidationSet:
|
|
449
|
+
def _submit(self, name: str, rapids: list[Rapid], dimensions: list[str] | None, print_confirmation: bool) -> RapidataValidationSet:
|
|
436
450
|
validation_set_id = (
|
|
437
451
|
self.__openapi_service.validation_api.validation_create_validation_set_post(
|
|
438
452
|
name=name
|
|
@@ -456,7 +470,8 @@ class ValidationSetManager:
|
|
|
456
470
|
print(f"Validation set '{name}' created with ID {validation_set_id}\n",
|
|
457
471
|
f"Now viewable under: https://app.{self.__openapi_service.enviroment}/validation-set/detail/{validation_set_id}",
|
|
458
472
|
sep="")
|
|
459
|
-
|
|
473
|
+
|
|
474
|
+
validation_set.update_dimensions(dimensions)
|
|
460
475
|
return validation_set
|
|
461
476
|
|
|
462
477
|
|
|
@@ -3,7 +3,7 @@ from rapidata.api_client.models.compare_workflow_model import CompareWorkflowMod
|
|
|
3
3
|
from rapidata.rapidata_client.workflow._base_workflow import Workflow
|
|
4
4
|
from rapidata.rapidata_client.metadata import PromptMetadata
|
|
5
5
|
from rapidata.api_client.models.create_datapoint_from_urls_model import (
|
|
6
|
-
|
|
6
|
+
CreateDatapointFromFilesModelMetadataInner,
|
|
7
7
|
)
|
|
8
8
|
|
|
9
9
|
|
|
@@ -21,7 +21,7 @@ class RankingWorkflow(Workflow):
|
|
|
21
21
|
):
|
|
22
22
|
super().__init__(type="CompareWorkflowConfig")
|
|
23
23
|
|
|
24
|
-
self.context = [
|
|
24
|
+
self.context = [CreateDatapointFromFilesModelMetadataInner(
|
|
25
25
|
PromptMetadata(context).to_model())
|
|
26
26
|
] if context else None
|
|
27
27
|
|