rapidata 2.38.0__py3-none-any.whl → 2.39.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 (64) hide show
  1. rapidata/__init__.py +1 -1
  2. rapidata/api_client/__init__.py +4 -5
  3. rapidata/api_client/api/benchmark_api.py +289 -3
  4. rapidata/api_client/api/leaderboard_api.py +35 -1
  5. rapidata/api_client/api/participant_api.py +289 -3
  6. rapidata/api_client/api/validation_set_api.py +119 -400
  7. rapidata/api_client/models/__init__.py +4 -5
  8. rapidata/api_client/models/ab_test_selection_a_inner.py +1 -1
  9. rapidata/api_client/models/compare_workflow_model1.py +1 -8
  10. rapidata/api_client/models/conditional_validation_selection.py +4 -9
  11. rapidata/api_client/models/confidence_interval.py +98 -0
  12. rapidata/api_client/models/create_simple_pipeline_model_pipeline_steps_inner.py +8 -22
  13. rapidata/api_client/models/get_standing_by_id_result.py +7 -2
  14. rapidata/api_client/models/get_validation_set_by_id_result.py +4 -2
  15. rapidata/api_client/models/simple_workflow_model1.py +1 -8
  16. rapidata/api_client/models/standing_by_leaderboard.py +10 -4
  17. rapidata/api_client/models/update_benchmark_model.py +87 -0
  18. rapidata/api_client/models/update_participant_model.py +87 -0
  19. rapidata/api_client/models/update_validation_set_model.py +93 -0
  20. rapidata/api_client/models/validation_chance.py +20 -3
  21. rapidata/api_client/models/validation_set_model.py +5 -42
  22. rapidata/api_client_README.md +7 -7
  23. rapidata/rapidata_client/benchmark/rapidata_benchmark.py +53 -22
  24. rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py +60 -23
  25. rapidata/rapidata_client/config/logging_config.py +1 -1
  26. rapidata/rapidata_client/config/order_config.py +1 -1
  27. rapidata/rapidata_client/config/rapidata_config.py +1 -1
  28. rapidata/rapidata_client/config/upload_config.py +1 -1
  29. rapidata/rapidata_client/datapoints/assets/__init__.py +1 -0
  30. rapidata/rapidata_client/datapoints/assets/_base_asset.py +2 -0
  31. rapidata/rapidata_client/datapoints/assets/_text_asset.py +2 -2
  32. rapidata/rapidata_client/datapoints/assets/data_type_enum.py +1 -1
  33. rapidata/rapidata_client/datapoints/metadata/_media_asset_metadata.py +9 -8
  34. rapidata/rapidata_client/datapoints/metadata/_prompt_metadata.py +1 -2
  35. rapidata/rapidata_client/filter/models/age_group.py +4 -4
  36. rapidata/rapidata_client/filter/models/gender.py +4 -2
  37. rapidata/rapidata_client/filter/rapidata_filters.py +12 -9
  38. rapidata/rapidata_client/referee/__init__.py +1 -1
  39. rapidata/rapidata_client/referee/_base_referee.py +3 -1
  40. rapidata/rapidata_client/referee/_early_stopping_referee.py +2 -2
  41. rapidata/rapidata_client/selection/ab_test_selection.py +7 -3
  42. rapidata/rapidata_client/selection/capped_selection.py +2 -2
  43. rapidata/rapidata_client/selection/conditional_validation_selection.py +12 -6
  44. rapidata/rapidata_client/selection/demographic_selection.py +9 -6
  45. rapidata/rapidata_client/selection/rapidata_selections.py +11 -8
  46. rapidata/rapidata_client/selection/shuffling_selection.py +5 -5
  47. rapidata/rapidata_client/selection/validation_selection.py +9 -5
  48. rapidata/rapidata_client/settings/allow_neither_both.py +1 -0
  49. rapidata/rapidata_client/settings/custom_setting.py +3 -2
  50. rapidata/rapidata_client/settings/models/translation_behaviour_options.py +3 -2
  51. rapidata/rapidata_client/settings/no_shuffle.py +4 -2
  52. rapidata/rapidata_client/settings/play_video_until_the_end.py +7 -4
  53. rapidata/rapidata_client/settings/rapidata_settings.py +4 -3
  54. rapidata/rapidata_client/settings/translation_behaviour.py +7 -5
  55. rapidata/rapidata_client/validation/rapidata_validation_set.py +7 -5
  56. rapidata/rapidata_client/validation/rapids/box.py +3 -1
  57. rapidata/rapidata_client/validation/rapids/rapids_manager.py +174 -141
  58. rapidata/rapidata_client/workflow/__init__.py +1 -1
  59. rapidata/service/__init__.py +1 -1
  60. rapidata/service/local_file_service.py +9 -8
  61. {rapidata-2.38.0.dist-info → rapidata-2.39.0.dist-info}/METADATA +1 -1
  62. {rapidata-2.38.0.dist-info → rapidata-2.39.0.dist-info}/RECORD +64 -60
  63. {rapidata-2.38.0.dist-info → rapidata-2.39.0.dist-info}/LICENSE +0 -0
  64. {rapidata-2.38.0.dist-info → rapidata-2.39.0.dist-info}/WHEEL +0 -0
@@ -3,9 +3,11 @@
3
3
  Defines the BaseAsset class, which serves as the abstract base class for all asset types.
4
4
  """
5
5
 
6
+
6
7
  class BaseAsset:
7
8
  """BaseAsset Class
8
9
 
9
10
  An abstract base class for different types of assets. This class is intended to be subclassed by specific asset types.
10
11
  """
12
+
11
13
  pass
@@ -24,11 +24,11 @@ class TextAsset(BaseAsset):
24
24
  """
25
25
  if not isinstance(text, str):
26
26
  raise ValueError(f"Text must be a string, got {type(text)}")
27
-
27
+
28
28
  self.text = text
29
29
 
30
30
  def __str__(self) -> str:
31
31
  return f"TextAsset(text={self.text})"
32
-
32
+
33
33
  def __repr__(self) -> str:
34
34
  return f"TextAsset(text={self.text})"
@@ -1,6 +1,6 @@
1
1
  class RapidataDataTypes:
2
2
  # deprecated use Literal["media", "text"] instead
3
- MEDIA = "media" # any form of image, video or audio
3
+ MEDIA = "media" # any form of image, video or audio
4
4
  TEXT = "text"
5
5
 
6
6
  @classmethod
@@ -1,7 +1,11 @@
1
- from rapidata.api_client.models.prompt_asset_metadata_input import PromptAssetMetadataInput
1
+ from rapidata.api_client.models.prompt_asset_metadata_input import (
2
+ PromptAssetMetadataInput,
3
+ )
2
4
  from rapidata.api_client.models.url_asset_input import UrlAssetInput
3
5
  from rapidata.rapidata_client.datapoints.metadata._base_metadata import Metadata
4
- from rapidata.api_client.models.prompt_asset_metadata_input_asset import PromptAssetMetadataInputAsset
6
+ from rapidata.api_client.models.prompt_asset_metadata_input_asset import (
7
+ PromptAssetMetadataInputAsset,
8
+ )
5
9
 
6
10
 
7
11
  class MediaAssetMetadata(Metadata):
@@ -12,11 +16,8 @@ class MediaAssetMetadata(Metadata):
12
16
 
13
17
  def to_model(self):
14
18
  return PromptAssetMetadataInput(
15
- _t="PromptAssetMetadataInput",
19
+ _t="PromptAssetMetadataInput",
16
20
  asset=PromptAssetMetadataInputAsset(
17
- actual_instance=UrlAssetInput(
18
- _t="UrlAssetInput",
19
- url=self._url
20
- )
21
- )
21
+ actual_instance=UrlAssetInput(_t="UrlAssetInput", url=self._url)
22
+ ),
22
23
  )
@@ -10,9 +10,8 @@ class PromptMetadata(Metadata):
10
10
 
11
11
  if not isinstance(prompt, str):
12
12
  raise ValueError("Prompt must be a string")
13
-
13
+
14
14
  self._prompt = prompt
15
-
16
15
 
17
16
  def to_model(self):
18
17
  return PromptMetadataInput(_t="PromptMetadataInput", prompt=self._prompt)
@@ -1,11 +1,12 @@
1
1
  from rapidata.api_client.models.age_group import AgeGroup as BackendAgeGroupModel
2
2
  from enum import Enum
3
3
 
4
+
4
5
  class AgeGroup(Enum):
5
6
  """AgeGroup Enum
6
-
7
+
7
8
  Represents the age group of a user. Used to filter who to target based on age groups.
8
-
9
+
9
10
  Attributes:
10
11
  UNDER_18 (AgeGroup): Represents the age group of users under 18.
11
12
  BETWEEN_18_29 (AgeGroup): Represents the age group of users between 18 and 29.
@@ -13,7 +14,7 @@ class AgeGroup(Enum):
13
14
  BETWEEN_40_49 (AgeGroup): Represents the age group of users between 40 and 49.
14
15
  BETWEEN_50_64 (AgeGroup): Represents the age group of users between 50 and 64.
15
16
  OVER_65 (AgeGroup): Represents the age group of users over 65."""
16
-
17
+
17
18
  UNDER_18 = BackendAgeGroupModel.ENUM_0_MINUS_17
18
19
  BETWEEN_18_29 = BackendAgeGroupModel.ENUM_18_MINUS_29
19
20
  BETWEEN_30_39 = BackendAgeGroupModel.ENUM_30_MINUS_39
@@ -23,4 +24,3 @@ class AgeGroup(Enum):
23
24
 
24
25
  def _to_backend_model(self) -> BackendAgeGroupModel:
25
26
  return BackendAgeGroupModel(self.value)
26
-
@@ -1,16 +1,18 @@
1
1
  from enum import Enum
2
2
  from rapidata.api_client.models.gender import Gender as BackendGenderModel
3
3
 
4
+
4
5
  class Gender(Enum):
5
6
  """Gender Enum
6
-
7
+
7
8
  Represents the gender of a user. Used to filter who to target based on genders.
8
-
9
+
9
10
  Attributes:
10
11
  MALE (Gender): Represents the Male gender.
11
12
  FEMALE (Gender): Represents the Female gender.
12
13
  OTHER (Gender): Represents any other gender.
13
14
  """
15
+
14
16
  MALE = BackendGenderModel.MALE
15
17
  FEMALE = BackendGenderModel.FEMALE
16
18
  OTHER = BackendGenderModel.OTHER
@@ -1,12 +1,14 @@
1
1
  from rapidata.rapidata_client.filter import (
2
- AgeFilter,
3
- CountryFilter,
4
- GenderFilter,
5
- LanguageFilter,
2
+ AgeFilter,
3
+ CountryFilter,
4
+ GenderFilter,
5
+ LanguageFilter,
6
6
  UserScoreFilter,
7
7
  NotFilter,
8
8
  OrFilter,
9
- AndFilter)
9
+ AndFilter,
10
+ )
11
+
10
12
 
11
13
  class RapidataFilters:
12
14
  """RapidataFilters Classes
@@ -15,9 +17,9 @@ class RapidataFilters:
15
17
 
16
18
  Note that adding multiple filters to the same order will result in a logical AND operation between the filters.
17
19
 
18
- Warning:
20
+ Warning:
19
21
  This might significantly slow down the number of responses you receive.
20
-
22
+
21
23
  Attributes:
22
24
  user_score (UserScoreFilter): Filters for users with a specific user score.
23
25
  age (AgeFilter): Filters for users with a specific age.
@@ -36,7 +38,7 @@ class RapidataFilters:
36
38
 
37
39
  This ensures the order is only shown to users in the US and Germany whose phones are set to English.
38
40
 
39
- Info:
41
+ Info:
40
42
  The OR, AND and NOT filter support the |, & and ~ operators respectively.
41
43
  The AND is additionally given by the elements in the list.
42
44
 
@@ -47,8 +49,9 @@ class RapidataFilters:
47
49
 
48
50
  This would return users who are not under 18 years old and are from the US or who are from Canada and whose phones are set to English.
49
51
  """
52
+
50
53
  user_score = UserScoreFilter
51
- age = AgeFilter
54
+ age = AgeFilter
52
55
  country = CountryFilter
53
56
  gender = GenderFilter
54
57
  language = LanguageFilter
@@ -1,3 +1,3 @@
1
1
  from ._base_referee import Referee
2
- from ._naive_referee import NaiveReferee #as MaxVoteReferee
2
+ from ._naive_referee import NaiveReferee # as MaxVoteReferee
3
3
  from ._early_stopping_referee import EarlyStoppingReferee
@@ -1,10 +1,12 @@
1
1
  from abc import ABC, abstractmethod
2
2
  from typing import Any, Mapping
3
3
 
4
+
4
5
  class Referee(ABC):
5
6
  """
6
- The referee defines when a rapid is considered complete.
7
+ The referee defines when a rapid is considered complete.
7
8
  """
9
+
8
10
  @abstractmethod
9
11
  def _to_dict(self) -> Mapping[str, str | int | float]:
10
12
  """
@@ -15,7 +15,7 @@ class EarlyStoppingReferee(Referee):
15
15
  The threshold behaves logarithmically, meaning small increments (e.g., from 0.99
16
16
  to 0.999) can significantly impact the stopping criteria.
17
17
 
18
- This referee is supported for the classification and compare tasks (in compare,
18
+ This referee is supported for the classification and compare tasks (in compare,
19
19
  the two options are treated as the categories).
20
20
 
21
21
  Args:
@@ -34,7 +34,7 @@ class EarlyStoppingReferee(Referee):
34
34
  raise ValueError("The threshold must be between 0 and 1.")
35
35
  if max_vote_count < 1:
36
36
  raise ValueError("The number of responses must be greater than 0.")
37
-
37
+
38
38
  self.threshold = threshold
39
39
  self.max_vote_count = max_vote_count
40
40
 
@@ -10,17 +10,21 @@ from typing import Sequence
10
10
 
11
11
  class AbTestSelection(RapidataSelection):
12
12
  """AbTestSelection Class
13
-
13
+
14
14
  Splits the userbase into two segments and serves them a different collection of rapids.
15
15
 
16
16
  Useful for A/B Test.
17
-
17
+
18
18
  Args:
19
19
  a_selections (Sequence[RapidataSelection]): List of selections for group A.
20
20
  b_selections (Sequence[RapidataSelection]): List of selections for group B.
21
21
  """
22
22
 
23
- def __init__(self, a_selections: Sequence[RapidataSelection], b_selections: Sequence[RapidataSelection]):
23
+ def __init__(
24
+ self,
25
+ a_selections: Sequence[RapidataSelection],
26
+ b_selections: Sequence[RapidataSelection],
27
+ ):
24
28
  self.a_selections = a_selections
25
29
  self.b_selections = b_selections
26
30
 
@@ -12,9 +12,9 @@ class CappedSelection(RapidataSelection):
12
12
  """CappedSelection Class
13
13
 
14
14
  Takes in different selections and caps the amount of rapids that can be shown.
15
-
15
+
16
16
  Useful for demographic and conditional validation selections.
17
-
17
+
18
18
  Args:
19
19
  selections (Sequence[RapidataSelection]): List of selections to cap.
20
20
  max_rapids (int): The maximum amount of rapids that can be shown for this selection.
@@ -1,3 +1,4 @@
1
+ from rapidata.rapidata_client.config.logger import logger
1
2
  from rapidata.rapidata_client.selection._base_selection import RapidataSelection
2
3
  from rapidata.api_client.models.conditional_validation_rapid_selection_config import (
3
4
  ValidationChance,
@@ -12,13 +13,13 @@ class ConditionalValidationSelection(RapidataSelection):
12
13
  """Conditional validation selection class.
13
14
 
14
15
  Probabilistically decides how many validation rapids you want to show per session based on the user score.
15
-
16
+
16
17
  Args:
17
18
  validation_set_id (str): The id of the validation set to be used.
18
19
  thresholds (list[float]): The thresholds to use for the user score.
19
20
  chances (list[float]): The chances of showing a validation rapid for each threshold.
20
21
  rapid_counts (list[int]): The amount of validation rapids that will be shown per session of this validation set for each threshold if selected by probability. (all or nothing)
21
- dimension (Optional[str], optional): The dimension of the userScore that will be used in the thresholds. Defaults to None.
22
+ dimensions (Optional[list[str]], optional): The dimensions of the userScore that will be used in the thresholds. Defaults to None.
22
23
 
23
24
  Example:
24
25
  ```python
@@ -29,7 +30,7 @@ class ConditionalValidationSelection(RapidataSelection):
29
30
  rapid_counts=[1, 1]
30
31
  )
31
32
  ```
32
- This means that there's a 100% chance of showing a validation rapid if the user score is between 0 and 0.7,
33
+ This means that there's a 100% chance of showing a validation rapid if the user score is between 0 and 0.7,
33
34
  and a 20% chance of showing a validation rapid if the user score is between 0.7 and 1.
34
35
  """
35
36
 
@@ -40,17 +41,22 @@ class ConditionalValidationSelection(RapidataSelection):
40
41
  chances: list[float],
41
42
  rapid_counts: list[int],
42
43
  dimension: Optional[str] = None,
44
+ dimensions: Optional[list[str]] = None,
43
45
  ):
44
46
  if len(thresholds) != len(chances) or len(thresholds) != len(rapid_counts):
45
47
  raise ValueError(
46
48
  "The lengths of thresholds, chances and rapid_counts must be equal."
47
49
  )
48
-
50
+
51
+ if dimension:
52
+ logger.warning("dimension is deprecated, use dimensions instead")
53
+ dimensions = (dimensions or []) + [dimension]
54
+
49
55
  self.validation_set_id = validation_set_id
50
56
  self.thresholds = thresholds
51
57
  self.chances = chances
52
58
  self.rapid_counts = rapid_counts
53
- self.dimension = dimension
59
+ self.dimensions = dimensions
54
60
 
55
61
  def _to_model(self):
56
62
  return ConditionalValidationSelectionModel(
@@ -64,5 +70,5 @@ class ConditionalValidationSelection(RapidataSelection):
64
70
  self.thresholds, self.chances, self.rapid_counts
65
71
  )
66
72
  ],
67
- dimension=self.dimension,
73
+ dimensions=self.dimensions,
68
74
  )
@@ -1,11 +1,13 @@
1
1
  from rapidata.rapidata_client.selection._base_selection import RapidataSelection
2
- from rapidata.api_client.models.demographic_selection import DemographicSelection as DemographicSelectionModel
2
+ from rapidata.api_client.models.demographic_selection import (
3
+ DemographicSelection as DemographicSelectionModel,
4
+ )
3
5
 
4
6
 
5
7
  class DemographicSelection(RapidataSelection):
6
8
  """Demographic selection class.
7
-
8
- This is used to ask demographic questions in an order.
9
+
10
+ This is used to ask demographic questions in an order.
9
11
 
10
12
  The keys will select the rapids based on the confidence we already saved for each user.
11
13
 
@@ -15,7 +17,7 @@ class DemographicSelection(RapidataSelection):
15
17
  keys (list[str]): List of keys for the demographic rapids to be shown. As an example: "age"
16
18
  max_rapids (int): The maximum number of rapids to run.\n
17
19
  Allows to provide more keys, in case some of the earlier ones are not selected because of high confidence.
18
-
20
+
19
21
  Example:
20
22
  ```python
21
23
  DemographicSelection(["age", "gender"], 1)
@@ -23,11 +25,12 @@ class DemographicSelection(RapidataSelection):
23
25
  This will try to ask the user about their age, if that is not selected due to an already high confidence, it will try asking about their gender.
24
26
  The gender question may also be skipped if the confidence is high enough.
25
27
  """
26
-
27
28
 
28
29
  def __init__(self, keys: list[str], max_rapids: int):
29
30
  self.keys = keys
30
31
  self.max_rapids = max_rapids
31
32
 
32
33
  def _to_model(self):
33
- return DemographicSelectionModel(_t="DemographicSelection", keys=self.keys, maxRapids=self.max_rapids)
34
+ return DemographicSelectionModel(
35
+ _t="DemographicSelection", keys=self.keys, maxRapids=self.max_rapids
36
+ )
@@ -1,15 +1,17 @@
1
1
  from rapidata.rapidata_client.selection import (
2
- DemographicSelection,
3
- LabelingSelection,
4
- ValidationSelection,
5
- ConditionalValidationSelection,
2
+ DemographicSelection,
3
+ LabelingSelection,
4
+ ValidationSelection,
5
+ ConditionalValidationSelection,
6
6
  CappedSelection,
7
- ShufflingSelection)
7
+ ShufflingSelection,
8
+ )
9
+
8
10
 
9
11
  class RapidataSelections:
10
12
  """RapidataSelections Classes
11
13
 
12
- Selections are used to define what type of tasks and in what order they are shown to the user.
14
+ Selections are used to define what type of tasks and in what order they are shown to the user.
13
15
  All selections combined are called a "Session". A session can contain multiple tasks of different types of tasks.
14
16
  As an example, a session might be 1 validation task, 2 labeling tasks.
15
17
 
@@ -20,16 +22,17 @@ class RapidataSelections:
20
22
  demographic (DemographicSelection): Decides if and how many demographic questions you want to show per session.
21
23
  capped (CappedSelection): Takes in different selections and caps the amount of rapids that can be shown.
22
24
  shuffling (ShufflingSelection): Shuffles the selections provided in the list.
23
-
25
+
24
26
  Example:
25
27
  ```python
26
28
  from rapidata import LabelingSelection, ValidationSelection
27
- selections=[ValidationSelection("your-validation-set-id", 1),
29
+ selections=[ValidationSelection("your-validation-set-id", 1),
28
30
  LabelingSelection(2)]
29
31
  ```
30
32
 
31
33
  This will require annotators to complete one validation task followed by two labeling tasks.
32
34
  """
35
+
33
36
  labeling = LabelingSelection
34
37
  validation = ValidationSelection
35
38
  conditional_validation = ConditionalValidationSelection
@@ -1,6 +1,7 @@
1
-
2
1
  from rapidata.api_client.models.ab_test_selection_a_inner import AbTestSelectionAInner
3
- from rapidata.api_client.models.shuffling_selection import ShufflingSelection as ShufflingSelectionModel
2
+ from rapidata.api_client.models.shuffling_selection import (
3
+ ShufflingSelection as ShufflingSelectionModel,
4
+ )
4
5
  from rapidata.rapidata_client.selection._base_selection import RapidataSelection
5
6
 
6
7
  from typing import Sequence
@@ -10,7 +11,7 @@ class ShufflingSelection(RapidataSelection):
10
11
  """ShufflingSelection Class
11
12
 
12
13
  Shuffles the selections provided in the list.
13
-
14
+
14
15
  Args:
15
16
  selections (Sequence[RapidataSelection]): List of selections to shuffle.
16
17
 
@@ -31,6 +32,5 @@ class ShufflingSelection(RapidataSelection):
31
32
  selections=[
32
33
  AbTestSelectionAInner(selection._to_model())
33
34
  for selection in self.selections
34
- ]
35
+ ],
35
36
  )
36
-
@@ -1,5 +1,6 @@
1
-
2
- from rapidata.api_client.models.validation_selection import ValidationSelection as ValidationSelectionModel
1
+ from rapidata.api_client.models.validation_selection import (
2
+ ValidationSelection as ValidationSelectionModel,
3
+ )
3
4
  from rapidata.rapidata_client.selection._base_selection import RapidataSelection
4
5
 
5
6
 
@@ -7,7 +8,7 @@ class ValidationSelection(RapidataSelection):
7
8
  """Validation selection class.
8
9
 
9
10
  Decides how many validation rapids you want to show per session.
10
-
11
+
11
12
  Args:
12
13
  validation_set_id (str): The id of the validation set to be used.
13
14
  amount (int): The amount of validation rapids that will be shown per session of this validation set.
@@ -18,5 +19,8 @@ class ValidationSelection(RapidataSelection):
18
19
  self.amount = amount
19
20
 
20
21
  def _to_model(self):
21
- return ValidationSelectionModel(_t="ValidationSelection", validationSetId=self.validation_set_id, amount=self.amount)
22
-
22
+ return ValidationSelectionModel(
23
+ _t="ValidationSelection",
24
+ validationSetId=self.validation_set_id,
25
+ amount=self.amount,
26
+ )
@@ -1,5 +1,6 @@
1
1
  from rapidata.rapidata_client.settings._rapidata_setting import RapidataSetting
2
2
 
3
+
3
4
  class AllowNeitherBoth(RapidataSetting):
4
5
  """
5
6
  Set whether to allow neither or both options.
@@ -1,9 +1,10 @@
1
1
  from rapidata.rapidata_client.settings._rapidata_setting import RapidataSetting
2
2
 
3
+
3
4
  class CustomSetting(RapidataSetting):
4
5
  """
5
6
  Set a custom setting with the given key and value. Use this to enable features that do not have a dedicated method (yet)
6
-
7
+
7
8
  Args:
8
9
  key (str): The key for the custom setting.
9
10
  value (str): The value for the custom setting.
@@ -12,5 +13,5 @@ class CustomSetting(RapidataSetting):
12
13
  def __init__(self, key: str, value: str):
13
14
  if not isinstance(key, str):
14
15
  raise ValueError("The key must be a string.")
15
-
16
+
16
17
  super().__init__(key=key, value=value)
@@ -1,14 +1,15 @@
1
1
  from enum import Enum
2
2
 
3
+
3
4
  class TranslationBehaviourOptions(Enum):
4
5
  """The options for the translation behaviour setting.
5
-
6
+
6
7
  Attributes:
7
8
  BOTH: Show both the original and the translated text.
8
9
  May clutter the screen if the options are too long.
9
10
  ONLY_ORIGINAL: Show only the original text.
10
11
  ONLY_TRANSLATED: Show only the translated text."""
11
-
12
+
12
13
  BOTH = "both"
13
14
  ONLY_ORIGINAL = "only original"
14
15
  ONLY_TRANSLATED = "only translated"
@@ -1,16 +1,18 @@
1
1
  from rapidata.rapidata_client.settings._rapidata_setting import RapidataSetting
2
2
 
3
+
3
4
  class NoShuffle(RapidataSetting):
4
5
  """
5
6
  Only for classification and compare tasks. If true, the order of the categories / images will not be shuffled and presented in the same order as specified.
6
7
 
7
8
  If this is not added to the order, the shuffling will be active.
8
-
9
+
9
10
  Args:
10
11
  value (bool, optional): Whether to disable shuffling. Defaults to True for function call.
11
12
  """
13
+
12
14
  def __init__(self, value: bool = True):
13
15
  if not isinstance(value, bool):
14
16
  raise ValueError("The value must be a boolean.")
15
-
17
+
16
18
  super().__init__(key="no_shuffle", value=value)
@@ -1,16 +1,19 @@
1
1
  from rapidata.rapidata_client.settings._rapidata_setting import RapidataSetting
2
2
 
3
+
3
4
  class PlayVideoUntilTheEnd(RapidataSetting):
4
5
  """
5
6
  Allows users to only answer once the video has finished playing.
6
7
  The additional time gets added on top of the video duration. Can be negative to allow answers before the video ends.
7
-
8
+
8
9
  Args:
9
10
  additional_time (int, optional): Additional time in milliseconds. Defaults to 0.
10
11
  """
11
-
12
+
12
13
  def __init__(self, additional_time: int = 0):
13
14
  if additional_time < -25000 or additional_time > 25000:
14
15
  raise ValueError("The additional time must be between -25000 and 25000.")
15
-
16
- super().__init__(key="alert_on_fast_response_add_media_duration", value=additional_time)
16
+
17
+ super().__init__(
18
+ key="alert_on_fast_response_add_media_duration", value=additional_time
19
+ )
@@ -5,14 +5,15 @@ from rapidata.rapidata_client.settings import (
5
5
  NoShuffle,
6
6
  PlayVideoUntilTheEnd,
7
7
  AllowNeitherBoth,
8
- )
8
+ )
9
+
9
10
 
10
11
  class RapidataSettings:
11
12
  """
12
13
  Container class for all setting factory functions
13
14
 
14
15
  Settings can be added to an order to determine the behaviour of the task.
15
-
16
+
16
17
  Attributes:
17
18
  alert_on_fast_response (AlertOnFastResponse): Gives an alert as a pop up on the UI when the response time is less than the milliseconds.
18
19
  translation_behaviour (TranslationBehaviour): Defines what's the behaviour of the translation in the UI.
@@ -27,7 +28,7 @@ class RapidataSettings:
27
28
  settings=[FreeTextMinimumCharacters(10)]
28
29
  ```
29
30
 
30
- This can be used in a free text order to set the minimum number of characters required to submit the task.
31
+ This can be used in a free text order to set the minimum number of characters required to submit the task.
31
32
  """
32
33
 
33
34
  alert_on_fast_response = AlertOnFastResponse
@@ -1,18 +1,20 @@
1
- from rapidata.rapidata_client.settings.models.translation_behaviour_options import TranslationBehaviourOptions
1
+ from rapidata.rapidata_client.settings.models.translation_behaviour_options import (
2
+ TranslationBehaviourOptions,
3
+ )
2
4
  from rapidata.rapidata_client.settings._rapidata_setting import RapidataSetting
3
5
 
6
+
4
7
  class TranslationBehaviour(RapidataSetting):
5
8
  """
6
9
  Defines what's the behaviour of the translation in the UI.
7
10
  Will not translate text datapoints or sentences.
8
-
11
+
9
12
  Args:
10
13
  value (TranslationBehaviourOptions): The translation behaviour.
11
14
  """
12
-
15
+
13
16
  def __init__(self, value: TranslationBehaviourOptions):
14
17
  if not isinstance(value, TranslationBehaviourOptions):
15
18
  raise ValueError("The value must be a TranslationBehaviourOptions.")
16
-
17
- super().__init__(key="translation_behaviour", value=value)
18
19
 
20
+ super().__init__(key="translation_behaviour", value=value)
@@ -4,7 +4,9 @@ from colorama import Fore
4
4
  from rapidata.rapidata_client.validation.rapids.rapids import Rapid
5
5
  from rapidata.service.openapi_service import OpenAPIService
6
6
  from rapidata.rapidata_client.config import logger, managed_print, tracer
7
- from rapidata.api_client.models.update_dimensions_model import UpdateDimensionsModel
7
+ from rapidata.api_client.models.update_validation_set_model import (
8
+ UpdateValidationSetModel,
9
+ )
8
10
  from rapidata.api_client.models.update_should_alert_model import UpdateShouldAlertModel
9
11
 
10
12
 
@@ -49,8 +51,8 @@ class RapidataValidationSet:
49
51
  logger.debug(
50
52
  "Updating dimensions for validation set %s to %s", self.id, dimensions
51
53
  )
52
- self.__openapi_service.validation_api.validation_set_validation_set_id_dimensions_put(
53
- self.id, UpdateDimensionsModel(dimensions=dimensions)
54
+ self.__openapi_service.validation_api.validation_set_validation_set_id_patch(
55
+ self.id, UpdateValidationSetModel(dimensions=dimensions)
54
56
  )
55
57
  return self
56
58
 
@@ -67,8 +69,8 @@ class RapidataValidationSet:
67
69
  logger.debug(
68
70
  "Setting shouldAlert for validation set %s to %s", self.id, should_alert
69
71
  )
70
- self.__openapi_service.validation_api.validation_set_validation_set_id_shouldalert_patch(
71
- self.id, UpdateShouldAlertModel(shouldAlert=should_alert)
72
+ self.__openapi_service.validation_api.validation_set_validation_set_id_patch(
73
+ self.id, UpdateValidationSetModel(shouldAlert=should_alert)
72
74
  )
73
75
  return self
74
76