rapidata 1.8.3__py3-none-any.whl → 1.10.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 (27) hide show
  1. rapidata/__init__.py +2 -2
  2. rapidata/api_client/models/rapid_answer.py +3 -1
  3. rapidata/rapidata_client/__init__.py +2 -2
  4. rapidata/rapidata_client/assets/media_asset.py +38 -29
  5. rapidata/rapidata_client/dataset/rapid_builders/__init__.py +1 -1
  6. rapidata/rapidata_client/dataset/rapid_builders/base_rapid_builder.py +5 -5
  7. rapidata/rapidata_client/dataset/rapid_builders/rapids.py +7 -6
  8. rapidata/rapidata_client/dataset/rapid_builders/{transcription_rapid_builders.py → select_words_rapid_builders.py} +35 -43
  9. rapidata/rapidata_client/dataset/rapidata_validation_set.py +6 -0
  10. rapidata/rapidata_client/dataset/validation_set_builder.py +28 -16
  11. rapidata/rapidata_client/metadata/__init__.py +1 -1
  12. rapidata/rapidata_client/metadata/{transcription_metadata.py → select_words_metadata.py} +4 -4
  13. rapidata/rapidata_client/order/order_builder.py +25 -0
  14. rapidata/rapidata_client/order/rapidata_order.py +1 -1
  15. rapidata/rapidata_client/order/rapidata_order_builder.py +1 -1
  16. rapidata/rapidata_client/rapidata_client.py +32 -9
  17. rapidata/rapidata_client/selection/capped_selection.py +1 -1
  18. rapidata/rapidata_client/simple_builders/simple_classification_builders.py +35 -9
  19. rapidata/rapidata_client/simple_builders/simple_compare_builders.py +26 -9
  20. rapidata/rapidata_client/simple_builders/simple_free_text_builders.py +13 -1
  21. rapidata/rapidata_client/simple_builders/{simple_transcription_builders.py → simple_select_words_builders.py} +48 -46
  22. rapidata/rapidata_client/workflow/__init__.py +1 -1
  23. rapidata/rapidata_client/workflow/{transcription_workflow.py → select_words_workflow.py} +7 -7
  24. {rapidata-1.8.3.dist-info → rapidata-1.10.0.dist-info}/METADATA +1 -1
  25. {rapidata-1.8.3.dist-info → rapidata-1.10.0.dist-info}/RECORD +27 -26
  26. {rapidata-1.8.3.dist-info → rapidata-1.10.0.dist-info}/LICENSE +0 -0
  27. {rapidata-1.8.3.dist-info → rapidata-1.10.0.dist-info}/WHEEL +0 -0
rapidata/__init__.py CHANGED
@@ -1,7 +1,7 @@
1
1
  from .rapidata_client import (
2
2
  RapidataClient,
3
3
  ClassifyWorkflow,
4
- TranscriptionWorkflow,
4
+ SelectWordsWorkflow,
5
5
  CompareWorkflow,
6
6
  FreeTextWorkflow,
7
7
  DemographicSelection,
@@ -14,7 +14,7 @@ from .rapidata_client import (
14
14
  PrivateTextMetadata,
15
15
  PublicTextMetadata,
16
16
  PromptMetadata,
17
- TranscriptionMetadata,
17
+ SelectWordsMetadata,
18
18
  Settings,
19
19
  FeatureFlags, # remove next major version
20
20
  CountryCodes,
@@ -28,11 +28,12 @@ class RapidAnswer(BaseModel):
28
28
  RapidAnswer
29
29
  """ # noqa: E501
30
30
  id: StrictStr
31
+ user_id: StrictStr = Field(alias="userId")
31
32
  country: StrictStr
32
33
  result: RapidAnswerResult
33
34
  user_score: Union[StrictFloat, StrictInt] = Field(alias="userScore")
34
35
  demographic_information: Dict[str, StrictStr] = Field(alias="demographicInformation")
35
- __properties: ClassVar[List[str]] = ["id", "country", "result", "userScore", "demographicInformation"]
36
+ __properties: ClassVar[List[str]] = ["id", "userId", "country", "result", "userScore", "demographicInformation"]
36
37
 
37
38
  model_config = ConfigDict(
38
39
  populate_by_name=True,
@@ -89,6 +90,7 @@ class RapidAnswer(BaseModel):
89
90
 
90
91
  _obj = cls.model_validate({
91
92
  "id": obj.get("id"),
93
+ "userId": obj.get("userId"),
92
94
  "country": obj.get("country"),
93
95
  "result": RapidAnswerResult.from_dict(obj["result"]) if obj.get("result") is not None else None,
94
96
  "userScore": obj.get("userScore"),
@@ -1,7 +1,7 @@
1
1
  from .rapidata_client import RapidataClient
2
2
  from .workflow import (
3
3
  ClassifyWorkflow,
4
- TranscriptionWorkflow,
4
+ SelectWordsWorkflow,
5
5
  CompareWorkflow,
6
6
  FreeTextWorkflow,
7
7
  )
@@ -17,7 +17,7 @@ from .metadata import (
17
17
  PrivateTextMetadata,
18
18
  PublicTextMetadata,
19
19
  PromptMetadata,
20
- TranscriptionMetadata,
20
+ SelectWordsMetadata,
21
21
  )
22
22
  from .settings import Settings, FeatureFlags # remove FeatureFlags next major version
23
23
  from .country_codes import CountryCodes
@@ -13,6 +13,7 @@ class MediaAsset(BaseAsset):
13
13
  """MediaAsset Class
14
14
 
15
15
  Represents a media asset by storing the file path.
16
+ Supports local files and URLs for images, MP3, and MP4.
16
17
 
17
18
  Args:
18
19
  path (str): The file system path to the media asset.
@@ -21,68 +22,76 @@ class MediaAsset(BaseAsset):
21
22
  FileNotFoundError: If the provided file path does not exist.
22
23
  """
23
24
 
25
+ ALLOWED_TYPES = [
26
+ 'image/',
27
+ 'audio/mp3', # MP3
28
+ 'video/mp4', # MP4
29
+ ]
30
+
24
31
  def __init__(self, path: str):
25
32
  """
26
33
  Initialize a MediaAsset instance.
27
34
 
28
35
  Args:
29
- path (str): The file system path to the media asset or a link to an image.
36
+ path (str): The file system path to the media asset or a URL.
30
37
 
31
38
  Raises:
32
39
  FileNotFoundError: If the provided file path does not exist.
40
+ ValueError: If media type is unsupported or duration exceeds 25 seconds.
33
41
  """
34
42
  if not isinstance(path, str):
35
- raise ValueError("Media must be a string, either a local file path or an image URL")
43
+ raise ValueError("Media must be a string, either a local file path or a URL")
36
44
 
37
45
  if re.match(r'^https?://', path):
38
- self.path = MediaAsset.get_image_bytes(path)
46
+ self.path = self._get_media_bytes(path)
39
47
  self.name = path.split('/')[-1]
40
- if not self.name.endswith(('.jpg', '.jpeg', '.png', '.gif')):
41
- self.name += '.jpg'
48
+ if not self.name.endswith(('.jpg', '.jpeg', '.png', '.gif', '.mp3', '.mp4', '.webp')):
49
+ raise ValueError("Supported file types for custom names: jpg, jpeg, png, gif, mp3, mp4")
42
50
  return
43
51
 
44
52
  if not os.path.exists(path):
45
- raise FileNotFoundError(f"File not found: {path}, please provide a valid local file path.")
53
+ raise FileNotFoundError(f"File not found: {path}")
54
+
46
55
 
47
56
  self.path: str | bytes = path
48
57
  self.name = path
49
58
 
50
59
  def set_custom_name(self, name: str) -> 'MediaAsset':
51
- """
52
- Set a custom name for the media asset, will only work with links.
53
-
54
- Args:
55
- name (str): The custom name to be set.
56
- """
60
+ """Set a custom name for the media asset (only works with URLs)."""
57
61
  if isinstance(self.path, bytes):
58
- if not name.endswith(('.jpg', '.jpeg', '.png', '.gif')):
59
- name += '.jpg'
62
+ if not name.endswith(('.jpg', '.jpeg', '.png', '.gif', '.mp3', '.mp4', '.webp')):
63
+ raise ValueError("Supported file types for custom names: jpg, jpeg, png, gif, mp3, mp4")
60
64
  self.name = name
61
65
  else:
62
- raise ValueError("Custom name can only be set for links.")
66
+ raise ValueError("Custom name can only be set for URLs.")
63
67
  return self
64
68
 
65
- @staticmethod
66
- def get_image_bytes(image_url: str) -> bytes:
69
+ def _get_media_bytes(self, url: str) -> bytes:
67
70
  """
68
- Downloads an image from a URL and converts it to bytes.
69
- Validates that the URL points to an actual image.
71
+ Downloads media files from URL and validates type and duration.
70
72
 
71
73
  Args:
72
- image_url (str): URL of the image
73
-
74
+ url: URL of the media file
75
+
74
76
  Returns:
75
- bytes: Image data as bytes
77
+ bytes: Media data
76
78
 
77
79
  Raises:
78
- ValueError: If URL doesn't point to an image
80
+ ValueError: If media type is unsupported or duration exceeds limit
79
81
  requests.exceptions.RequestException: If download fails
80
82
  """
81
- response = requests.get(image_url)
83
+ response = requests.get(url, stream=False) # Don't stream, we need full file
82
84
  response.raise_for_status()
85
+
86
+ content_type = response.headers.get('content-type', '').lower()
83
87
 
84
- content_type = response.headers.get('content-type', '')
85
- if not content_type.startswith('image/'):
86
- raise ValueError(f'URL does not point to an image. Content-Type: {content_type}')
87
-
88
- return BytesIO(response.content).getvalue()
88
+ # Validate content type
89
+ if not any(content_type.startswith(t) for t in self.ALLOWED_TYPES):
90
+ raise ValueError(
91
+ f'URL does not point to an allowed media type.\n'
92
+ f'Content-Type: {content_type}\n'
93
+ f'Allowed types: {self.ALLOWED_TYPES}'
94
+ )
95
+
96
+ content = BytesIO(response.content)
97
+ return content.getvalue()
@@ -1,4 +1,4 @@
1
1
  from .classify_rapid_builders import ClassifyRapidQuestionBuilder
2
2
  from .compare_rapid_builders import CompareRapidCriteriaBuilder
3
- from .transcription_rapid_builders import TranscriptionRapidInstructionBuilder
3
+ from .select_words_rapid_builders import SelectWordsRapidInstructionBuilder
4
4
  from .base_rapid_builder import BaseRapidBuilder
@@ -1,5 +1,5 @@
1
1
  from rapidata.service.openapi_service import OpenAPIService
2
- from rapidata.rapidata_client.dataset.rapid_builders import ClassifyRapidQuestionBuilder, CompareRapidCriteriaBuilder, TranscriptionRapidInstructionBuilder
2
+ from rapidata.rapidata_client.dataset.rapid_builders import ClassifyRapidQuestionBuilder, CompareRapidCriteriaBuilder, SelectWordsRapidInstructionBuilder
3
3
 
4
4
  class BaseRapidBuilder:
5
5
  """Base class for creating different types of rapids.
@@ -23,11 +23,11 @@ class BaseRapidBuilder:
23
23
  """
24
24
  return CompareRapidCriteriaBuilder()
25
25
 
26
- def transcription_rapid(self):
27
- """Creates a transcription rapid.
26
+ def select_words_rapid(self):
27
+ """Creates a select words rapid.
28
28
 
29
29
  Returns:
30
- TranscriptionRapidInstructionBuilder: A builder for creating the transcription instruction.
30
+ SelectWordsRapidInstructionBuilder: A builder for creating the select words instruction.
31
31
  """
32
- return TranscriptionRapidInstructionBuilder()
32
+ return SelectWordsRapidInstructionBuilder()
33
33
 
@@ -5,7 +5,7 @@ class Rapid:
5
5
  pass
6
6
 
7
7
  class ClassificationRapid(Rapid):
8
- """A classification rapid. This represents the question, options, truths, asset and metadata that will be given to the user."""
8
+ """A classification rapid. This represents the question, options, truths, asset and metadata that will be given to the labeler."""
9
9
  def __init__(self, question: str, options: list[str], truths: list[str], asset: MediaAsset | TextAsset, metadata: list[Metadata]):
10
10
  self.question = question
11
11
  self.options = options
@@ -14,19 +14,20 @@ class ClassificationRapid(Rapid):
14
14
  self.metadata = metadata
15
15
 
16
16
  class CompareRapid(Rapid):
17
- """A comparison rapid. This represents the criteria, asset, truth and metadata that will be given to the user."""
17
+ """A comparison rapid. This represents the criteria, asset, truth and metadata that will be given to the labeler."""
18
18
  def __init__(self, criteria: str, truth: str, asset: MultiAsset, metadata: list[Metadata]):
19
19
  self.criteria = criteria
20
20
  self.asset = asset
21
21
  self.truth = truth
22
22
  self.metadata = metadata
23
23
 
24
- class TranscriptionRapid(Rapid):
25
- """A transcription rapid. This represents the instruction, truths, asset, transcription and strict grading that will be given to the user."""
26
- def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, transcription: str, strict_grading: bool):
24
+ class SelectWordsRapid(Rapid):
25
+ """A transcription rapid. This represents the instruction, truths, asset, transcription and strict grading that will be given to the labeler."""
26
+ def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, text: str, strict_grading: bool):
27
+ """The text will be split up by spaces to be selected by the labeler."""
27
28
  self.instruction = instruction
28
29
  self.truths = truths
29
30
  self.asset = asset
30
- self.transcription = transcription
31
+ self.text = text
31
32
  self.strict_grading = strict_grading
32
33
 
@@ -1,64 +1,56 @@
1
1
  from rapidata.rapidata_client.assets import MediaAsset
2
- from rapidata.rapidata_client.dataset.rapid_builders.rapids import TranscriptionRapid
2
+ from rapidata.rapidata_client.dataset.rapid_builders.rapids import SelectWordsRapid
3
3
 
4
- class TranscriptionRapidBuilder:
5
- """Final builder class for transcription rapid.
4
+ class SelectWordsRapidBuilder:
5
+ """Final builder class for rapid.
6
6
 
7
- This class handles the final construction of a transcription rapid with all required parameters.
7
+ This class handles the final construction of a rapid with all required parameters.
8
8
  """
9
- def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, transcription_text: str):
9
+ def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, text: str):
10
10
  self._instruction = instruction
11
11
  self._truths = truths
12
12
  self._asset = asset
13
- self._transcription_text = transcription_text
13
+ self._text = text
14
14
  self._strict_grading = True
15
15
 
16
16
  def strict_grading(self, strict_grading: bool = True):
17
- """Set whether to use strict grading for the transcription.
17
+ """Set whether to use strict grading for the select words.
18
18
  Strict grading true: In order to be correct, you must select all of the right words
19
19
  Strict grading false: In order to be correct, you must select at least one right word
20
20
  In both cases it will be incorrect if you select any wrong words
21
21
 
22
22
  Args:
23
- strict_grading (bool): Whether to use strict grading. Defaults to True.
24
-
25
- Returns:
26
- TranscriptionRapidBuilder: The builder instance for method chaining
27
- """
23
+ strict_grading (bool): Whether to use strict grading. Defaults to True."""
28
24
  self._strict_grading = strict_grading
29
25
  return self
30
26
 
31
27
  def build(self):
32
- """Constructs and returns the final transcription rapid.
33
-
34
- Returns:
35
- TranscriptionRapid: The constructed transcription rapid
36
- """
37
- return TranscriptionRapid(
28
+ """Constructs and returns the final rapid."""
29
+ return SelectWordsRapid(
38
30
  instruction=self._instruction,
39
31
  truths=self._truths,
40
32
  asset=self._asset,
41
- transcription=self._transcription_text,
33
+ text=self._text,
42
34
  strict_grading=self._strict_grading
43
35
  )
44
36
 
45
- class TranscriptionRapidTruthsBuilder:
46
- """Builder class for the truths of the transcription rapid.
37
+ class SelectWordsRapidTruthsBuilder:
38
+ """Builder class for the truths of the rapid.
47
39
 
48
- This adds the truths to the transcription rapid.
40
+ This adds the truths to the rapid.
49
41
  """
50
- def __init__(self, instruction: str, media: MediaAsset, transcription_text: str):
42
+ def __init__(self, instruction: str, media: MediaAsset, text: str):
51
43
  self._instruction = instruction
52
44
  self._media = media
53
- self._transcription_text = transcription_text
45
+ self._text = text
54
46
  self._truths = None
55
47
 
56
48
  def truths(self, truths: list[int]):
57
- """Set the truths for the transcription rapid.
49
+ """Set the truths for the rapid.
58
50
 
59
51
  Args:
60
- truths (list[int]): The correct answers for the transcription task. \
61
- Each integer represents the index of the correct word in the transcription text."""
52
+ truths (list[int]): The correct answers for the task. \
53
+ Each integer represents the index of the correct word in the text."""
62
54
 
63
55
  if not isinstance(truths, list) or not all(isinstance(truth, int) for truth in truths):
64
56
  raise ValueError("Truths must be a list of integers")
@@ -70,30 +62,30 @@ class TranscriptionRapidTruthsBuilder:
70
62
  if self._truths is None:
71
63
  raise ValueError("Truths are required")
72
64
 
73
- return TranscriptionRapidBuilder(
65
+ return SelectWordsRapidBuilder(
74
66
  instruction=self._instruction,
75
67
  truths=self._truths,
76
68
  asset=self._media,
77
- transcription_text=self._transcription_text
69
+ text=self._text
78
70
  )
79
71
 
80
- class TranscriptionRapidAssetBuilder:
81
- """Builder class for the asset of the transcription rapid.
72
+ class SelectWordsRapidAssetBuilder:
73
+ """Builder class for the asset of the rapid.
82
74
 
83
- This adds the asset to the transcription rapid.
75
+ This adds the asset to the rapid.
84
76
  """
85
77
  def __init__(self, instruction: str):
86
78
  self._instruction = instruction
87
79
 
88
- def media(self, media: str, transcription_text: str):
89
- """Set the media asset for the transcription rapid.
80
+ def media(self, media: str, text: str):
81
+ """Set the media asset for the rapid.
90
82
 
91
83
  Args:
92
- media (str): The local file path of the audio or video file to be transcribed
93
- transcription_text (str): The text to be transcribed from the media asset""" # is video file okay?
84
+ media (str): The local path (image, video, audio) or URL (image) of the media asset.
85
+ text (str): The text will be split up by spaces and the labeler will be able to select the words"""
94
86
 
95
87
  self._asset = MediaAsset(media)
96
- self._transcription_text = transcription_text
88
+ self._text = text
97
89
 
98
90
  return self._build()
99
91
 
@@ -101,21 +93,21 @@ class TranscriptionRapidAssetBuilder:
101
93
  if not self._asset:
102
94
  raise ValueError("Media is required")
103
95
 
104
- return TranscriptionRapidTruthsBuilder(
96
+ return SelectWordsRapidTruthsBuilder(
105
97
  instruction=self._instruction,
106
98
  media=self._asset,
107
- transcription_text=self._transcription_text
99
+ text=self._text
108
100
  )
109
101
 
110
- class TranscriptionRapidInstructionBuilder:
102
+ class SelectWordsRapidInstructionBuilder:
111
103
  def __init__(self):
112
104
  self._instruction = None
113
105
 
114
106
  def instruction(self, instruction: str):
115
- """Set the instruction for the transcription rapid.
107
+ """Set the instruction for the rapid.
116
108
 
117
109
  Args:
118
- instruction (str): The instruction for the transcription task"""
110
+ instruction (str): The instruction for the task"""
119
111
 
120
112
  if not isinstance(instruction, str):
121
113
  raise ValueError("Instruction must be a string")
@@ -127,6 +119,6 @@ class TranscriptionRapidInstructionBuilder:
127
119
  if self._instruction is None:
128
120
  raise ValueError("Instruction is required")
129
121
 
130
- return TranscriptionRapidAssetBuilder(
122
+ return SelectWordsRapidAssetBuilder(
131
123
  instruction=self._instruction,
132
124
  )
@@ -298,3 +298,9 @@ class RapidataValidationSet:
298
298
  asset=asset,
299
299
  randomCorrectProbability=len(correct_words) / len(transcription),
300
300
  )
301
+
302
+ def __str__(self):
303
+ return f"name: '{self.name}' id: {self.id}"
304
+
305
+ def __repr__(self):
306
+ return f"name: '{self.name}' id: {self.id}"
@@ -20,7 +20,7 @@ from rapidata.rapidata_client.dataset.rapid_builders.rapids import (
20
20
  Rapid,
21
21
  ClassificationRapid,
22
22
  CompareRapid,
23
- TranscriptionRapid
23
+ SelectWordsRapid
24
24
  )
25
25
  from deprecated import deprecated
26
26
 
@@ -44,7 +44,7 @@ class ValidationSetBuilder:
44
44
  self.validation_set_id: str | None = None
45
45
  self._rapid_parts: list[ValidatioRapidParts] = []
46
46
 
47
- def create(self) -> RapidataValidationSet:
47
+ def submit(self) -> RapidataValidationSet:
48
48
  """Create the validation set by executing all HTTP requests. This should be the last method called on the builder.
49
49
 
50
50
  Returns:
@@ -79,6 +79,18 @@ class ValidationSetBuilder:
79
79
  )
80
80
 
81
81
  return validation_set
82
+
83
+ @deprecated("Use submit instead")
84
+ def create(self) -> RapidataValidationSet:
85
+ """Create the validation set by executing all HTTP requests. This should be the last method called on the builder.
86
+
87
+ Returns:
88
+ RapidataValidationSet: A RapidataValidationSet instance.
89
+
90
+ Raises:
91
+ ValueError: If the validation set creation fails.
92
+ """
93
+ return self.submit()
82
94
 
83
95
  def add_rapid(self, rapid: Rapid):
84
96
  """Add a rapid to the validation set.
@@ -96,8 +108,8 @@ class ValidationSetBuilder:
96
108
  if isinstance(rapid, CompareRapid):
97
109
  self._add_compare_rapid(rapid.asset, rapid.criteria, rapid.truth, rapid.metadata)
98
110
 
99
- if isinstance(rapid, TranscriptionRapid):
100
- self._add_transcription_rapid(rapid.asset, rapid.instruction, rapid.transcription, rapid.truths, rapid.strict_grading)
111
+ if isinstance(rapid, SelectWordsRapid):
112
+ self._add_select_words_rapid(rapid.asset, rapid.instruction, rapid.text, rapid.truths, rapid.strict_grading)
101
113
 
102
114
  return self
103
115
 
@@ -237,21 +249,21 @@ class ValidationSetBuilder:
237
249
  )
238
250
 
239
251
  @deprecated("Use add_rapid instead")
240
- def add_transcription_rapid(
252
+ def add_select_words_rapid(
241
253
  self,
242
254
  asset: MediaAsset | TextAsset,
243
255
  question: str,
244
- transcription: str,
256
+ select_words: str,
245
257
  truths: list[int],
246
258
  strict_grading: bool | None = None,
247
259
  metadata: list[Metadata] = [],
248
260
  ):
249
- """Add a transcription rapid to the validation set.
261
+ """Add a select words rapid to the validation set.
250
262
 
251
263
  Args:
252
264
  asset (MediaAsset | TextAsset): The asset for the rapid.
253
265
  question (str): The question for the rapid.
254
- transcription (list[str]): The transcription for the rapid.
266
+ select words (list[str]): The select words for the rapid.
255
267
  truths (list[int]): The list of indices of the true word selections.
256
268
  strict_grading (bool | None, optional): The strict grading for the rapid. Defaults to None.
257
269
  metadata (list[Metadata], optional): The metadata for the rapid.
@@ -260,27 +272,27 @@ class ValidationSetBuilder:
260
272
  ValidationSetBuilder: The ValidationSetBuilder instance.
261
273
 
262
274
  Raises:
263
- ValueError: If a correct word is not found in the transcription.
275
+ ValueError: If a correct word is not found in the select words.
264
276
  """
265
- self._add_transcription_rapid(asset, question, transcription, truths, strict_grading, metadata)
277
+ self._add_select_words_rapid(asset, question, select_words, truths, strict_grading, metadata)
266
278
 
267
279
  return self
268
280
 
269
- def _add_transcription_rapid(
281
+ def _add_select_words_rapid(
270
282
  self,
271
283
  asset: MediaAsset | TextAsset,
272
284
  question: str,
273
- transcription: str,
285
+ select_words: str,
274
286
  truths: list[int],
275
287
  strict_grading: bool | None = None,
276
288
  metadata: list[Metadata] = [],
277
289
  ):
278
- """Add a transcription rapid to the validation set.
290
+ """Add a select words rapid to the validation set.
279
291
 
280
292
  Args:
281
293
  asset (MediaAsset | TextAsset): The asset for the rapid.
282
294
  question (str): The question for the rapid.
283
- transcription (list[str]): The transcription for the rapid.
295
+ select words (list[str]): The select words for the rapid.
284
296
  truths (list[int]): The list of indices of the true word selections.
285
297
  strict_grading (bool | None, optional): The strict grading for the rapid. Defaults to None.
286
298
  metadata (list[Metadata], optional): The metadata for the rapid.
@@ -289,11 +301,11 @@ class ValidationSetBuilder:
289
301
  ValidationSetBuilder: The ValidationSetBuilder instance.
290
302
 
291
303
  Raises:
292
- ValueError: If a correct word is not found in the transcription.
304
+ ValueError: If a correct word is not found in the select words.
293
305
  """
294
306
  transcription_words = [
295
307
  TranscriptionWord(word=word, wordIndex=i)
296
- for i, word in enumerate(transcription.split())
308
+ for i, word in enumerate(select_words.split())
297
309
  ]
298
310
 
299
311
  true_words = []
@@ -2,4 +2,4 @@ from .base_metadata import Metadata
2
2
  from .private_text_metadata import PrivateTextMetadata
3
3
  from .public_text_metadata import PublicTextMetadata
4
4
  from .prompt_metadata import PromptMetadata
5
- from .transcription_metadata import TranscriptionMetadata
5
+ from .select_words_metadata import SelectWordsMetadata
@@ -4,16 +4,16 @@ from rapidata.api_client.models.transcription_metadata_input import (
4
4
  from rapidata.rapidata_client.metadata.base_metadata import Metadata
5
5
 
6
6
 
7
- class TranscriptionMetadata(Metadata):
7
+ class SelectWordsMetadata(Metadata):
8
8
 
9
- def __init__(self, transcription: str, identifier: str = "transcription"):
9
+ def __init__(self, select_words: str, identifier: str = "transcription"):
10
10
  super().__init__(identifier=identifier)
11
11
  self.identifier = identifier
12
- self.transcription = transcription
12
+ self.select_words = select_words
13
13
 
14
14
  def to_model(self):
15
15
  return TranscriptionMetadataInput(
16
16
  _t="TranscriptionMetadataInput",
17
17
  identifier=self.identifier,
18
- transcription=self.transcription,
18
+ transcription=self.select_words,
19
19
  )
@@ -0,0 +1,25 @@
1
+ from rapidata.service.openapi_service import OpenAPIService
2
+ from rapidata.rapidata_client.simple_builders.simple_classification_builders import ClassificationQuestionBuilder
3
+ from rapidata.rapidata_client.simple_builders.simple_compare_builders import CompareCriteriaBuilder
4
+ from rapidata.rapidata_client.simple_builders.simple_free_text_builders import FreeTextQuestionBuilder
5
+ from rapidata.rapidata_client.simple_builders.simple_select_words_builders import SelectWordsInstructionBuilder
6
+ from rapidata.rapidata_client.order.rapidata_order_builder import RapidataOrderBuilder
7
+
8
+ class BaseOrderBuilder():
9
+ def __init__(self, openapi_service: OpenAPIService):
10
+ self.openapi_service = openapi_service
11
+
12
+ def classify_order(self, name: str):
13
+ return ClassificationQuestionBuilder(name, self.openapi_service)
14
+
15
+ def compare_order(self, name: str):
16
+ return CompareCriteriaBuilder(name, self.openapi_service)
17
+
18
+ def free_text_order(self, name: str):
19
+ return FreeTextQuestionBuilder(name, self.openapi_service)
20
+
21
+ def select_words_order(self, name: str):
22
+ return SelectWordsInstructionBuilder(name, self.openapi_service)
23
+
24
+ def advanced_order(self, name: str):
25
+ return RapidataOrderBuilder(name, self.openapi_service)
@@ -106,7 +106,7 @@ class RapidataOrder:
106
106
  Returns:
107
107
  The results of the order.
108
108
  """
109
- while self.get_status() not in ["Completed", "Paused", "ManuelReview"]:
109
+ while self.get_status() not in ["Completed", "Paused", "ManuelReview", "Failed"]:
110
110
  sleep(5)
111
111
 
112
112
  try:
@@ -46,8 +46,8 @@ class RapidataOrderBuilder:
46
46
 
47
47
  def __init__(
48
48
  self,
49
- openapi_service: OpenAPIService,
50
49
  name: str,
50
+ openapi_service: OpenAPIService,
51
51
  ):
52
52
  """
53
53
  Initialize the RapidataOrderBuilder.