rapidata 2.14.1__py3-none-any.whl → 2.16.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.

Files changed (69) hide show
  1. rapidata/api_client/__init__.py +18 -7
  2. rapidata/api_client/api/__init__.py +2 -1
  3. rapidata/api_client/api/campaign_api.py +868 -92
  4. rapidata/api_client/api/client_api.py +292 -20
  5. rapidata/api_client/api/coco_api.py +594 -8
  6. rapidata/api_client/api/compare_workflow_api.py +23 -23
  7. rapidata/api_client/api/datapoint_api.py +548 -26
  8. rapidata/api_client/api/dataset_api.py +2198 -186
  9. rapidata/api_client/api/feedback_api.py +306 -0
  10. rapidata/api_client/api/identity_api.py +1143 -78
  11. rapidata/api_client/api/newsletter_api.py +299 -11
  12. rapidata/api_client/api/order_api.py +5570 -516
  13. rapidata/api_client/api/pipeline_api.py +263 -524
  14. rapidata/api_client/api/rapid_api.py +1930 -254
  15. rapidata/api_client/api/simple_workflow_api.py +23 -23
  16. rapidata/api_client/api/validation_api.py +283 -0
  17. rapidata/api_client/api/validation_set_api.py +5259 -0
  18. rapidata/api_client/api/workflow_api.py +929 -134
  19. rapidata/api_client/models/__init__.py +16 -6
  20. rapidata/api_client/models/ab_test_selection_a_inner.py +24 -10
  21. rapidata/api_client/models/add_campaign_model.py +9 -2
  22. rapidata/api_client/models/add_user_response_result.py +106 -0
  23. rapidata/api_client/models/add_user_response_result_validation_truth.py +258 -0
  24. rapidata/api_client/models/add_validation_rapid_model.py +3 -3
  25. rapidata/api_client/models/add_validation_text_rapid_model.py +3 -3
  26. rapidata/api_client/models/are_rapids_active_result.py +87 -0
  27. rapidata/api_client/models/campaign_query_result.py +2 -2
  28. rapidata/api_client/models/campaign_status.py +1 -0
  29. rapidata/api_client/models/compare_workflow_model.py +3 -3
  30. rapidata/api_client/models/create_datapoint_from_files_model.py +102 -0
  31. rapidata/api_client/models/create_datapoint_from_files_model_metadata_inner.py +168 -0
  32. rapidata/api_client/models/create_datapoint_from_text_sources_model.py +109 -0
  33. rapidata/api_client/models/create_datapoint_from_urls_model.py +4 -4
  34. rapidata/api_client/models/create_datapoints_from_s3_bucket_model.py +124 -0
  35. rapidata/api_client/models/create_order_model.py +15 -1
  36. rapidata/api_client/models/create_rapid_result.py +87 -0
  37. rapidata/api_client/models/create_validation_set_model.py +87 -0
  38. rapidata/api_client/models/datapoint_metadata_model.py +3 -3
  39. rapidata/api_client/models/evaluation_workflow_model.py +1 -1
  40. rapidata/api_client/models/get_validation_rapids_query.py +123 -0
  41. rapidata/api_client/models/get_validation_rapids_query_paged_result.py +105 -0
  42. rapidata/api_client/models/order_model.py +2 -2
  43. rapidata/api_client/models/order_state.py +1 -0
  44. rapidata/api_client/models/pipeline_id_workflow_artifact_id_put_request.py +140 -0
  45. rapidata/api_client/models/query_validation_rapids_result.py +3 -3
  46. rapidata/api_client/models/rapid_issue.py +4 -0
  47. rapidata/api_client/models/report_model.py +4 -4
  48. rapidata/api_client/models/shuffling_selection.py +106 -0
  49. rapidata/api_client/models/update_dataset_name_model.py +87 -0
  50. rapidata/api_client/models/update_dimensions_model.py +87 -0
  51. rapidata/api_client/models/update_order_name_model.py +87 -0
  52. rapidata/api_client/models/upload_text_sources_to_dataset_model.py +3 -3
  53. rapidata/api_client/models/user_score_user_filter_model.py +9 -2
  54. rapidata/api_client_README.md +154 -84
  55. rapidata/rapidata_client/demographic/demographic_manager.py +36 -1
  56. rapidata/rapidata_client/filter/user_score_filter.py +4 -1
  57. rapidata/rapidata_client/order/_rapidata_dataset.py +10 -11
  58. rapidata/rapidata_client/order/_rapidata_order_builder.py +3 -1
  59. rapidata/rapidata_client/order/rapidata_order.py +8 -10
  60. rapidata/rapidata_client/order/rapidata_order_manager.py +11 -2
  61. rapidata/rapidata_client/order/rapidata_results.py +1 -1
  62. rapidata/rapidata_client/validation/rapidata_validation_set.py +11 -0
  63. rapidata/rapidata_client/validation/rapids/rapids.py +3 -5
  64. rapidata/rapidata_client/validation/validation_set_manager.py +36 -21
  65. rapidata/rapidata_client/workflow/_ranking_workflow.py +2 -2
  66. {rapidata-2.14.1.dist-info → rapidata-2.16.0.dist-info}/METADATA +1 -1
  67. {rapidata-2.14.1.dist-info → rapidata-2.16.0.dist-info}/RECORD +69 -51
  68. {rapidata-2.14.1.dist-info → rapidata-2.16.0.dist-info}/LICENSE +0 -0
  69. {rapidata-2.14.1.dist-info → rapidata-2.16.0.dist-info}/WHEEL +0 -0
@@ -70,6 +70,7 @@ class RapidataOrder:
70
70
 
71
71
  States:
72
72
  Created: The order has been created but not started yet.\n
73
+ Preview: The order has been set up and ready but not collecting responses yet.\n
73
74
  Submitted: The order has been submitted and is being reviewed.\n
74
75
  ManualReview: The order is in manual review - something went wrong with the automatic approval.\n
75
76
  Processing: The order is actively being processed.\n
@@ -77,7 +78,7 @@ class RapidataOrder:
77
78
  Completed: The order has been completed.\n
78
79
  Failed: The order has failed.
79
80
  """
80
- return self.__openapi_service.order_api.order_get_by_id_get(self.order_id).state
81
+ return self.__openapi_service.order_api.order_order_id_get(self.order_id).state
81
82
 
82
83
  def display_progress_bar(self, refresh_rate: int=5) -> None:
83
84
  """
@@ -125,7 +126,7 @@ class RapidataOrder:
125
126
  for _ in range(self._max_retries // 2):
126
127
  try:
127
128
  workflow_id = self.__get_workflow_id()
128
- progress = self.__openapi_service.workflow_api.workflow_get_progress_get(workflow_id)
129
+ progress = self.__openapi_service.workflow_api.workflow_workflow_id_progress_get(workflow_id)
129
130
  break
130
131
  except Exception:
131
132
  sleep(self._retry_delay * 2)
@@ -154,7 +155,7 @@ class RapidataOrder:
154
155
  sleep(5)
155
156
 
156
157
  try:
157
- return RapidataResults(self.__openapi_service.order_api.order_get_order_results_get(id=self.order_id)) # type: ignore
158
+ return RapidataResults(json.loads(self.__openapi_service.order_api.order_order_id_download_results_get(order_id=self.order_id)))
158
159
  except (ApiException, json.JSONDecodeError) as e:
159
160
  raise Exception(f"Failed to get order results: {str(e)}") from e
160
161
 
@@ -164,12 +165,9 @@ class RapidataOrder:
164
165
 
165
166
  Raises:
166
167
  Exception: If the order is not in processing state.
167
- """
168
- if (status := self.get_status()) != OrderState.PROCESSING:
169
- raise Exception(f"Preview only available if order is processing. current status: {status}")
170
-
168
+ """
171
169
  campaign_id = self.__get_campaign_id()
172
- auth_url = f"https://rapids.{self.__openapi_service.enviroment}/preview/campaign?id={campaign_id}"
170
+ auth_url = f"https://app.{self.__openapi_service.enviroment}/order/detail/{self.order_id}/preview?campaignId={campaign_id}"
173
171
  could_open_browser = webbrowser.open(auth_url)
174
172
  if not could_open_browser:
175
173
  encoded_url = urllib.parse.quote(auth_url, safe="%/:=&?~#+!$,;'@()*[]")
@@ -180,7 +178,7 @@ class RapidataOrder:
180
178
  if not self.__pipeline_id:
181
179
  for _ in range(self._max_retries):
182
180
  try:
183
- self.__pipeline_id = self.__openapi_service.order_api.order_get_by_id_get(self.order_id).pipeline_id
181
+ self.__pipeline_id = self.__openapi_service.order_api.order_order_id_get(self.order_id).pipeline_id
184
182
  break
185
183
  except Exception:
186
184
  sleep(self._retry_delay)
@@ -207,7 +205,7 @@ class RapidataOrder:
207
205
  pipeline_id = self.__get_pipeline_id()
208
206
  for _ in range(self._max_retries):
209
207
  try:
210
- pipeline = self.__openapi_service.pipeline_api.pipeline_id_get(pipeline_id)
208
+ pipeline = self.__openapi_service.pipeline_api.pipeline_pipeline_id_get(pipeline_id)
211
209
  self.__workflow_id = cast(WorkflowArtifactModel, pipeline.artifacts["workflow-artifact"].actual_instance).workflow_id
212
210
  self.__campaign_id = cast(CampaignArtifactModel, pipeline.artifacts["campaign-artifact"].actual_instance).campaign_id
213
211
  return
@@ -249,6 +249,7 @@ class RapidataOrderManager:
249
249
  datapoints: list[str],
250
250
  total_comparison_budget: int,
251
251
  responses_per_comparison: int = 5,
252
+ data_type: str = RapidataDataTypes.MEDIA,
252
253
  random_comparisons_ratio: float = 0.5,
253
254
  context: Optional[str] = None,
254
255
  validation_set_id: Optional[str] = None,
@@ -265,6 +266,8 @@ class RapidataOrderManager:
265
266
  datapoints (list[str]): A list of datapoints that will participate in the ranking.
266
267
  total_comparison_budget (int): The total number of (pairwise-)comparisons that can be made.
267
268
  responses_per_comparison (int, optional): The number of responses collected per comparison.
269
+ data_type (str, optional): The data type of the datapoints. Defaults to RapidataDataTypes.MEDIA. \n
270
+ Other option: RapidataDataTypes.TEXT ("text").
268
271
  random_comparisons_ratio (float, optional): The fraction of random comparisons in the ranking process.
269
272
  The rest will focus on pairing similarly ranked datapoints. Defaults to 0.5 and can be left untouched.
270
273
  context (str, optional): The context for all the comparison. Defaults to None.\n
@@ -276,7 +279,13 @@ class RapidataOrderManager:
276
279
  selections (Sequence[RapidataSelection], optional): The list of selections for the order. Defaults to None. Decides in what order the tasks should be shown.
277
280
  """
278
281
 
279
- assets = [MediaAsset(path=path) for path in datapoints]
282
+ if data_type == RapidataDataTypes.MEDIA:
283
+ assets = [MediaAsset(path=path) for path in datapoints]
284
+ elif data_type == RapidataDataTypes.TEXT:
285
+ assets = [TextAsset(text=text) for text in datapoints]
286
+ else:
287
+ raise ValueError(f"Unsupported data type: {data_type}, must be one of {RapidataDataTypes._possible_values()}")
288
+
280
289
  return self._create_general_order(
281
290
  name=name,
282
291
  workflow=RankingWorkflow(
@@ -525,7 +534,7 @@ class RapidataOrderManager:
525
534
  """
526
535
 
527
536
  try:
528
- order = self._openapi_service.order_api.order_get_by_id_get(order_id)
537
+ order = self._openapi_service.order_api.order_order_id_get(order_id)
529
538
  except Exception:
530
539
  raise ValueError(f"Order with ID {order_id} not found.")
531
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
@@ -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
- CreateDatapointFromUrlsModelMetadataInner(meta.to_model())
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
- CreateDatapointFromUrlsModelMetadataInner(meta.to_model())
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
- CreateDatapointFromUrlsModelMetadataInner,
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 = [CreateDatapointFromUrlsModelMetadataInner(
24
+ self.context = [CreateDatapointFromFilesModelMetadataInner(
25
25
  PromptMetadata(context).to_model())
26
26
  ] if context else None
27
27
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.14.1
3
+ Version: 2.16.0
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG