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

@@ -834,3 +834,257 @@ class ClientApi:
834
834
  )
835
835
 
836
836
 
837
+
838
+
839
+ @validate_call
840
+ def client_set_referrer_post(
841
+ self,
842
+ referrer: Optional[StrictStr] = None,
843
+ _request_timeout: Union[
844
+ None,
845
+ Annotated[StrictFloat, Field(gt=0)],
846
+ Tuple[
847
+ Annotated[StrictFloat, Field(gt=0)],
848
+ Annotated[StrictFloat, Field(gt=0)]
849
+ ]
850
+ ] = None,
851
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
852
+ _content_type: Optional[StrictStr] = None,
853
+ _headers: Optional[Dict[StrictStr, Any]] = None,
854
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
855
+ ) -> None:
856
+ """Sets the referrer for the current customer.
857
+
858
+
859
+ :param referrer:
860
+ :type referrer: str
861
+ :param _request_timeout: timeout setting for this request. If one
862
+ number provided, it will be total request
863
+ timeout. It can also be a pair (tuple) of
864
+ (connection, read) timeouts.
865
+ :type _request_timeout: int, tuple(int, int), optional
866
+ :param _request_auth: set to override the auth_settings for an a single
867
+ request; this effectively ignores the
868
+ authentication in the spec for a single request.
869
+ :type _request_auth: dict, optional
870
+ :param _content_type: force content-type for the request.
871
+ :type _content_type: str, Optional
872
+ :param _headers: set to override the headers for a single
873
+ request; this effectively ignores the headers
874
+ in the spec for a single request.
875
+ :type _headers: dict, optional
876
+ :param _host_index: set to override the host_index for a single
877
+ request; this effectively ignores the host_index
878
+ in the spec for a single request.
879
+ :type _host_index: int, optional
880
+ :return: Returns the result object.
881
+ """ # noqa: E501
882
+
883
+ _param = self._client_set_referrer_post_serialize(
884
+ referrer=referrer,
885
+ _request_auth=_request_auth,
886
+ _content_type=_content_type,
887
+ _headers=_headers,
888
+ _host_index=_host_index
889
+ )
890
+
891
+ _response_types_map: Dict[str, Optional[str]] = {
892
+ '200': None,
893
+ }
894
+ response_data = self.api_client.call_api(
895
+ *_param,
896
+ _request_timeout=_request_timeout
897
+ )
898
+ response_data.read()
899
+ return self.api_client.response_deserialize(
900
+ response_data=response_data,
901
+ response_types_map=_response_types_map,
902
+ ).data
903
+
904
+
905
+ @validate_call
906
+ def client_set_referrer_post_with_http_info(
907
+ self,
908
+ referrer: Optional[StrictStr] = None,
909
+ _request_timeout: Union[
910
+ None,
911
+ Annotated[StrictFloat, Field(gt=0)],
912
+ Tuple[
913
+ Annotated[StrictFloat, Field(gt=0)],
914
+ Annotated[StrictFloat, Field(gt=0)]
915
+ ]
916
+ ] = None,
917
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
918
+ _content_type: Optional[StrictStr] = None,
919
+ _headers: Optional[Dict[StrictStr, Any]] = None,
920
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
921
+ ) -> ApiResponse[None]:
922
+ """Sets the referrer for the current customer.
923
+
924
+
925
+ :param referrer:
926
+ :type referrer: str
927
+ :param _request_timeout: timeout setting for this request. If one
928
+ number provided, it will be total request
929
+ timeout. It can also be a pair (tuple) of
930
+ (connection, read) timeouts.
931
+ :type _request_timeout: int, tuple(int, int), optional
932
+ :param _request_auth: set to override the auth_settings for an a single
933
+ request; this effectively ignores the
934
+ authentication in the spec for a single request.
935
+ :type _request_auth: dict, optional
936
+ :param _content_type: force content-type for the request.
937
+ :type _content_type: str, Optional
938
+ :param _headers: set to override the headers for a single
939
+ request; this effectively ignores the headers
940
+ in the spec for a single request.
941
+ :type _headers: dict, optional
942
+ :param _host_index: set to override the host_index for a single
943
+ request; this effectively ignores the host_index
944
+ in the spec for a single request.
945
+ :type _host_index: int, optional
946
+ :return: Returns the result object.
947
+ """ # noqa: E501
948
+
949
+ _param = self._client_set_referrer_post_serialize(
950
+ referrer=referrer,
951
+ _request_auth=_request_auth,
952
+ _content_type=_content_type,
953
+ _headers=_headers,
954
+ _host_index=_host_index
955
+ )
956
+
957
+ _response_types_map: Dict[str, Optional[str]] = {
958
+ '200': None,
959
+ }
960
+ response_data = self.api_client.call_api(
961
+ *_param,
962
+ _request_timeout=_request_timeout
963
+ )
964
+ response_data.read()
965
+ return self.api_client.response_deserialize(
966
+ response_data=response_data,
967
+ response_types_map=_response_types_map,
968
+ )
969
+
970
+
971
+ @validate_call
972
+ def client_set_referrer_post_without_preload_content(
973
+ self,
974
+ referrer: Optional[StrictStr] = None,
975
+ _request_timeout: Union[
976
+ None,
977
+ Annotated[StrictFloat, Field(gt=0)],
978
+ Tuple[
979
+ Annotated[StrictFloat, Field(gt=0)],
980
+ Annotated[StrictFloat, Field(gt=0)]
981
+ ]
982
+ ] = None,
983
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
984
+ _content_type: Optional[StrictStr] = None,
985
+ _headers: Optional[Dict[StrictStr, Any]] = None,
986
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
987
+ ) -> RESTResponseType:
988
+ """Sets the referrer for the current customer.
989
+
990
+
991
+ :param referrer:
992
+ :type referrer: str
993
+ :param _request_timeout: timeout setting for this request. If one
994
+ number provided, it will be total request
995
+ timeout. It can also be a pair (tuple) of
996
+ (connection, read) timeouts.
997
+ :type _request_timeout: int, tuple(int, int), optional
998
+ :param _request_auth: set to override the auth_settings for an a single
999
+ request; this effectively ignores the
1000
+ authentication in the spec for a single request.
1001
+ :type _request_auth: dict, optional
1002
+ :param _content_type: force content-type for the request.
1003
+ :type _content_type: str, Optional
1004
+ :param _headers: set to override the headers for a single
1005
+ request; this effectively ignores the headers
1006
+ in the spec for a single request.
1007
+ :type _headers: dict, optional
1008
+ :param _host_index: set to override the host_index for a single
1009
+ request; this effectively ignores the host_index
1010
+ in the spec for a single request.
1011
+ :type _host_index: int, optional
1012
+ :return: Returns the result object.
1013
+ """ # noqa: E501
1014
+
1015
+ _param = self._client_set_referrer_post_serialize(
1016
+ referrer=referrer,
1017
+ _request_auth=_request_auth,
1018
+ _content_type=_content_type,
1019
+ _headers=_headers,
1020
+ _host_index=_host_index
1021
+ )
1022
+
1023
+ _response_types_map: Dict[str, Optional[str]] = {
1024
+ '200': None,
1025
+ }
1026
+ response_data = self.api_client.call_api(
1027
+ *_param,
1028
+ _request_timeout=_request_timeout
1029
+ )
1030
+ return response_data.response
1031
+
1032
+
1033
+ def _client_set_referrer_post_serialize(
1034
+ self,
1035
+ referrer,
1036
+ _request_auth,
1037
+ _content_type,
1038
+ _headers,
1039
+ _host_index,
1040
+ ) -> RequestSerialized:
1041
+
1042
+ _host = None
1043
+
1044
+ _collection_formats: Dict[str, str] = {
1045
+ }
1046
+
1047
+ _path_params: Dict[str, str] = {}
1048
+ _query_params: List[Tuple[str, str]] = []
1049
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1050
+ _form_params: List[Tuple[str, str]] = []
1051
+ _files: Dict[
1052
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1053
+ ] = {}
1054
+ _body_params: Optional[bytes] = None
1055
+
1056
+ # process the path parameters
1057
+ # process the query parameters
1058
+ if referrer is not None:
1059
+
1060
+ _query_params.append(('referrer', referrer))
1061
+
1062
+ # process the header parameters
1063
+ # process the form parameters
1064
+ # process the body parameter
1065
+
1066
+
1067
+
1068
+
1069
+ # authentication setting
1070
+ _auth_settings: List[str] = [
1071
+ 'bearer',
1072
+ 'oauth2'
1073
+ ]
1074
+
1075
+ return self.api_client.param_serialize(
1076
+ method='POST',
1077
+ resource_path='/Client/SetReferrer',
1078
+ path_params=_path_params,
1079
+ query_params=_query_params,
1080
+ header_params=_header_params,
1081
+ body=_body_params,
1082
+ post_params=_form_params,
1083
+ files=_files,
1084
+ auth_settings=_auth_settings,
1085
+ collection_formats=_collection_formats,
1086
+ _host=_host,
1087
+ _request_auth=_request_auth
1088
+ )
1089
+
1090
+
@@ -37,6 +37,7 @@ class AggregatorType(str, Enum):
37
37
  TRANSCRIPTION = 'Transcription'
38
38
  SINGLEPOINTLOCATE = 'SinglePointLocate'
39
39
  FREETEXT = 'FreeText'
40
+ SCRUB = 'Scrub'
40
41
 
41
42
  @classmethod
42
43
  def from_json(cls, json_str: str) -> Self:
@@ -57,8 +57,8 @@ class CreateOrderModel(BaseModel):
57
57
  if value is None:
58
58
  return value
59
59
 
60
- if value not in set(['NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText']):
61
- raise ValueError("must be one of enum values ('NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText')")
60
+ if value not in set(['NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText', 'Scrub']):
61
+ raise ValueError("must be one of enum values ('NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText', 'Scrub')")
62
62
  return value
63
63
 
64
64
  model_config = ConfigDict(
@@ -17,8 +17,8 @@ import pprint
17
17
  import re # noqa: F401
18
18
  import json
19
19
 
20
- from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictStr, field_validator
21
- from typing import Any, ClassVar, Dict, List, Optional
20
+ from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional, Union
22
22
  from rapidata.api_client.models.transcription_word import TranscriptionWord
23
23
  from typing import Optional, Set
24
24
  from typing_extensions import Self
@@ -30,7 +30,9 @@ class TranscriptionTruth(BaseModel):
30
30
  t: StrictStr = Field(description="Discriminator value for TranscriptionTruth", alias="_t")
31
31
  correct_words: List[TranscriptionWord] = Field(alias="correctWords")
32
32
  strict_grading: Optional[StrictBool] = Field(default=None, alias="strictGrading")
33
- __properties: ClassVar[List[str]] = ["_t", "correctWords", "strictGrading"]
33
+ required_precision: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="requiredPrecision")
34
+ required_completeness: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, alias="requiredCompleteness")
35
+ __properties: ClassVar[List[str]] = ["_t", "correctWords", "strictGrading", "requiredPrecision", "requiredCompleteness"]
34
36
 
35
37
  @field_validator('t')
36
38
  def t_validate_enum(cls, value):
@@ -85,6 +87,21 @@ class TranscriptionTruth(BaseModel):
85
87
  if _item_correct_words:
86
88
  _items.append(_item_correct_words.to_dict())
87
89
  _dict['correctWords'] = _items
90
+ # set to None if strict_grading (nullable) is None
91
+ # and model_fields_set contains the field
92
+ if self.strict_grading is None and "strict_grading" in self.model_fields_set:
93
+ _dict['strictGrading'] = None
94
+
95
+ # set to None if required_precision (nullable) is None
96
+ # and model_fields_set contains the field
97
+ if self.required_precision is None and "required_precision" in self.model_fields_set:
98
+ _dict['requiredPrecision'] = None
99
+
100
+ # set to None if required_completeness (nullable) is None
101
+ # and model_fields_set contains the field
102
+ if self.required_completeness is None and "required_completeness" in self.model_fields_set:
103
+ _dict['requiredCompleteness'] = None
104
+
88
105
  return _dict
89
106
 
90
107
  @classmethod
@@ -99,7 +116,9 @@ class TranscriptionTruth(BaseModel):
99
116
  _obj = cls.model_validate({
100
117
  "_t": obj.get("_t") if obj.get("_t") is not None else 'TranscriptionTruth',
101
118
  "correctWords": [TranscriptionWord.from_dict(_item) for _item in obj["correctWords"]] if obj.get("correctWords") is not None else None,
102
- "strictGrading": obj.get("strictGrading")
119
+ "strictGrading": obj.get("strictGrading"),
120
+ "requiredPrecision": obj.get("requiredPrecision"),
121
+ "requiredCompleteness": obj.get("requiredCompleteness")
103
122
  })
104
123
  return _obj
105
124
 
@@ -46,8 +46,8 @@ class WorkflowAggregationStepModel(BaseModel):
46
46
  if value is None:
47
47
  return value
48
48
 
49
- if value not in set(['NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText']):
50
- raise ValueError("must be one of enum values ('NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText')")
49
+ if value not in set(['NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText', 'Scrub']):
50
+ raise ValueError("must be one of enum values ('NonCommittal', 'MajorityVote', 'SimpleMatchup', 'LocateCluster', 'Classification', 'Locate', 'BoundingBox', 'Line', 'Transcription', 'SinglePointLocate', 'FreeText', 'Scrub')")
51
51
  return value
52
52
 
53
53
  model_config = ConfigDict(
@@ -78,6 +78,7 @@ Class | Method | HTTP request | Description
78
78
  *ClientApi* | [**client_client_id_delete**](rapidata/api_client/docs/ClientApi.md#client_client_id_delete) | **DELETE** /Client/{clientId} | Deletes a customers client.
79
79
  *ClientApi* | [**client_post**](rapidata/api_client/docs/ClientApi.md#client_post) | **POST** /Client | Creates a new client for the current customer.
80
80
  *ClientApi* | [**client_query_get**](rapidata/api_client/docs/ClientApi.md#client_query_get) | **GET** /Client/Query | Gets the clients for the current customer.
81
+ *ClientApi* | [**client_set_referrer_post**](rapidata/api_client/docs/ClientApi.md#client_set_referrer_post) | **POST** /Client/SetReferrer | Sets the referrer for the current customer.
81
82
  *CocoApi* | [**coco_submit_post**](rapidata/api_client/docs/CocoApi.md#coco_submit_post) | **POST** /Coco/Submit | Creates a new validation set based on a previously uploaded CoCo set.
82
83
  *CocoApi* | [**coco_upload_post**](rapidata/api_client/docs/CocoApi.md#coco_upload_post) | **POST** /Coco/Upload | Uploads a CoCo set to the system.
83
84
  *CompareWorkflowApi* | [**compare_workflow_get_result_overview_get**](rapidata/api_client/docs/CompareWorkflowApi.md#compare_workflow_get_result_overview_get) | **GET** /CompareWorkflow/GetResultOverview | Get the result overview for a compare workflow.
@@ -11,6 +11,8 @@ import re
11
11
  from PIL import Image
12
12
  from tinytag import TinyTag
13
13
  import tempfile
14
+ from pydantic import StrictStr, StrictBytes
15
+
14
16
 
15
17
  class MediaAsset(BaseAsset):
16
18
  """MediaAsset Class
@@ -161,3 +163,10 @@ class MediaAsset(BaseAsset):
161
163
 
162
164
  content = BytesIO(response.content)
163
165
  return content.getvalue()
166
+
167
+ def to_file(self) -> StrictStr | tuple[StrictStr, StrictBytes] | StrictBytes: # types for autogenerated models
168
+ files = []
169
+ if isinstance(self.path, str):
170
+ return self.path
171
+ else: # isinstance(self.path, bytes)
172
+ return (self.name, self.path)
File without changes
@@ -0,0 +1,27 @@
1
+ from rapidata.service.openapi_service import OpenAPIService
2
+ from rapidata.rapidata_client.assets import MediaAsset
3
+ from rapidata.api_client.models.create_demographic_rapid_model import CreateDemographicRapidModel
4
+ from rapidata.api_client.models.classify_payload import ClassifyPayload
5
+
6
+
7
+ class DemographicManager:
8
+ def __init__(self, openapi_service: OpenAPIService):
9
+ self._openapi_service = openapi_service
10
+
11
+ def create_demographic_rapid(self,
12
+ instruction: str,
13
+ answer_options: list[str],
14
+ datapoint: str,
15
+ key: str):
16
+
17
+ media = MediaAsset(path=datapoint)
18
+ model = CreateDemographicRapidModel(
19
+ key=key,
20
+ payload=ClassifyPayload(
21
+ _t="ClassifyPayload",
22
+ possibleCategories=answer_options,
23
+ title=instruction
24
+ )
25
+ )
26
+ self._openapi_service.rapid_api.rapid_create_demographic_rapid_post(model=model, file=[media.to_file()])
27
+
@@ -14,6 +14,7 @@ from rapidata.service.openapi_service import OpenAPIService
14
14
  from concurrent.futures import ThreadPoolExecutor, as_completed
15
15
  from tqdm import tqdm
16
16
 
17
+ from pydantic import StrictBytes, StrictStr
17
18
  from typing import cast, Sequence
18
19
 
19
20
 
@@ -100,17 +101,14 @@ class RapidataDataset:
100
101
  ),
101
102
  )
102
103
 
103
- files: list[tuple[str, bytes] | str] = []
104
+ files: list[tuple[StrictStr, StrictBytes] | StrictStr | StrictBytes] = []
104
105
  for asset in assets:
105
106
  if isinstance(asset, MediaAsset):
106
- if isinstance(asset.path, bytes):
107
- files.append((asset.name, asset.path))
108
- else:
109
- files.append(cast(str, asset.path))
107
+ files.append(asset.to_file())
110
108
 
111
109
  upload_response = self.openapi_service.dataset_api.dataset_create_datapoint_post(
112
110
  model=model,
113
- files=files # type: ignore
111
+ files=files
114
112
  )
115
113
  if upload_response.errors:
116
114
  raise ValueError(f"Error uploading datapoint: {upload_response.errors}")
@@ -4,6 +4,7 @@ from rapidata.rapidata_client.order.rapidata_order_manager import RapidataOrderM
4
4
 
5
5
  from rapidata.rapidata_client.validation.validation_set_manager import ValidationSetManager
6
6
 
7
+ from rapidata.rapidata_client.demographic.demographic_manager import DemographicManager
7
8
 
8
9
  class RapidataClient:
9
10
  """The Rapidata client is the main entry point for interacting with the Rapidata API. It allows you to create orders and validation sets."""
@@ -39,3 +40,5 @@ class RapidataClient:
39
40
  self.order = RapidataOrderManager(openapi_service=self._openapi_service)
40
41
 
41
42
  self.validation = ValidationSetManager(openapi_service=self._openapi_service)
43
+
44
+ self._demographic = DemographicManager(openapi_service=self._openapi_service)
@@ -107,7 +107,14 @@ class ValidationSetBuilder:
107
107
  self.__add_compare_rapid(rapid.asset, rapid.instruction, rapid.truth, rapid.metadata)
108
108
 
109
109
  elif isinstance(rapid, SelectWordsRapid):
110
- self.__add_select_words_rapid(rapid.asset, rapid.instruction, rapid.sentence, rapid.truths, rapid.strict_grading)
110
+ self.__add_select_words_rapid(
111
+ rapid.asset,
112
+ rapid.instruction,
113
+ rapid.sentence,
114
+ rapid.truths,
115
+ rapid.required_precision,
116
+ rapid.required_completeness,
117
+ rapid.metadata)
111
118
 
112
119
  elif isinstance(rapid, LocateRapid):
113
120
  self.__add_locate_rapid(rapid.asset, rapid.instruction, rapid.truths, rapid.metadata)
@@ -213,7 +220,8 @@ class ValidationSetBuilder:
213
220
  instruction: str,
214
221
  select_words: str,
215
222
  truths: list[int],
216
- strict_grading: bool | None = None,
223
+ required_precision: float,
224
+ required_completeness: float,
217
225
  metadata: Sequence[Metadata] = [],
218
226
  ):
219
227
  """Add a select words rapid to the validation set.
@@ -223,7 +231,8 @@ class ValidationSetBuilder:
223
231
  instruction (str): The instruction for the rapid.
224
232
  select words (list[str]): The select words for the rapid.
225
233
  truths (list[int]): The list of indices of the true word selections.
226
- strict_grading (bool | None, optional): The strict grading for the rapid. Defaults to None.
234
+ required_precision (float): The required precision for the rapid (minimum ratio of selected words that are correct).
235
+ required_completeness (float): The required completeness for the rapid (miminum ratio of total correct words selected).
227
236
  metadata (Sequence[Metadata], optional): The metadata for the rapid.
228
237
 
229
238
  Returns:
@@ -251,7 +260,8 @@ class ValidationSetBuilder:
251
260
  model_truth = TranscriptionTruth(
252
261
  _t="TranscriptionTruth",
253
262
  correctWords=true_words,
254
- strictGrading=strict_grading,
263
+ requiredPrecision=required_precision,
264
+ requiredCompleteness=required_completeness,
255
265
  )
256
266
 
257
267
  self._rapid_parts.append(
@@ -70,12 +70,8 @@ class RapidataValidationSet:
70
70
  """
71
71
  files = []
72
72
  for asset in assets:
73
- if isinstance(asset.path, str):
74
- files.append(asset.path)
75
- elif isinstance(asset.path, bytes):
76
- files.append((asset.name, asset.path))
77
- else:
78
- raise ValueError("upload file failed")
73
+ files.append(asset.to_file())
74
+
79
75
  self.__openapi_service.validation_api.validation_add_validation_rapid_post(
80
76
  model=model, files=files
81
77
  )
@@ -55,12 +55,23 @@ class SelectWordsRapid(Rapid):
55
55
  True means that all correct words and no wrong words have to be selected for the rapid to be marked as correct.
56
56
  False means that at least one correct word and no wrong words have to be selected for the rapid to be marked as correct.
57
57
  """
58
- def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, sentence: str, strict_grading: bool):
58
+ def __init__(self, instruction: str, truths: list[int], asset: MediaAsset, sentence: str, required_precision: float, required_completeness: float, metadata: Sequence[Metadata]):
59
+ if not isinstance(truths, list):
60
+ raise ValueError("The truths must be a list of integers.")
61
+ if not all(isinstance(x, int) for x in truths):
62
+ raise ValueError("The truths must be a list of integers.")
63
+ if required_completeness <= 0 or required_completeness > 1:
64
+ raise ValueError("The required completeness must be > 0 and <= 1.")
65
+ if required_precision <= 0 or required_precision > 1:
66
+ raise ValueError("The required precision must be > 0 and <= 1.")
67
+
59
68
  self.instruction = instruction
60
69
  self.truths = truths
61
70
  self.asset = asset
62
71
  self.sentence = sentence
63
- self.strict_grading = strict_grading
72
+ self.required_precision = required_precision
73
+ self.required_completeness = required_completeness
74
+ self.metadata = metadata
64
75
 
65
76
  class LocateRapid(Rapid):
66
77
  """
@@ -91,7 +91,9 @@ class RapidsManager:
91
91
  truths: list[int],
92
92
  datapoint: str,
93
93
  sentence: str,
94
- strict_grading: bool = True,
94
+ required_precision: float = 1,
95
+ required_completeness: float = 1,
96
+ metadata: Sequence[Metadata] = [],
95
97
  ) -> SelectWordsRapid:
96
98
  """Build a select words rapid
97
99
 
@@ -100,9 +102,9 @@ class RapidsManager:
100
102
  truths (list[int]): The indices of the words that are the correct answers.
101
103
  datapoint (str): The asset that the labeler will be selecting words from.
102
104
  sentence (str): The sentence that the labeler will be selecting words from. (split up by spaces)
103
- strict_grading (bool, optional): Whether the grading should be strict or not.
104
- True means that all correct words and no wrong words have to be selected for the rapid to be marked as correct.
105
- False means that at least one correct word and no wrong words have to be selected for the rapid to be marked as correct. Defaults to True.
105
+ required_precision (float): The required precision for the labeler to get the rapid correct (minimum ratio of the words selected that need to be correct). defaults to 1. (no wrong words can be selected)
106
+ required_completeness (float): The required completeness for the labeler to get the rapid correct (miminum ratio of total correct words selected). defaults to 1. (all correct words need to be selected)
107
+ metadata (Sequence[Metadata], optional): The metadata that is attached to the rapid. Defaults to [].
106
108
  """
107
109
 
108
110
  asset = MediaAsset(datapoint)
@@ -112,7 +114,9 @@ class RapidsManager:
112
114
  truths=truths,
113
115
  asset=asset,
114
116
  sentence=sentence,
115
- strict_grading=strict_grading,
117
+ required_precision=required_precision,
118
+ required_completeness=required_completeness,
119
+ metadata=metadata,
116
120
  )
117
121
 
118
122
  def locate_rapid(self,
@@ -149,7 +149,8 @@ class ValidationSetManager:
149
149
  truths: list[list[int]],
150
150
  datapoints: list[str],
151
151
  sentences: list[str],
152
- strict_grading: bool = True,
152
+ required_precision: float = 1.0,
153
+ required_completeness: float = 1.0,
153
154
  print_confirmation: bool = True
154
155
  ) -> RapidataValidationSet:
155
156
  """Create a select words validation set.
@@ -165,9 +166,8 @@ class ValidationSetManager:
165
166
  datapoints (list[str]): The datapoints that will be used for validation.
166
167
  sentences (list[str]): The sentences that will be used for validation. The sentece will be split up by spaces to be selected by the labeler.
167
168
  Must be the same length as datapoints.
168
- strict_grading (bool, optional): Whether to grade strictly. Defaults to True.\n
169
- If True, the labeler must select all correct words to be graded as correct. (and no wrong words)
170
- If False, the labeler must select at least one correct word to be graded as correct. (and no wrong words)
169
+ required_precision (float, optional): The required precision for the labeler to get the rapid correct (minimum ratio of the words selected that need to be correct). Defaults to 1.0 (no wrong word can be selected).
170
+ required_completeness (float, optional): The required completeness for the labeler to get the rapid correct (miminum ratio of total correct words selected). Defaults to 1.0 (all correct words need to be selected).
171
171
  print_confirmation (bool, optional): Whether to print a confirmation message that validation set has been created. Defaults to True.
172
172
  """
173
173
 
@@ -185,7 +185,8 @@ class ValidationSetManager:
185
185
  truths=truths[i],
186
186
  datapoint=datapoints[i],
187
187
  sentence=sentences[i],
188
- strict_grading=strict_grading
188
+ required_precision=required_precision,
189
+ required_completeness=required_completeness
189
190
  )
190
191
  )
191
192
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.2.1
3
+ Version: 2.3.1
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG
@@ -2,7 +2,7 @@ rapidata/__init__.py,sha256=fQDxHG9k8jBQ0Tm5f2XoKZwcEUaAXbUltwsoEXTBXRA,611
2
2
  rapidata/api_client/__init__.py,sha256=sDQWfUMNIuHPtylab64lr3uy1uFfkd0toh5cS-q_Syc,25564
3
3
  rapidata/api_client/api/__init__.py,sha256=h0wnYolEBVduAU_7YBLFnwHcwXgZg_krSgarsWxz4zs,1061
4
4
  rapidata/api_client/api/campaign_api.py,sha256=DxPFqt9F6c9OpXu_Uxhsrib2NVwnbcZFa3Vkrj7cIuA,40474
5
- rapidata/api_client/api/client_api.py,sha256=hJR9NO3YMHE-7SYwFM88p1aBW5qdmkOf7AKdq7-QZ4A,32719
5
+ rapidata/api_client/api/client_api.py,sha256=P--1kvxHhC3mu6VQMgf6DyRV2FyC64-eyHP1X60bBSM,42259
6
6
  rapidata/api_client/api/coco_api.py,sha256=WQKGMJ568P5bcIDLyV8u6NAhp8URSItdY6PSeTgh5Go,23224
7
7
  rapidata/api_client/api/compare_workflow_api.py,sha256=2P5Z1zvlEc6zmrmeSN67l1LONpchz6g0v0olfD8M_o8,12652
8
8
  rapidata/api_client/api/datapoint_api.py,sha256=CdLFVMrVylj2_D6Ll58_4ME604-7mgWCyXF5SpKmyfI,31668
@@ -33,7 +33,7 @@ rapidata/api_client/models/admin_order_model.py,sha256=-QBgxsw7MTOYEjwOnKSndJTCW
33
33
  rapidata/api_client/models/admin_order_model_paged_result.py,sha256=edgeuvJ8yDMjKDB8vYa2YdbO7brdcgj6AMXPQTLeRbc,3494
34
34
  rapidata/api_client/models/age_group.py,sha256=XZLFEKvPveCJOCN0byJ_p1rhbIEsAeETSpUX1gAfWMc,877
35
35
  rapidata/api_client/models/age_user_filter_model.py,sha256=nlJX6bigfRyUcyenNz6oDf6idKwwIpvraYstYVo_Zns,3035
36
- rapidata/api_client/models/aggregator_type.py,sha256=IR1uVYj85BF3OCQoPLjBhmuYmf3qY-8jeVHWnjyLYAk,1073
36
+ rapidata/api_client/models/aggregator_type.py,sha256=XGtJ_CiKVjehno8R2bygna9JL41_qXXgqYoDttbo0KQ,1093
37
37
  rapidata/api_client/models/attach_category_rapid_blueprint.py,sha256=sdPTViyuCnEz4KNnNxIc_sSD0Qv3ux9y6tY4--hGISM,3164
38
38
  rapidata/api_client/models/attach_category_result.py,sha256=xLM9576NxYblinC2bjUGAQ7eAqp8H1YK8i7_zS5S278,3095
39
39
  rapidata/api_client/models/attach_category_truth.py,sha256=XAc0_cCEPP0iNEaak6ihK9_lExQSGboMBIlO6SebU6o,3062
@@ -102,7 +102,7 @@ rapidata/api_client/models/create_independent_workflow_model_workflow_config.py,
102
102
  rapidata/api_client/models/create_independent_workflow_result.py,sha256=JOhS75mAH-VvarvDDFsycahPlIezVKT1upuqIo93hC0,2719
103
103
  rapidata/api_client/models/create_legacy_client_model.py,sha256=8LcKnjv3Lq6w28ku6NG6nG9qfxWQnfPow53maGlwNdE,2802
104
104
  rapidata/api_client/models/create_legacy_order_result.py,sha256=BR1XqPKq9QkDe0UytTW6dpihAeNyfCc4C1m0XfY53hQ,2672
105
- rapidata/api_client/models/create_order_model.py,sha256=FTdioNA4Y0OSu4CCxZ3hZvC4ihL6LqpGLmUc5YChCt0,9119
105
+ rapidata/api_client/models/create_order_model.py,sha256=DYLdYs4sfw0rdgN7g7XIjOUMLQx0dPAi2m1W3pBSDOU,9137
106
106
  rapidata/api_client/models/create_order_model_referee.py,sha256=dxQ9SDiBjFIKYjctVNeiuGvjZwzIa0Q8JpW7iRei00I,5748
107
107
  rapidata/api_client/models/create_order_model_selections_inner.py,sha256=9p9BJKHN3WhRiu-FwWf421COAxeGmm1KkkyDT7UW5uc,8354
108
108
  rapidata/api_client/models/create_order_model_user_filters_inner.py,sha256=ARw0SIa1PXVKts5-L6eGEH-GXZYeR93qDA5k3gphh0U,10299
@@ -308,7 +308,7 @@ rapidata/api_client/models/transcription_metadata_model.py,sha256=hKqGgS8sjqXwvT
308
308
  rapidata/api_client/models/transcription_payload.py,sha256=9_l_B74rb4DQLWxWXjzrAPQhbnumEQrKtmNjPMMIp1A,3638
309
309
  rapidata/api_client/models/transcription_rapid_blueprint.py,sha256=8Cq2SaI1zaoI3LXCPRU8M4eWRCHcwrb99xCuRXYaAoo,3016
310
310
  rapidata/api_client/models/transcription_result.py,sha256=JtZpt6KbrsNOSP9JAhzleApw8dh4sWOxx8sfLz5brIA,3702
311
- rapidata/api_client/models/transcription_truth.py,sha256=09JR6SdR1Osrw0eVdjqwt8nnCfn9COd6UEWBYRw4yPw,3758
311
+ rapidata/api_client/models/transcription_truth.py,sha256=Iinnfff66M6oHB3ygNI44hhf0w88gSBB2DOK5DeWL08,4956
312
312
  rapidata/api_client/models/transcription_word.py,sha256=cX_ExJVYVOhi0z2tyOr15VuMIPdHec-8E48H4DG_DNQ,2621
313
313
  rapidata/api_client/models/translated_prompt_metadata_model.py,sha256=anQhY7nzrWEFqvcoF6Gd28y5-rf0zf9cmyxNHUQRzi0,3434
314
314
  rapidata/api_client/models/translated_string.py,sha256=AeftEOw-sR4sMaQNOPy5iSo38kXmbyMIi7MmpbLvYew,2900
@@ -334,7 +334,7 @@ rapidata/api_client/models/validation_set_model.py,sha256=79-5JwNDk51WtlXO0CHfjn
334
334
  rapidata/api_client/models/validation_set_model_paged_result.py,sha256=KFdXjw6qkzGXLIHYlVSxfSYPpBPHTxEi4e6qGBzCIlk,3518
335
335
  rapidata/api_client/models/validation_set_overview_model.py,sha256=wlrjXg1dmlFmP8rIKDR88pGzpUEg15t8esr63BfYaaE,2693
336
336
  rapidata/api_client/models/validation_set_paged_result.py,sha256=3ch0KcbcH7qn8iJPY90WIiTF_MAIPJxWa3DUNfKwSI0,3477
337
- rapidata/api_client/models/workflow_aggregation_step_model.py,sha256=6LWLE1aY9P5u3YbbMZFcUDrREP8YiYypOw6Wrmxc0gs,4467
337
+ rapidata/api_client/models/workflow_aggregation_step_model.py,sha256=AN7hdOdEay1ZKT_M2lxB4UrDnEQG8N-ri6po4x7vDWs,4485
338
338
  rapidata/api_client/models/workflow_artifact_model.py,sha256=B9fjf2gS-exr0t4ZbIq5OvE_OCnVCuR3o8eqAjnfRC4,3126
339
339
  rapidata/api_client/models/workflow_config_artifact_model.py,sha256=bzPK2eNzizC5ZGw-8kW_8Gvym6jkSyu5gT5OimcakWU,3650
340
340
  rapidata/api_client/models/workflow_config_artifact_model_workflow_config.py,sha256=FVsB4eqUdO5TbHn1u9NEtCt5r-suzGpNafQW43SMJ7k,6768
@@ -343,16 +343,18 @@ rapidata/api_client/models/workflow_split_model.py,sha256=zthOSaUl8dbLhLymLK_lrP
343
343
  rapidata/api_client/models/workflow_split_model_filter_configs_inner.py,sha256=1Fx9uZtztiiAdMXkj7YeCqt7o6VkG9lKf7D7UP_h088,7447
344
344
  rapidata/api_client/models/workflow_state.py,sha256=5LAK1se76RCoozeVB6oxMPb8p_5bhLZJqn7q5fFQWis,850
345
345
  rapidata/api_client/rest.py,sha256=zmCIFQC2l1t-KZcq-TgEm3vco3y_LK6vRm3Q07K-xRI,9423
346
- rapidata/api_client_README.md,sha256=igEl_lLPbOaBwJJVE7IEdS29Nok33nO0edcnv_OFHh0,38372
346
+ rapidata/api_client_README.md,sha256=ggzFrD19E_A4jX9Oz9VfKgmgyz6ywnnA7OwScumZcSU,38558
347
347
  rapidata/rapidata_client/__init__.py,sha256=kkT6FMU4P8rTdYKTJgZNcyptr-Rq1iZmsyLIyRCwpYA,896
348
348
  rapidata/rapidata_client/assets/__init__.py,sha256=hKgrOSn8gJcBSULaf4auYhH1S1N5AfcwIhBSq1BOKwQ,323
349
349
  rapidata/rapidata_client/assets/_base_asset.py,sha256=B2YWH1NgaeYUYHDW3OPpHM_bqawHbH4EjnRCE2BYwiM,298
350
- rapidata/rapidata_client/assets/_media_asset.py,sha256=zVmYb5ETp1vDJ-lY3FnFOByuL5m2WJz9BLN9NCmxchg,5629
350
+ rapidata/rapidata_client/assets/_media_asset.py,sha256=-b4x4q1fAN-pwd07R3QCa_Hl2hgYrTDzTEhUE6unBoU,5968
351
351
  rapidata/rapidata_client/assets/_multi_asset.py,sha256=o4_-OvovADSVpl0tr6fPzRR_gHCcIQKfeZKcoFDFBLo,1667
352
352
  rapidata/rapidata_client/assets/_text_asset.py,sha256=itoe3vicn41LbdJ7UeydImORUo9iDL0SZu-ptOlbMRM,618
353
353
  rapidata/rapidata_client/assets/data_type_enum.py,sha256=ELC-ymeKnQlfNAzfqsI7MmUuRiGYamCHVcTc0qR6Fm4,185
354
354
  rapidata/rapidata_client/country_codes/__init__.py,sha256=FB9Dcks44J6C6YBSYmTmNZ71tE130x6NO_3aLJ8fKzQ,40
355
355
  rapidata/rapidata_client/country_codes/country_codes.py,sha256=ePHqeb7y9DWQZAnddBzPx1puYBcrgUjdR2sbFijuFD8,283
356
+ rapidata/rapidata_client/demographic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
357
+ rapidata/rapidata_client/demographic/demographic_manager.py,sha256=nJLB8xCdyINmzO10QW4KvbXxaL2mdfuEQXcQrguVASw,1090
356
358
  rapidata/rapidata_client/filter/__init__.py,sha256=5V2xc_TiDireub3c4OKkcWi4hCnln2M-q8sGOKKNhX8,350
357
359
  rapidata/rapidata_client/filter/_base_filter.py,sha256=ytiSyeb9dvNZf93zwgb4PRDzf9ebsAu4wHBn4x49Re0,195
358
360
  rapidata/rapidata_client/filter/age_filter.py,sha256=oRjGY65gE_X8oa0D0XRyvKAb4_Z6XOOaGTWykRSfLFA,739
@@ -373,11 +375,11 @@ rapidata/rapidata_client/metadata/_prompt_metadata.py,sha256=lbtUP9lwUHFfrY_MVlq
373
375
  rapidata/rapidata_client/metadata/_public_text_metadata.py,sha256=BWEI8kAk3FivXmK82BEVRqy4R4EU_I9NQUSyBDSd_bs,513
374
376
  rapidata/rapidata_client/metadata/_select_words_metadata.py,sha256=I4qVtCkj60ljkiYfFO0PbRMqjscSMFCMra60a0P2G-Y,728
375
377
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
376
- rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=LxLXVg_d8mhkvifmhity0Miva5cnoePcNfWBl4pjUdo,5392
378
+ rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=t1OFfHXz3Pe0S8qVGdReZm4aGVvxpVWH-VUgfnNtcgQ,5300
377
379
  rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=R4iOWy8nfIHpzqqqQcQhLgpdB8z_tUrkL2M_8rZUw9M,13121
378
380
  rapidata/rapidata_client/order/rapidata_order.py,sha256=ti5fHd-KAvI_WRwe9UWF6QDx-VYzlU_Kqmi44wphJzc,6588
379
381
  rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=0sbQWNHUjwKPTwAB-a_fOeOLuJYK7xl6rAj54BTn2gg,27201
380
- rapidata/rapidata_client/rapidata_client.py,sha256=9SMOouDBwe-aIi9rnPtnL2vrqnlQHDKxOUpw-Eh3Fsg,1782
382
+ rapidata/rapidata_client/rapidata_client.py,sha256=A9mnSX6wzVF9TxS1YH87hTi4jCn75dIuP3KZj5Y_vFg,1957
381
383
  rapidata/rapidata_client/referee/__init__.py,sha256=q0Hv9nmfEpyChejtyMLT8hWKL0vTTf_UgUXPYNJ-H6M,153
382
384
  rapidata/rapidata_client/referee/_base_referee.py,sha256=MdFOhdxt3sRnWXLDKLJZKFdVpjBGn9jypPnWWQ6msQA,496
383
385
  rapidata/rapidata_client/referee/_early_stopping_referee.py,sha256=ULbokQZ91wc9D_20qHUhe55D28D9eTY1J1cMp_-oIDc,2088
@@ -403,13 +405,13 @@ rapidata/rapidata_client/settings/rapidata_settings.py,sha256=Kjxm4GStrpfLKylx84
403
405
  rapidata/rapidata_client/settings/translation_behaviour.py,sha256=i9n_H0eKJyKW6m3MKH_Cm1XEKWVEWsAV_79xGmGIC-4,742
404
406
  rapidata/rapidata_client/validation/__init__.py,sha256=s5wHVtcJkncXSFuL9I0zNwccNOKpWAqxqUjkeohzi2E,24
405
407
  rapidata/rapidata_client/validation/_validation_rapid_parts.py,sha256=U2aHIuCni7FjofcyY-iTeGAOt2r0DztUtiH5Qk_xgpc,2529
406
- rapidata/rapidata_client/validation/_validation_set_builder.py,sha256=0ZdGdWKXVj-i2O15dp6gRYpwIZ67mrY6lyBp0DTy1x4,17593
407
- rapidata/rapidata_client/validation/rapidata_validation_set.py,sha256=Kf4jbJaISB4zC17XfgEvpcshmjkfWrb_TYc9882kTTw,11945
408
+ rapidata/rapidata_client/validation/_validation_set_builder.py,sha256=nOiGumrok_tt8DhmaOIM5fPwkvj_RsLPbbUPnz8Ap8M,18010
409
+ rapidata/rapidata_client/validation/rapidata_validation_set.py,sha256=u0F_FePpDUU_b2aPomjam8-1-zQh6ckEFPePZ6SZZtM,11739
408
410
  rapidata/rapidata_client/validation/rapids/__init__.py,sha256=WU5PPwtTJlte6U90MDakzx4I8Y0laj7siw9teeXj5R0,21
409
411
  rapidata/rapidata_client/validation/rapids/box.py,sha256=t3_Kn6doKXdnJdtbwefXnYKPiTKHneJl9E2inkDSqL8,589
410
- rapidata/rapidata_client/validation/rapids/rapids.py,sha256=guaByk4yxMhWKVSaDSO-Umc3o4LhPAHT8BBI5dhvgdk,5980
411
- rapidata/rapidata_client/validation/rapids/rapids_manager.py,sha256=MxtwnjDIqMfaPsx3438IvXgWLAdejcUx88RZaLWzrXo,7435
412
- rapidata/rapidata_client/validation/validation_set_manager.py,sha256=FRaoaI-hm--jGbhT5_RvpABnnpAPviY0QVyn7f68-LI,19651
412
+ rapidata/rapidata_client/validation/rapids/rapids.py,sha256=rdkdN7Z7oJXJihi7tfs0vb7l5qQxL6gP_tNKuFpc26M,6680
413
+ rapidata/rapidata_client/validation/rapids/rapids_manager.py,sha256=1h8GVdq6UG_aWsAHEFPnwmpTLaApsYoTeUER1hD8TsA,7802
414
+ rapidata/rapidata_client/validation/validation_set_manager.py,sha256=fHfOu3GnrmWZ_0f2l6CjPtGEYt1xR1NZJbykJABpM9M,19897
413
415
  rapidata/rapidata_client/workflow/__init__.py,sha256=eFRx0fm280alXpds6hYcnxN_yERlabF9B5sTdPFsL1g,430
414
416
  rapidata/rapidata_client/workflow/_base_workflow.py,sha256=XyIZFKS_RxAuwIHS848S3AyLEHqd07oTD_5jm2oUbsw,762
415
417
  rapidata/rapidata_client/workflow/_classify_workflow.py,sha256=9bT54wxVJgxC-zLk6MVNbseFpzYrvFPjt7DHvxqYfnk,1736
@@ -425,7 +427,7 @@ rapidata/service/credential_manager.py,sha256=Of0BQs_V1T7rkrWX9groLX790nOknaARwn
425
427
  rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5AnfY14BW8,877
426
428
  rapidata/service/openapi_service.py,sha256=Z4NrAuilLlIWBdGOv6otz36tHS_vvU36w5jmvOUTmqo,3198
427
429
  rapidata/service/token_manager.py,sha256=JZ5YbR5Di8dO3H4kK11d0kzWlrXxjgCmeNkHA4AapCM,6425
428
- rapidata-2.2.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
429
- rapidata-2.2.1.dist-info/METADATA,sha256=GkuSboECcOxKXhk8BXPJKes8cL_YuZDvJXRkQiuQaBk,1107
430
- rapidata-2.2.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
431
- rapidata-2.2.1.dist-info/RECORD,,
430
+ rapidata-2.3.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
431
+ rapidata-2.3.1.dist-info/METADATA,sha256=rxttDNDRggMxYyi1yxbWQP0fK7upUGJe8Nc0e4-CgyA,1107
432
+ rapidata-2.3.1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
433
+ rapidata-2.3.1.dist-info/RECORD,,