rapidata 0.5.1__py3-none-any.whl → 1.1.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.
Files changed (28) hide show
  1. rapidata/__init__.py +3 -0
  2. rapidata/api_client/__init__.py +3 -1
  3. rapidata/api_client/api/validation_api.py +276 -0
  4. rapidata/api_client/models/__init__.py +3 -1
  5. rapidata/api_client/models/add_campaign_model.py +3 -3
  6. rapidata/api_client/models/add_validation_text_rapid_model.py +118 -0
  7. rapidata/api_client/models/capped_selection.py +108 -0
  8. rapidata/api_client/models/capped_selection_selections_inner.py +198 -0
  9. rapidata/api_client/models/create_order_model.py +3 -3
  10. rapidata/api_client_README.md +4 -1
  11. rapidata/rapidata_client/__init__.py +1 -0
  12. rapidata/rapidata_client/assets/__init__.py +8 -0
  13. rapidata/rapidata_client/assets/base_asset.py +11 -0
  14. rapidata/rapidata_client/assets/media_asset.py +33 -0
  15. rapidata/rapidata_client/assets/multi_asset.py +44 -0
  16. rapidata/rapidata_client/assets/text_asset.py +25 -0
  17. rapidata/rapidata_client/dataset/rapidata_dataset.py +4 -4
  18. rapidata/rapidata_client/dataset/rapidata_validation_set.py +54 -27
  19. rapidata/rapidata_client/dataset/validation_rapid_parts.py +4 -1
  20. rapidata/rapidata_client/dataset/validation_set_builder.py +49 -34
  21. rapidata/rapidata_client/order/rapidata_order_builder.py +135 -43
  22. rapidata/rapidata_client/rapidata_client.py +24 -0
  23. rapidata/rapidata_client/simple_builders/simple_classification_builders.py +122 -0
  24. rapidata/rapidata_client/simple_builders/simple_compare_builders.py +86 -0
  25. {rapidata-0.5.1.dist-info → rapidata-1.1.0.dist-info}/METADATA +2 -1
  26. {rapidata-0.5.1.dist-info → rapidata-1.1.0.dist-info}/RECORD +28 -18
  27. {rapidata-0.5.1.dist-info → rapidata-1.1.0.dist-info}/WHEEL +1 -1
  28. {rapidata-0.5.1.dist-info → rapidata-1.1.0.dist-info}/LICENSE +0 -0
@@ -6,6 +6,9 @@ from rapidata.api_client.models.compare_truth import CompareTruth
6
6
  from rapidata.api_client.models.transcription_payload import TranscriptionPayload
7
7
  from rapidata.api_client.models.transcription_truth import TranscriptionTruth
8
8
  from rapidata.api_client.models.transcription_word import TranscriptionWord
9
+ from rapidata.rapidata_client.assets.media_asset import MediaAsset
10
+ from rapidata.rapidata_client.assets.multi_asset import MultiAsset
11
+ from rapidata.rapidata_client.assets.text_asset import TextAsset
9
12
  from rapidata.rapidata_client.dataset.rapidata_validation_set import (
10
13
  RapidataValidationSet,
11
14
  )
@@ -16,21 +19,31 @@ from rapidata.service.openapi_service import OpenAPIService
16
19
 
17
20
  class ValidationSetBuilder:
18
21
  """The ValidationSetBuilder is used to build a validation set.
19
- Give the validation set a name and then add classify, compare or transcription rapid parts to it.
22
+ Give the validation set a name and then add classify, compare, or transcription rapid parts to it.
20
23
  Get a `ValidationSetBuilder` by calling [`rapi.new_validation_set()`](../rapidata_client.md/#rapidata.rapidata_client.rapidata_client.RapidataClient.new_validation_set).
21
24
  """
22
25
 
23
26
  def __init__(self, name: str, openapi_service: OpenAPIService):
27
+ """
28
+ Initialize the ValidationSetBuilder.
29
+
30
+ Args:
31
+ name (str): The name of the validation set.
32
+ openapi_service (OpenAPIService): An instance of OpenAPIService to interact with the API.
33
+ """
24
34
  self.name = name
25
35
  self.openapi_service = openapi_service
26
36
  self.validation_set_id: str | None = None
27
37
  self._rapid_parts: list[ValidatioRapidParts] = []
28
38
 
29
39
  def create(self):
30
- """This creates the validation set by executing all http requests. This should be the last method called on the builder.
40
+ """Create the validation set by executing all HTTP requests. This should be the last method called on the builder.
31
41
 
32
42
  Returns:
33
43
  RapidataValidationSet: A RapidataValidationSet instance.
44
+
45
+ Raises:
46
+ ValueError: If the validation set creation fails.
34
47
  """
35
48
  result = (
36
49
  self.openapi_service.validation_api.validation_create_validation_set_post(
@@ -52,7 +65,7 @@ class ValidationSetBuilder:
52
65
  payload=rapid_part.payload,
53
66
  truths=rapid_part.truths,
54
67
  metadata=rapid_part.metadata,
55
- media_paths=rapid_part.media_paths,
68
+ asset=rapid_part.asset,
56
69
  randomCorrectProbability=rapid_part.randomCorrectProbability,
57
70
  )
58
71
 
@@ -60,7 +73,7 @@ class ValidationSetBuilder:
60
73
 
61
74
  def add_classify_rapid(
62
75
  self,
63
- media_path: str,
76
+ asset: MediaAsset | TextAsset,
64
77
  question: str,
65
78
  categories: list[str],
66
79
  truths: list[str],
@@ -69,14 +82,17 @@ class ValidationSetBuilder:
69
82
  """Add a classify rapid to the validation set.
70
83
 
71
84
  Args:
72
- media_path (str): The path to the media file.
85
+ asset (MediaAsset | TextAsset): The asset for the rapid.
73
86
  question (str): The question for the rapid.
74
87
  categories (list[str]): The list of categories for the rapid.
75
88
  truths (list[str]): The list of truths for the rapid.
76
- metadata (list[Metadata], optional): The metadata for the rapid.
89
+ metadata (list[Metadata], optional): The metadata for the rapid. Defaults to an empty list.
77
90
 
78
91
  Returns:
79
92
  ValidationSetBuilder: The ValidationSetBuilder instance.
93
+
94
+ Raises:
95
+ ValueError: If the lengths of categories and truths are inconsistent.
80
96
  """
81
97
  payload = ClassifyPayload(
82
98
  _t="ClassifyPayload", possibleCategories=categories, title=question
@@ -88,11 +104,11 @@ class ValidationSetBuilder:
88
104
  self._rapid_parts.append(
89
105
  ValidatioRapidParts(
90
106
  question=question,
91
- media_paths=media_path,
92
107
  payload=payload,
93
108
  truths=model_truth,
94
109
  metadata=metadata,
95
110
  randomCorrectProbability=len(truths) / len(categories),
111
+ asset=asset,
96
112
  )
97
113
  )
98
114
 
@@ -100,7 +116,7 @@ class ValidationSetBuilder:
100
116
 
101
117
  def add_compare_rapid(
102
118
  self,
103
- media_paths: list[str],
119
+ asset: MultiAsset,
104
120
  question: str,
105
121
  truth: str,
106
122
  metadata: list[Metadata] = [],
@@ -108,35 +124,33 @@ class ValidationSetBuilder:
108
124
  """Add a compare rapid to the validation set.
109
125
 
110
126
  Args:
111
- media_paths (list[str]): The list of media paths for the rapid.
127
+ asset (MultiAsset): The assets for the rapid.
112
128
  question (str): The question for the rapid.
113
- truth (str): The path to the truth file.
114
- metadata (list[Metadata], optional): The metadata for the rapid.
129
+ truth (str): The truth identifier for the rapid.
130
+ metadata (list[Metadata], optional): The metadata for the rapid. Defaults to an empty list.
115
131
 
116
132
  Returns:
117
133
  ValidationSetBuilder: The ValidationSetBuilder instance.
134
+
135
+ Raises:
136
+ ValueError: If the number of assets is not exactly two.
118
137
  """
119
138
  payload = ComparePayload(_t="ComparePayload", criteria=question)
120
139
  # take only last part of truth path
121
140
  truth = os.path.basename(truth)
122
141
  model_truth = CompareTruth(_t="CompareTruth", winnerId=truth)
123
142
 
124
- if len(media_paths) != 2:
143
+ if len(asset) != 2:
125
144
  raise ValueError("Compare rapid requires exactly two media paths")
126
145
 
127
- # check that files exist
128
- for media_path in media_paths:
129
- if not os.path.exists(media_path):
130
- raise FileNotFoundError(f"File not found: {media_path}")
131
-
132
146
  self._rapid_parts.append(
133
147
  ValidatioRapidParts(
134
148
  question=question,
135
- media_paths=media_paths,
136
149
  payload=payload,
137
150
  truths=model_truth,
138
151
  metadata=metadata,
139
- randomCorrectProbability=1 / len(media_paths),
152
+ randomCorrectProbability=1 / len(asset),
153
+ asset=asset,
140
154
  )
141
155
  )
142
156
 
@@ -144,38 +158,39 @@ class ValidationSetBuilder:
144
158
 
145
159
  def add_transcription_rapid(
146
160
  self,
147
- media_path: str,
161
+ asset: MediaAsset | TextAsset,
148
162
  question: str,
149
- transcription: list[str],
150
- correct_words: list[str],
163
+ transcription: str,
164
+ truths: list[int],
151
165
  strict_grading: bool | None = None,
152
166
  metadata: list[Metadata] = [],
153
167
  ):
154
168
  """Add a transcription rapid to the validation set.
155
169
 
156
170
  Args:
157
- media_path (str): The path to the media file.
171
+ asset (MediaAsset | TextAsset): The asset for the rapid.
158
172
  question (str): The question for the rapid.
159
173
  transcription (list[str]): The transcription for the rapid.
160
- correct_words (list[str]): The list of correct words for the rapid.
174
+ truths (list[int]): The list of indices of the true word selections.
161
175
  strict_grading (bool | None, optional): The strict grading for the rapid. Defaults to None.
162
176
  metadata (list[Metadata], optional): The metadata for the rapid.
163
177
 
164
178
  Returns:
165
179
  ValidationSetBuilder: The ValidationSetBuilder instance.
180
+
181
+ Raises:
182
+ ValueError: If a correct word is not found in the transcription.
166
183
  """
167
184
  transcription_words = [
168
185
  TranscriptionWord(word=word, wordIndex=i)
169
- for i, word in enumerate(transcription)
186
+ for i, word in enumerate(transcription.split())
170
187
  ]
171
188
 
172
- correct_transcription_words = []
173
- for word in correct_words:
174
- if word not in transcription:
175
- raise ValueError(f"Correct word '{word}' not found in transcription")
176
- correct_transcription_words.append(
177
- TranscriptionWord(word=word, wordIndex=transcription.index(word))
178
- )
189
+ true_words = []
190
+ for idx in truths:
191
+ if idx > len(transcription_words) - 1:
192
+ raise ValueError(f"Index {idx} is out of bounds")
193
+ true_words.append(transcription_words[idx])
179
194
 
180
195
  payload = TranscriptionPayload(
181
196
  _t="TranscriptionPayload", title=question, transcription=transcription_words
@@ -183,14 +198,14 @@ class ValidationSetBuilder:
183
198
 
184
199
  model_truth = TranscriptionTruth(
185
200
  _t="TranscriptionTruth",
186
- correctWords=correct_transcription_words,
201
+ correctWords=true_words,
187
202
  strictGrading=strict_grading,
188
203
  )
189
204
 
190
205
  self._rapid_parts.append(
191
206
  ValidatioRapidParts(
192
207
  question=question,
193
- media_paths=media_path,
208
+ asset=asset,
194
209
  payload=payload,
195
210
  truths=model_truth,
196
211
  metadata=metadata,
@@ -1,11 +1,11 @@
1
1
  from rapidata.api_client.models.aggregator_type import AggregatorType
2
+ from rapidata.api_client.models.capped_selection_selections_inner import (
3
+ CappedSelectionSelectionsInner,
4
+ )
2
5
  from rapidata.api_client.models.create_order_model import CreateOrderModel
3
6
  from rapidata.api_client.models.create_order_model_referee import (
4
7
  CreateOrderModelReferee,
5
8
  )
6
- from rapidata.api_client.models.create_order_model_selections_inner import (
7
- CreateOrderModelSelectionsInner,
8
- )
9
9
  from rapidata.api_client.models.create_order_model_user_filters_inner import (
10
10
  CreateOrderModelUserFiltersInner,
11
11
  )
@@ -13,6 +13,9 @@ from rapidata.api_client.models.create_order_model_workflow import (
13
13
  CreateOrderModelWorkflow,
14
14
  )
15
15
  from rapidata.api_client.models.country_user_filter_model import CountryUserFilterModel
16
+ from rapidata.api_client.models.language_user_filter_model import (
17
+ LanguageUserFilterModel,
18
+ )
16
19
  from rapidata.rapidata_client.feature_flags import FeatureFlags
17
20
  from rapidata.rapidata_client.metadata.base_metadata import Metadata
18
21
  from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
@@ -41,6 +44,13 @@ class RapidataOrderBuilder:
41
44
  openapi_service: OpenAPIService,
42
45
  name: str,
43
46
  ):
47
+ """
48
+ Initialize the RapidataOrderBuilder.
49
+
50
+ Args:
51
+ openapi_service (OpenAPIService): The OpenAPIService instance.
52
+ name (str): The name of the order.
53
+ """
44
54
  self._name = name
45
55
  self._openapi_service = openapi_service
46
56
  self._workflow: Workflow | None = None
@@ -51,33 +61,55 @@ class RapidataOrderBuilder:
51
61
  self._validation_set_id: str | None = None
52
62
  self._feature_flags: FeatureFlags | None = None
53
63
  self._country_codes: list[str] | None = None
64
+ self._language_codes: list[str] | None = None
54
65
  self._selections: list[Selection] = []
55
66
  self._rapids_per_bag: int = 2
56
67
  self._priority: int = 50
68
+ self._texts: list[str] | None = None
69
+ self._media_paths: list[str | list[str]] = []
57
70
 
58
71
  def _to_model(self) -> CreateOrderModel:
72
+ """
73
+ Convert the builder configuration to a CreateOrderModel.
74
+
75
+ Raises:
76
+ ValueError: If no workflow is provided.
77
+
78
+ Returns:
79
+ CreateOrderModel: The model representing the order configuration.
80
+ """
59
81
  if self._workflow is None:
60
82
  raise ValueError("You must provide a workflow to create an order.")
61
83
 
62
84
  if self._referee is None:
63
85
  print("No referee provided, using default NaiveReferee.")
64
86
  self._referee = NaiveReferee()
65
- if self._country_codes is None:
66
- country_filter = None
67
- else:
68
- country_filter = CountryUserFilterModel(
69
- _t="CountryFilter", countries=self._country_codes
87
+
88
+ user_filters = []
89
+
90
+ if self._country_codes is not None:
91
+ user_filters.append(
92
+ CreateOrderModelUserFiltersInner(
93
+ CountryUserFilterModel(
94
+ _t="CountryFilter", countries=self._country_codes
95
+ )
96
+ )
97
+ )
98
+
99
+ if self._language_codes is not None:
100
+ user_filters.append(
101
+ CreateOrderModelUserFiltersInner(
102
+ LanguageUserFilterModel(
103
+ _t="LanguageFilter", languages=self._language_codes
104
+ )
105
+ )
70
106
  )
71
107
 
72
108
  return CreateOrderModel(
73
109
  _t="CreateOrderModel",
74
110
  orderName=self._name,
75
111
  workflow=CreateOrderModelWorkflow(self._workflow.to_model()),
76
- userFilters=(
77
- [CreateOrderModelUserFiltersInner(country_filter)]
78
- if country_filter
79
- else []
80
- ),
112
+ userFilters=user_filters,
81
113
  referee=CreateOrderModelReferee(self._referee.to_model()),
82
114
  validationSetId=self._validation_set_id,
83
115
  featureFlags=(
@@ -86,27 +118,34 @@ class RapidataOrderBuilder:
86
118
  else None
87
119
  ),
88
120
  selections=[
89
- CreateOrderModelSelectionsInner(selection.to_model())
121
+ CappedSelectionSelectionsInner(selection.to_model())
90
122
  for selection in self._selections
91
123
  ],
92
124
  priority=self._priority,
93
125
  )
94
126
 
95
- def create(self, submit=True, max_workers=10) -> RapidataOrder:
96
- """Actually makes the API calls to create the order based on how the order builder was configured.
127
+ def create(self, submit: bool = True, max_workers: int = 10) -> RapidataOrder:
128
+ """
129
+ Create the Rapidata order by making the necessary API calls based on the builder's configuration.
97
130
 
98
131
  Args:
99
- submit (bool, optional): Whether to submit the order. Defaults to True.
132
+ submit (bool, optional): Whether to submit the order upon creation. Defaults to True.
133
+ max_workers (int, optional): The maximum number of worker threads for processing media paths. Defaults to 10.
134
+
135
+ Raises:
136
+ ValueError: If both media paths and texts are provided, or if neither is provided.
137
+ AssertionError: If the workflow is a CompareWorkflow and media paths are not in pairs.
100
138
 
101
139
  Returns:
102
140
  RapidataOrder: The created RapidataOrder instance.
103
-
104
- Raises:
105
- ValueError: If no workflow is provided.
106
141
  """
107
142
  order_model = self._to_model()
108
- if isinstance(self._workflow, CompareWorkflow): # temp fix, will be handeled by backend in the future
109
- assert all([len(path) == 2 for path in self._media_paths]), "The media paths must come in pairs for comparison tasks."
143
+ if isinstance(
144
+ self._workflow, CompareWorkflow
145
+ ): # Temporary fix; will be handled by backend in the future
146
+ assert all(
147
+ [len(path) == 2 for path in self._media_paths]
148
+ ), "The media paths must come in pairs for comparison tasks."
110
149
 
111
150
  result = self._openapi_service.order_api.order_create_post(
112
151
  create_order_model=order_model
@@ -120,14 +159,32 @@ class RapidataOrderBuilder:
120
159
  openapi_service=self._openapi_service,
121
160
  )
122
161
 
123
- order.dataset.add_media_from_paths(self._media_paths, self._metadata, max_workers)
162
+ if self._media_paths and self._texts:
163
+ raise ValueError(
164
+ "You cannot provide both media paths and texts to the same order."
165
+ )
166
+
167
+ if not self._media_paths and not self._texts:
168
+ raise ValueError(
169
+ "You must provide either media paths or texts to the order."
170
+ )
171
+
172
+ if self._texts:
173
+ order.dataset.add_texts(self._texts)
174
+
175
+ if self._media_paths:
176
+ order.dataset.add_media_from_paths(
177
+ self._media_paths, self._metadata, max_workers
178
+ )
179
+
124
180
  if submit:
125
181
  order.submit()
126
182
 
127
183
  return order
128
184
 
129
- def workflow(self, workflow: Workflow):
130
- """Set the workflow for the order.
185
+ def workflow(self, workflow: Workflow) -> "RapidataOrderBuilder":
186
+ """
187
+ Set the workflow for the order.
131
188
 
132
189
  Args:
133
190
  workflow (Workflow): The workflow to be set.
@@ -138,8 +195,9 @@ class RapidataOrderBuilder:
138
195
  self._workflow = workflow
139
196
  return self
140
197
 
141
- def referee(self, referee: Referee):
142
- """Set the referee for the order.
198
+ def referee(self, referee: Referee) -> "RapidataOrderBuilder":
199
+ """
200
+ Set the referee for the order.
143
201
 
144
202
  Args:
145
203
  referee (Referee): The referee to be set.
@@ -154,8 +212,9 @@ class RapidataOrderBuilder:
154
212
  self,
155
213
  media_paths: list[str | list[str]],
156
214
  metadata: list[Metadata] | None = None,
157
- ):
158
- """Set the media assets for the order.
215
+ ) -> "RapidataOrderBuilder":
216
+ """
217
+ Set the media assets for the order.
159
218
 
160
219
  Args:
161
220
  media_paths (list[str | list[str]]): The paths of the media assets to be set.
@@ -168,8 +227,22 @@ class RapidataOrderBuilder:
168
227
  self._metadata = metadata
169
228
  return self
170
229
 
171
- def feature_flags(self, feature_flags: FeatureFlags):
172
- """Set the feature flags for the order.
230
+ def texts(self, texts: list[str]) -> "RapidataOrderBuilder":
231
+ """
232
+ Set the TextAssets for the order.
233
+
234
+ Args:
235
+ texts (list[str]): The texts to be set.
236
+
237
+ Returns:
238
+ RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
239
+ """
240
+ self._texts = texts
241
+ return self
242
+
243
+ def feature_flags(self, feature_flags: FeatureFlags) -> "RapidataOrderBuilder":
244
+ """
245
+ Set the feature flags for the order.
173
246
 
174
247
  Args:
175
248
  feature_flags (FeatureFlags): The feature flags to be set.
@@ -180,8 +253,9 @@ class RapidataOrderBuilder:
180
253
  self._feature_flags = feature_flags
181
254
  return self
182
255
 
183
- def country_filter(self, country_codes: list[str]):
184
- """Set the target country codes for the order.
256
+ def country_filter(self, country_codes: list[str]) -> "RapidataOrderBuilder":
257
+ """
258
+ Set the target country codes for the order. E.g. `country_codes=["DE", "CH", "AT"]` for Germany, Switzerland, and Austria.
185
259
 
186
260
  Args:
187
261
  country_codes (list[str]): The country codes to be set.
@@ -192,8 +266,22 @@ class RapidataOrderBuilder:
192
266
  self._country_codes = country_codes
193
267
  return self
194
268
 
195
- def aggregator(self, aggregator: AggregatorType):
196
- """Set the aggregator for the order.
269
+ def language_filter(self, language_codes: list[str]) -> "RapidataOrderBuilder":
270
+ """
271
+ Set the target language codes for the order. E.g. `language_codes=["de", "fr", "it"]` for German, French, and Italian.
272
+
273
+ Args:
274
+ language_codes (list[str]): The language codes to be set.
275
+
276
+ Returns:
277
+ RapidataOrderBuilder: The updated RapidataOrderBuilder instance.
278
+ """
279
+ self._language_codes = language_codes
280
+ return self
281
+
282
+ def aggregator(self, aggregator: AggregatorType) -> "RapidataOrderBuilder":
283
+ """
284
+ Set the aggregator for the order.
197
285
 
198
286
  Args:
199
287
  aggregator (AggregatorType): The aggregator to be set.
@@ -204,8 +292,9 @@ class RapidataOrderBuilder:
204
292
  self._aggregator = aggregator
205
293
  return self
206
294
 
207
- def validation_set_id(self, validation_set_id: str):
208
- """Set the validation set for the order.
295
+ def validation_set_id(self, validation_set_id: str) -> "RapidataOrderBuilder":
296
+ """
297
+ Set the validation set ID for the order.
209
298
 
210
299
  Args:
211
300
  validation_set_id (str): The validation set ID to be set.
@@ -216,8 +305,9 @@ class RapidataOrderBuilder:
216
305
  self._validation_set_id = validation_set_id
217
306
  return self
218
307
 
219
- def rapids_per_bag(self, amount: int):
220
- """Defines the number of tasks a user sees in a single session.
308
+ def rapids_per_bag(self, amount: int) -> "RapidataOrderBuilder":
309
+ """
310
+ Define the number of tasks a user sees in a single session.
221
311
 
222
312
  Args:
223
313
  amount (int): The number of tasks a user sees in a single session.
@@ -230,8 +320,9 @@ class RapidataOrderBuilder:
230
320
  """
231
321
  raise NotImplementedError("Not implemented yet.")
232
322
 
233
- def selections(self, selections: list[Selection]):
234
- """Set the selections for the order.
323
+ def selections(self, selections: list[Selection]) -> "RapidataOrderBuilder":
324
+ """
325
+ Set the selections for the order.
235
326
 
236
327
  Args:
237
328
  selections (list[Selection]): The selections to be set.
@@ -242,8 +333,9 @@ class RapidataOrderBuilder:
242
333
  self._selections = selections
243
334
  return self
244
335
 
245
- def priority(self, priority: int):
246
- """Set the priority for the order.
336
+ def priority(self, priority: int) -> "RapidataOrderBuilder":
337
+ """
338
+ Set the priority for the order.
247
339
 
248
340
  Args:
249
341
  priority (int): The priority to be set.
@@ -8,6 +8,8 @@ from rapidata.service.openapi_service import OpenAPIService
8
8
  from rapidata.rapidata_client.order.rapidata_order import RapidataOrder
9
9
  from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
10
10
 
11
+ from rapidata.rapidata_client.simple_builders.simple_classification_builders import ClassificationQuestionBuilder
12
+ from rapidata.rapidata_client.simple_builders.simple_compare_builders import CompareCriteriaBuilder
11
13
 
12
14
 
13
15
  class RapidataClient:
@@ -81,6 +83,28 @@ class RapidataClient:
81
83
  dataset=temp_dataset,
82
84
  order_id=order_id,
83
85
  openapi_service=self.openapi_service)
86
+
87
+ def create_classify_order(self, name: str) -> ClassificationQuestionBuilder:
88
+ """Create a new classification order where people are asked to classify an image.
89
+
90
+ Args:
91
+ name (str): The name of the order.
92
+
93
+ Returns:
94
+ ClassificationQuestionBuilder: A ClassificationQuestionBuilder instance.
95
+ """
96
+ return ClassificationQuestionBuilder(name=name, openapi_service=self.openapi_service)
97
+
98
+ def create_compare_order(self, name: str) -> CompareCriteriaBuilder:
99
+ """Create a new comparison order where people are asked to compare two images.
100
+
101
+ Args:
102
+ name (str): The name of the order.
103
+
104
+ Returns:
105
+ CompareQuestionBuilder: A CompareQuestionBuilder instance.
106
+ """
107
+ return CompareCriteriaBuilder(name=name, openapi_service=self.openapi_service)
84
108
 
85
109
  @property
86
110
  def utils(self) -> Utils: