rapidata 2.1.2__py3-none-any.whl → 2.1.4__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.

@@ -3,6 +3,7 @@ from rapidata.rapidata_client.order._rapidata_dataset import RapidataDataset
3
3
  from rapidata.service.openapi_service import OpenAPIService
4
4
  import json
5
5
  from rapidata.api_client.exceptions import ApiException
6
+ from rapidata.api_client.models.order_state import OrderState
6
7
  from typing import Optional, cast, Any
7
8
  from rapidata.api_client.models.workflow_artifact_model import WorkflowArtifactModel
8
9
  from tqdm import tqdm
@@ -78,6 +79,17 @@ class RapidataOrder:
78
79
  if refresh_rate < 1:
79
80
  raise ValueError("refresh_rate must be at least 1")
80
81
 
82
+ if self.get_status() == OrderState.CREATED:
83
+ raise Exception("Order has not been started yet. Please start it first.")
84
+
85
+ while self.get_status() == OrderState.SUBMITTED:
86
+ print(f"Order '{self.name}' is submitted and being reviewed. standby...", end="\r")
87
+ sleep(1)
88
+
89
+ if self.get_status() == OrderState.MANUALREVIEW:
90
+ raise Exception(f"Order '{self.name}' is in manual review. It might take some time to start. To speed up the process, please contact support (info@rapidata.ai).\
91
+ \nOnce the order has started, you can run this method again to display the progress bar.")
92
+
81
93
  with tqdm(total=100, desc="Processing order", unit="%", bar_format="{desc}: {percentage:3.0f}%|{bar}| completed [{elapsed}<{remaining}, {rate_fmt}]") as pbar:
82
94
  last_percentage = 0
83
95
  while True:
@@ -95,7 +107,7 @@ class RapidataOrder:
95
107
  if self.__workflow_id:
96
108
  return self.__workflow_id
97
109
 
98
- for _ in range(10):
110
+ for _ in range(10): # Try for 20 seconds to get the workflow id if workflow has not started by then, raise an exception
99
111
  try:
100
112
  order_result = self.__openapi_service.order_api.order_get_by_id_get(self.order_id)
101
113
  pipeline = self.__openapi_service.pipeline_api.pipeline_id_get(order_result.pipeline_id)
@@ -104,7 +116,7 @@ class RapidataOrder:
104
116
  except Exception:
105
117
  sleep(2)
106
118
  if not self.__workflow_id:
107
- raise Exception("Order has not started yet. Please start it or wait for a few seconds and try again.")
119
+ raise Exception("Something went wrong when trying to get the order progress.")
108
120
  return self.__workflow_id
109
121
 
110
122
  def __get_workflow_progress(self):
@@ -131,7 +143,7 @@ class RapidataOrder:
131
143
  Returns:
132
144
  The results of the order.
133
145
  """
134
- while self.get_status() not in ["Completed", "Paused", "ManuelReview", "Failed"]:
146
+ while self.get_status() not in [OrderState.COMPLETED, OrderState.PAUSED, OrderState.MANUALREVIEW, OrderState.FAILED]:
135
147
  sleep(5)
136
148
 
137
149
  try:
@@ -62,6 +62,10 @@ class ValidationSetManager:
62
62
 
63
63
  if len(datapoints) != len(truths):
64
64
  raise ValueError("The number of datapoints and truths must be equal")
65
+
66
+ if not all([isinstance(truth, list) for truth in truths]):
67
+ raise ValueError("Truths must be a list of lists")
68
+
65
69
  if contexts and len(contexts) != len(datapoints):
66
70
  raise ValueError("The number of contexts and datapoints must be equal")
67
71
 
@@ -115,6 +119,9 @@ class ValidationSetManager:
115
119
  if len(datapoints) != len(truths):
116
120
  raise ValueError("The number of datapoints and truths must be equal")
117
121
 
122
+ if not all([isinstance(truth, list) for truth in truths]):
123
+ raise ValueError("Truths must be a list of lists")
124
+
118
125
  if contexts and len(contexts) != len(datapoints):
119
126
  raise ValueError("The number of contexts and datapoints must be equal")
120
127
 
@@ -164,6 +171,9 @@ class ValidationSetManager:
164
171
  print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
165
172
  """
166
173
 
174
+ if not all([isinstance(truth, list) for truth in truths]):
175
+ raise ValueError("Truths must be a list of lists")
176
+
167
177
  if len(datapoints) != len(truths) or len(datapoints) != len(sentences):
168
178
  raise ValueError("The number of datapoints, truths, and sentences must be equal")
169
179
 
@@ -210,6 +220,9 @@ class ValidationSetManager:
210
220
  if len(datapoints) != len(truths):
211
221
  raise ValueError("The number of datapoints and truths must be equal")
212
222
 
223
+ if not all([isinstance(truth, list) for truth in truths]):
224
+ raise ValueError("Truths must be a list of lists")
225
+
213
226
  if contexts and len(contexts) != len(datapoints):
214
227
  raise ValueError("The number of contexts and datapoints must be equal")
215
228
 
@@ -255,6 +268,9 @@ class ValidationSetManager:
255
268
  if len(datapoints) != len(truths):
256
269
  raise ValueError("The number of datapoints and truths must be equal")
257
270
 
271
+ if not all([isinstance(truth, list) for truth in truths]):
272
+ raise ValueError("Truths must be a list of lists")
273
+
258
274
  if contexts and len(contexts) != len(datapoints):
259
275
  raise ValueError("The number of contexts and datapoints must be equal")
260
276
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.1.2
3
+ Version: 2.1.4
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
@@ -368,7 +368,7 @@ rapidata/rapidata_client/metadata/_select_words_metadata.py,sha256=I4qVtCkj60ljk
368
368
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
369
369
  rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=IU0N2_LksyEDlvLq56vCkiSR45kA9I6q4pqDoEpWmMw,5240
370
370
  rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=R4iOWy8nfIHpzqqqQcQhLgpdB8z_tUrkL2M_8rZUw9M,13121
371
- rapidata/rapidata_client/order/rapidata_order.py,sha256=e7ZMllbOaBFqPDVApL-kemAnFLbzF9rNWyTGOKuU8Qc,5741
371
+ rapidata/rapidata_client/order/rapidata_order.py,sha256=ti5fHd-KAvI_WRwe9UWF6QDx-VYzlU_Kqmi44wphJzc,6588
372
372
  rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=ZTygrv5x7dWjWxXOgFcdtyei_ap6J33SJWuWB_AwXeg,24591
373
373
  rapidata/rapidata_client/rapidata_client.py,sha256=9SMOouDBwe-aIi9rnPtnL2vrqnlQHDKxOUpw-Eh3Fsg,1782
374
374
  rapidata/rapidata_client/referee/__init__.py,sha256=q0Hv9nmfEpyChejtyMLT8hWKL0vTTf_UgUXPYNJ-H6M,153
@@ -402,7 +402,7 @@ rapidata/rapidata_client/validation/rapids/__init__.py,sha256=WU5PPwtTJlte6U90MD
402
402
  rapidata/rapidata_client/validation/rapids/box.py,sha256=t3_Kn6doKXdnJdtbwefXnYKPiTKHneJl9E2inkDSqL8,589
403
403
  rapidata/rapidata_client/validation/rapids/rapids.py,sha256=d66Z2wbLCDanT9nHDPbyYsnoBhtYQm_O1vQbn7GogBw,4214
404
404
  rapidata/rapidata_client/validation/rapids/rapids_manager.py,sha256=XkPvR4ho6wM8sbqdhY3_us4QQIbBkCwNhVbGrBrAQx0,6400
405
- rapidata/rapidata_client/validation/validation_set_manager.py,sha256=NklKsohdbkSqCWSQ2ZLd0mjuulrKdqXN6Zb3gTT851Y,16530
405
+ rapidata/rapidata_client/validation/validation_set_manager.py,sha256=kJnXVS1NqwZTvpG98f1uQGBkN17k2ncptTQhRfCEM8A,17218
406
406
  rapidata/rapidata_client/workflow/__init__.py,sha256=dpzq5EsMRmt8Q-AwFVtWethc8uhJFrqtNKqwcn0qRFY,379
407
407
  rapidata/rapidata_client/workflow/_base_workflow.py,sha256=XyIZFKS_RxAuwIHS848S3AyLEHqd07oTD_5jm2oUbsw,762
408
408
  rapidata/rapidata_client/workflow/_classify_workflow.py,sha256=9bT54wxVJgxC-zLk6MVNbseFpzYrvFPjt7DHvxqYfnk,1736
@@ -417,7 +417,7 @@ rapidata/service/credential_manager.py,sha256=Of0BQs_V1T7rkrWX9groLX790nOknaARwn
417
417
  rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5AnfY14BW8,877
418
418
  rapidata/service/openapi_service.py,sha256=Z4NrAuilLlIWBdGOv6otz36tHS_vvU36w5jmvOUTmqo,3198
419
419
  rapidata/service/token_manager.py,sha256=JZ5YbR5Di8dO3H4kK11d0kzWlrXxjgCmeNkHA4AapCM,6425
420
- rapidata-2.1.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
421
- rapidata-2.1.2.dist-info/METADATA,sha256=O4aUgrPzAWncA9iqhaQ3Vl7D9lctnjd6hOt27uUedgU,1067
422
- rapidata-2.1.2.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
423
- rapidata-2.1.2.dist-info/RECORD,,
420
+ rapidata-2.1.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
421
+ rapidata-2.1.4.dist-info/METADATA,sha256=RuxhTz67gYAWeeYsbrLVADaNb91T2DMMd6RtVaeprH8,1067
422
+ rapidata-2.1.4.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
423
+ rapidata-2.1.4.dist-info/RECORD,,