rapidata 2.42.2__py3-none-any.whl → 2.42.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rapidata might be problematic. Click here for more details.

rapidata/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.42.2"
1
+ __version__ = "2.42.3"
2
2
 
3
3
  from .rapidata_client import (
4
4
  RapidataClient,
@@ -1,4 +1,4 @@
1
- from typing import Literal, Optional, Sequence
1
+ from typing import Literal, Optional, Sequence, get_args
2
2
  import random
3
3
  import urllib.parse
4
4
  import webbrowser
@@ -43,6 +43,8 @@ from rapidata.rapidata_client.api.rapidata_api_client import (
43
43
  suppress_rapidata_error_logging,
44
44
  )
45
45
 
46
+ StickyStateLiteral = Literal["Temporary", "Permanent", "Passive"]
47
+
46
48
 
47
49
  class RapidataOrderBuilder:
48
50
  """Builder object for creating Rapidata orders.
@@ -71,9 +73,7 @@ class RapidataOrderBuilder:
71
73
  self.__selections: list[RapidataSelection] = []
72
74
  self.__priority: int | None = None
73
75
  self.__datapoints: list[Datapoint] = []
74
- self.__sticky_state_value: Literal["None", "Temporary", "Permanent"] | None = (
75
- None
76
- )
76
+ self.__sticky_state_value: StickyStateLiteral | None = None
77
77
  self.__validation_set_manager: ValidationSetManager = ValidationSetManager(
78
78
  self.__openapi_service
79
79
  )
@@ -147,6 +147,7 @@ class RapidataOrderBuilder:
147
147
  self.__openapi_service.validation_api.validation_set_recommended_get(
148
148
  asset_type=[self.__datapoints[0].get_asset_type()],
149
149
  modality=[self.__workflow.modality],
150
+ instruction=self.__workflow._get_instruction(),
150
151
  prompt_type=[
151
152
  t.value for t in self.__datapoints[0].get_prompt_type()
152
153
  ],
@@ -453,18 +454,16 @@ class RapidataOrderBuilder:
453
454
  return self
454
455
 
455
456
  def _sticky_state(
456
- self, sticky_state: Literal["None", "Temporary", "Permanent"] | None = None
457
+ self, sticky_state: StickyStateLiteral | None = None
457
458
  ) -> "RapidataOrderBuilder":
458
459
  """
459
460
  Set the sticky state for the order.
460
461
  """
461
- if sticky_state is not None and sticky_state not in [
462
- "None",
463
- "Temporary",
464
- "Permanent",
465
- ]:
466
- raise TypeError(
467
- "Sticky state must be of type Literal['None', 'Temporary', 'Permanent']."
462
+ sticky_state_valid_values = get_args(StickyStateLiteral)
463
+
464
+ if sticky_state is not None and sticky_state not in sticky_state_valid_values:
465
+ raise ValueError(
466
+ f"Sticky state must be one of {sticky_state_valid_values} or None"
468
467
  )
469
468
 
470
469
  self.__sticky_state_value = sticky_state
@@ -1,4 +1,4 @@
1
- from typing import Sequence, Optional, Literal
1
+ from typing import Sequence, Optional, Literal, get_args
2
2
  from itertools import zip_longest
3
3
 
4
4
  from rapidata.rapidata_client.config.tracer import tracer
@@ -41,7 +41,7 @@ from rapidata.api_client.models.filter import Filter
41
41
  from rapidata.api_client.models.filter_operator import FilterOperator
42
42
  from rapidata.api_client.models.sort_criterion import SortCriterion
43
43
  from rapidata.api_client.models.sort_direction import SortDirection
44
-
44
+ from rapidata.rapidata_client.order._rapidata_order_builder import StickyStateLiteral
45
45
 
46
46
  from tqdm import tqdm
47
47
 
@@ -61,7 +61,7 @@ class RapidataOrderManager:
61
61
  self.settings = RapidataSettings
62
62
  self.selections = RapidataSelections
63
63
  self.__priority: int | None = None
64
- self.__sticky_state: Literal["None", "Temporary", "Permanent"] | None = None
64
+ self.__sticky_state: StickyStateLiteral | None = None
65
65
  self.__asset_uploader = AssetUploader(openapi_service)
66
66
  logger.debug("RapidataOrderManager initialized")
67
67
 
@@ -172,21 +172,21 @@ class RapidataOrderManager:
172
172
  logger.debug("Order created: %s", order)
173
173
  return order
174
174
 
175
- def _set_priority(self, priority: int):
176
- if not isinstance(priority, int):
177
- raise TypeError("Priority must be an integer")
175
+ def _set_priority(self, priority: int | None):
176
+ if priority is not None and not isinstance(priority, int):
177
+ raise TypeError("Priority must be an integer or None")
178
178
 
179
- if priority < 0:
180
- raise ValueError("Priority must be greater than 0")
179
+ if priority is not None and priority < 0:
180
+ raise ValueError("Priority must be greater than 0 or None")
181
181
 
182
182
  self.__priority = priority
183
183
 
184
- def _set_sticky_state(
185
- self, sticky_state: Literal["None", "Temporary", "Permanent"]
186
- ):
187
- if sticky_state not in ["None", "Temporary", "Permanent"]:
184
+ def _set_sticky_state(self, sticky_state: StickyStateLiteral | None):
185
+ sticky_state_valid_values = get_args(StickyStateLiteral)
186
+
187
+ if sticky_state is not None and sticky_state not in sticky_state_valid_values:
188
188
  raise ValueError(
189
- "Sticky state must be one of 'None', 'Temporary', 'Permanent'"
189
+ f"Sticky state must be one of {sticky_state_valid_values} or None"
190
190
  )
191
191
 
192
192
  self.__sticky_state = sticky_state
@@ -44,6 +44,10 @@ class Workflow(ABC):
44
44
  ):
45
45
  pass
46
46
 
47
+ @abstractmethod
48
+ def _get_instruction(self) -> str:
49
+ pass
50
+
47
51
  @abstractmethod
48
52
  def _to_model(
49
53
  self,
@@ -35,6 +35,9 @@ class ClassifyWorkflow(Workflow):
35
35
  self._instruction = instruction
36
36
  self._answer_options = answer_options
37
37
 
38
+ def _get_instruction(self) -> str:
39
+ return self._instruction
40
+
38
41
  def _to_dict(self) -> dict[str, Any]:
39
42
  return {
40
43
  **super()._to_dict(),
@@ -31,6 +31,9 @@ class CompareWorkflow(Workflow):
31
31
  self._instruction = instruction
32
32
  self._a_b_names = a_b_names
33
33
 
34
+ def _get_instruction(self) -> str:
35
+ return self._instruction
36
+
34
37
  def _to_dict(self) -> dict[str, Any]:
35
38
  return {
36
39
  **super()._to_dict(),
@@ -16,6 +16,9 @@ class DrawWorkflow(Workflow):
16
16
  super().__init__(type="SimpleWorkflowConfig")
17
17
  self._target = target
18
18
 
19
+ def _get_instruction(self) -> str:
20
+ return self._target
21
+
19
22
  def _to_model(self) -> SimpleWorkflowModel:
20
23
  blueprint = LineRapidBlueprint(_t="LineBlueprint", target=self._target)
21
24
 
@@ -22,6 +22,9 @@ class EvaluationWorkflow(Workflow):
22
22
  self.validation_set_id = validation_set_id
23
23
  self.should_accept_incorrect = should_accept_incorrect
24
24
 
25
+ def _get_instruction(self) -> str:
26
+ return ""
27
+
25
28
  def _to_model(self):
26
29
  return EvaluationWorkflowModel(
27
30
  _t="EvaluationWorkflow",
@@ -33,6 +33,9 @@ class FreeTextWorkflow(Workflow):
33
33
  self._instruction = instruction
34
34
  self._validation_system_prompt = validation_system_prompt
35
35
 
36
+ def _get_instruction(self) -> str:
37
+ return self._instruction
38
+
36
39
  def _to_dict(self) -> dict[str, Any]:
37
40
  return {
38
41
  **super()._to_dict(),
@@ -16,6 +16,9 @@ class LocateWorkflow(Workflow):
16
16
  super().__init__(type="SimpleWorkflowConfig")
17
17
  self._target = target
18
18
 
19
+ def _get_instruction(self) -> str:
20
+ return self._target
21
+
19
22
  def _to_model(self) -> SimpleWorkflowModel:
20
23
  blueprint = LocateRapidBlueprint(_t="LocateBlueprint", target=self._target)
21
24
 
@@ -73,6 +73,9 @@ class RankingWorkflow(Workflow):
73
73
  scalingFactor=elo_scaling_factor,
74
74
  )
75
75
 
76
+ def _get_instruction(self) -> str:
77
+ return self.criteria
78
+
76
79
  def _to_model(self) -> CompareWorkflowModel:
77
80
 
78
81
  return CompareWorkflowModel(
@@ -31,6 +31,9 @@ class SelectWordsWorkflow(Workflow):
31
31
  super().__init__(type="SimpleWorkflowConfig")
32
32
  self._instruction = instruction
33
33
 
34
+ def _get_instruction(self) -> str:
35
+ return self._instruction
36
+
34
37
  def _to_model(self) -> SimpleWorkflowModel:
35
38
  blueprint = TranscriptionRapidBlueprint(
36
39
  _t="TranscriptionBlueprint", title=self._instruction
@@ -29,6 +29,9 @@ class TimestampWorkflow(Workflow):
29
29
  super().__init__(type="SimpleWorkflowConfig")
30
30
  self._instruction = instruction
31
31
 
32
+ def _get_instruction(self) -> str:
33
+ return self._instruction
34
+
32
35
  def _to_model(self) -> SimpleWorkflowModel:
33
36
  blueprint = ScrubRapidBlueprint(_t="ScrubBlueprint", target=self._instruction)
34
37
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rapidata
3
- Version: 2.42.2
3
+ Version: 2.42.3
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
  License-File: LICENSE
@@ -1,4 +1,4 @@
1
- rapidata/__init__.py,sha256=JE3wmzFPMDBFCoTTrU5UkvBELIuoQtdUwG6wPOUZbD0,875
1
+ rapidata/__init__.py,sha256=w5Fcsu571VQBJn_5rIIIsm3F4_8HuBOjNCPV3jabwzo,875
2
2
  rapidata/api_client/__init__.py,sha256=Rh2aAoa6nDv09Z7cpTNdrPotXixBcNN_2VevCDD1goc,37144
3
3
  rapidata/api_client/api/__init__.py,sha256=CaZJ54mxbAEzAFd0Cjy0mfiUabD-d_7tqVOgjU4RxZI,1749
4
4
  rapidata/api_client/api/asset_api.py,sha256=buYMBGvg5_SLkJ7aG07c7_1rT6TXTCqoLfoV8O2nJhM,34442
@@ -657,10 +657,10 @@ rapidata/rapidata_client/filter/rapidata_filters.py,sha256=B8ptQsaAn1e14Grv8xBYQ
657
657
  rapidata/rapidata_client/filter/response_count_filter.py,sha256=i2u2YQD3_RLQRZyqAceAGLQS3es97Q2n8KTlgfDYMko,2332
658
658
  rapidata/rapidata_client/filter/user_score_filter.py,sha256=4B3Zzp7aosDFmte3nLPTlXMN4zatT6Wcq5QLIoXqhgI,1910
659
659
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
660
- rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=RZwRyPzxR_D3aVZU-K98-FqIbOpzXNmmkJzzmYwYJnU,16828
660
+ rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=FTJJRCW9KehIlqELOXmKeLhuGcLj9m9ImEU1agOIRa4,16915
661
661
  rapidata/rapidata_client/order/dataset/_rapidata_dataset.py,sha256=8EhoRVBxWMbp1mtS56Uogg2dwFC2vySw5hNqTPDTHzM,6345
662
662
  rapidata/rapidata_client/order/rapidata_order.py,sha256=w41HUWE6q9L2Stx0ScZdKb7qLjWFIUPMMDOe2fElLvM,14481
663
- rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=_IS2ONiINmq4ga_2oWsbSluwC-SEv03yo_aKWluOGQk,40823
663
+ rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=Ya8s40hzigIIpo9WphL67sguuqY_3q-Z4AL8IHmX-ZI,41028
664
664
  rapidata/rapidata_client/order/rapidata_results.py,sha256=weL4S14fzug3ZOJbQk9Oj-4tv2jx5aZAMp7VJ-a6Qq4,8437
665
665
  rapidata/rapidata_client/rapidata_client.py,sha256=5BJMstjJFmBwkflC_YnzlhoOF3SKP3u2wQ56G_hvB3Q,5862
666
666
  rapidata/rapidata_client/referee/__init__.py,sha256=J8oZJNUduPr-Tmn8iJwR-qBiSv7owhUFcEzXTRETecw,155
@@ -702,22 +702,22 @@ rapidata/rapidata_client/validation/rapids/rapids.py,sha256=E4O4p2br0g9lgB3tOdfE
702
702
  rapidata/rapidata_client/validation/rapids/rapids_manager.py,sha256=YqGxnqJ2vYfAywXJDujQEBrYnlf0URdLxQ7hTR1JeOI,16225
703
703
  rapidata/rapidata_client/validation/validation_set_manager.py,sha256=uBKdf-13LKeetvVz425292L6jSYBNrsM08S-n9xEXAw,35099
704
704
  rapidata/rapidata_client/workflow/__init__.py,sha256=6kfMN7TQVpiQNGjNHg3X7KdnCyYe3K2TIq7ZVEatQcU,476
705
- rapidata/rapidata_client/workflow/_base_workflow.py,sha256=UoB9mh0azAf8_IgH6ujGsRQS9PxSiVCSDsAfLjV7wgM,1570
706
- rapidata/rapidata_client/workflow/_classify_workflow.py,sha256=gJ-Us3bCzbgiTyIKWLFjCJQS6ClqAnObLtZgCJGUASI,2546
707
- rapidata/rapidata_client/workflow/_compare_workflow.py,sha256=AwLlV6246Nd2PvsTUw4loZekK44HANv_pNOZWkPWZiE,2177
708
- rapidata/rapidata_client/workflow/_draw_workflow.py,sha256=CKbNGp1NdlvipO_Rc-We_JkocRsE2NY32iXg-pPBvtM,1347
709
- rapidata/rapidata_client/workflow/_evaluation_workflow.py,sha256=3b71NpxAdmYfRTZCZHq-UoQFqY7CDlMup6VwE7412kc,1732
710
- rapidata/rapidata_client/workflow/_free_text_workflow.py,sha256=d5vZDZ_ZdzP4Crecm-cm-vBhkJkx5EPtAFAuSVH2EwI,2664
711
- rapidata/rapidata_client/workflow/_locate_workflow.py,sha256=zqE5XZALqdcyEW_e_gVF61pLOmt85O7sDRU28qLuAa4,1371
712
- rapidata/rapidata_client/workflow/_ranking_workflow.py,sha256=Rtc-Yj99gpM3JY4hH7QqGeL0o5LSClv2xxNCl-9leVA,4436
713
- rapidata/rapidata_client/workflow/_select_words_workflow.py,sha256=huxVRP4G9nhHr3i37A9r91SHSUq5YXTvC0qe92W9RGM,2210
714
- rapidata/rapidata_client/workflow/_timestamp_workflow.py,sha256=k1MZ1_nYysibDYWJ5aogiIOjRYFiFTTEnxsK2kCXAtw,1774
705
+ rapidata/rapidata_client/workflow/_base_workflow.py,sha256=ctbCiQ1VKR9mTKl3MRubtSChrPcbjjZ-xP61f1PBBwc,1643
706
+ rapidata/rapidata_client/workflow/_classify_workflow.py,sha256=KDdASQL9u-PSosHrtvKAYc5P_Hy94RcB16gK2RtbacE,2619
707
+ rapidata/rapidata_client/workflow/_compare_workflow.py,sha256=Yf8NLxrK8MHbmXLvghy3-xvQosVW3CpYy9uRO1y2xpg,2250
708
+ rapidata/rapidata_client/workflow/_draw_workflow.py,sha256=O7r_bltnGfxQV_TOzyC_5Z2-VeAPH-yMSA5WDEu4NzE,1415
709
+ rapidata/rapidata_client/workflow/_evaluation_workflow.py,sha256=F4-K-bDYh9qjq8S_L8VL5E9pzAO1iTRec47srFVTL3U,1790
710
+ rapidata/rapidata_client/workflow/_free_text_workflow.py,sha256=pf2z2lanj7v6Zo-nYc0x8XVghK4JfX7bfsHk-TVOV1c,2737
711
+ rapidata/rapidata_client/workflow/_locate_workflow.py,sha256=7UXapQBmuUsFMpvG6TPk0D9g9PrCa9y92Y4nb1ecjcw,1439
712
+ rapidata/rapidata_client/workflow/_ranking_workflow.py,sha256=Ma7MpzhkTtg9jdugowAT0bTi_7WbR6z99gENdTn0H7k,4505
713
+ rapidata/rapidata_client/workflow/_select_words_workflow.py,sha256=b3APwuDuMphtOVefOaaOVebcaRcnnVQ6NltZkEPXnCo,2283
714
+ rapidata/rapidata_client/workflow/_timestamp_workflow.py,sha256=totcKhAItkPS7HMrjbr6_CGgKMKzohzpdCxMu0X-vCw,1847
715
715
  rapidata/service/__init__.py,sha256=ULBu1tCwgp055OifUXZKtExkzqXeTa_LRROzjMWAd90,69
716
716
  rapidata/service/credential_manager.py,sha256=T3yL4tXVnibRytxjQkOC-ex3kFGQR5KcKUUAtao4PFw,8698
717
717
  rapidata/service/local_file_service.py,sha256=0Q4LdoEtPFKzgXK2oZ1cQ-X7FipakscjGnnBH8dRFRQ,855
718
718
  rapidata/service/openapi_service.py,sha256=E2zVagI_ri15PK06ITO_VNKYDJ0VZQG1YQ1T6bEIVsY,5566
719
719
  rapidata/types/__init__.py,sha256=gSGrmWV5gEA6pPfAR5vwSy_DvibO5IjCZDiB7LtlMOQ,6134
720
- rapidata-2.42.2.dist-info/METADATA,sha256=E5-4G2VCDEv5xV4NuLau3VIG3Cb66V8VT6qTH1fTOeY,1479
721
- rapidata-2.42.2.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
722
- rapidata-2.42.2.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
723
- rapidata-2.42.2.dist-info/RECORD,,
720
+ rapidata-2.42.3.dist-info/METADATA,sha256=VMEnGlq258AvdqaQP1OiIN6VHKMkiPQgfwXKY-I84rA,1479
721
+ rapidata-2.42.3.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
722
+ rapidata-2.42.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
723
+ rapidata-2.42.3.dist-info/RECORD,,