rapidata 1.10.1__py3-none-any.whl → 2.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.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +22 -17
- rapidata/api_client/__init__.py +16 -5
- rapidata/api_client/api/coco_api.py +14 -29
- rapidata/api_client/api/dataset_api.py +6 -6
- rapidata/api_client/api/identity_api.py +3 -3
- rapidata/api_client/api/pipeline_api.py +1008 -95
- rapidata/api_client/api/rapid_api.py +6 -6
- rapidata/api_client/api/validation_api.py +12 -42
- rapidata/api_client/models/__init__.py +16 -5
- rapidata/api_client/models/add_campaign_model.py +5 -5
- rapidata/api_client/models/add_validation_text_rapid_model.py +1 -1
- rapidata/api_client/models/age_group.py +5 -4
- rapidata/api_client/models/base_error.py +1 -4
- rapidata/api_client/models/compare_workflow_config.py +9 -24
- rapidata/api_client/models/compare_workflow_config_model.py +9 -29
- rapidata/api_client/models/compare_workflow_config_model_pair_maker_config.py +140 -0
- rapidata/api_client/models/compare_workflow_config_pair_maker_config.py +140 -0
- rapidata/api_client/models/compare_workflow_model.py +7 -3
- rapidata/api_client/models/compare_workflow_model1.py +7 -3
- rapidata/api_client/models/compare_workflow_model1_pair_maker_information.py +140 -0
- rapidata/api_client/models/compare_workflow_model_pair_maker_config.py +140 -0
- rapidata/api_client/models/create_order_model.py +4 -2
- rapidata/api_client/models/create_order_model_user_filters_inner.py +25 -11
- rapidata/api_client/models/custom_user_filter_model.py +98 -0
- rapidata/api_client/models/file_asset_model_metadata_inner.py +8 -22
- rapidata/api_client/models/get_classify_workflow_result_overview_result.py +144 -0
- rapidata/api_client/models/get_pipeline_by_id_result.py +13 -3
- rapidata/api_client/models/identity_read_bridge_token_get202_response.py +140 -0
- rapidata/api_client/models/not_available_yet_result.py +96 -0
- rapidata/api_client/models/online_pair_maker_config.py +98 -0
- rapidata/api_client/models/online_pair_maker_config_model.py +98 -0
- rapidata/api_client/models/online_pair_maker_information.py +100 -0
- rapidata/api_client/models/pipeline_id_workflow_put_request.py +140 -0
- rapidata/api_client/models/pre_arranged_pair_maker_config.py +100 -0
- rapidata/api_client/models/pre_arranged_pair_maker_config_model.py +96 -0
- rapidata/api_client/models/pre_arranged_pair_maker_information.py +102 -0
- rapidata/api_client/models/read_bridge_token_keys_result.py +11 -2
- rapidata/api_client/models/simple_workflow_config.py +7 -26
- rapidata/api_client/models/simple_workflow_config_model.py +4 -28
- rapidata/api_client/models/simple_workflow_get_result_overview_get200_response.py +16 -16
- rapidata/api_client/models/simple_workflow_model1.py +3 -3
- rapidata/api_client/models/update_campaign_model.py +99 -0
- rapidata/api_client/models/validation_import_post_request_blueprint.py +1 -1
- rapidata/api_client_README.md +21 -7
- rapidata/rapidata_client/__init__.py +20 -10
- rapidata/rapidata_client/assets/__init__.py +5 -4
- rapidata/rapidata_client/assets/{media_asset.py → _media_asset.py} +32 -11
- rapidata/rapidata_client/assets/{multi_asset.py → _multi_asset.py} +1 -1
- rapidata/rapidata_client/assets/{text_asset.py → _text_asset.py} +1 -1
- rapidata/rapidata_client/assets/data_type_enum.py +7 -0
- rapidata/rapidata_client/filter/__init__.py +2 -1
- rapidata/rapidata_client/filter/_base_filter.py +10 -0
- rapidata/rapidata_client/filter/age_filter.py +12 -5
- rapidata/rapidata_client/filter/campaign_filter.py +12 -3
- rapidata/rapidata_client/filter/country_filter.py +10 -3
- rapidata/rapidata_client/filter/custom_filter.py +29 -0
- rapidata/rapidata_client/filter/gender_filter.py +12 -5
- rapidata/rapidata_client/filter/language_filter.py +14 -3
- rapidata/rapidata_client/filter/models/age_group.py +26 -0
- rapidata/rapidata_client/filter/models/gender.py +19 -0
- rapidata/rapidata_client/filter/rapidata_filters.py +35 -0
- rapidata/rapidata_client/filter/user_score_filter.py +20 -4
- rapidata/rapidata_client/metadata/__init__.py +5 -5
- rapidata/rapidata_client/metadata/{base_metadata.py → _base_metadata.py} +2 -1
- rapidata/rapidata_client/metadata/{private_text_metadata.py → _private_text_metadata.py} +2 -2
- rapidata/rapidata_client/metadata/{prompt_metadata.py → _prompt_metadata.py} +3 -2
- rapidata/rapidata_client/metadata/{public_text_metadata.py → _public_text_metadata.py} +2 -2
- rapidata/rapidata_client/metadata/{select_words_metadata.py → _select_words_metadata.py} +3 -2
- rapidata/rapidata_client/{dataset/rapidata_dataset.py → order/_rapidata_dataset.py} +7 -8
- rapidata/rapidata_client/order/_rapidata_order_builder.py +365 -0
- rapidata/rapidata_client/order/rapidata_order.py +50 -32
- rapidata/rapidata_client/order/rapidata_order_manager.py +461 -0
- rapidata/rapidata_client/rapidata_client.py +12 -201
- rapidata/rapidata_client/referee/__init__.py +3 -3
- rapidata/rapidata_client/referee/{base_referee.py → _base_referee.py} +3 -3
- rapidata/rapidata_client/referee/{early_stopping_referee.py → _early_stopping_referee.py} +14 -11
- rapidata/rapidata_client/referee/{naive_referee.py → _naive_referee.py} +9 -9
- rapidata/rapidata_client/selection/__init__.py +1 -1
- rapidata/rapidata_client/{filter/base_filter.py → selection/_base_selection.py} +2 -2
- rapidata/rapidata_client/selection/capped_selection.py +15 -5
- rapidata/rapidata_client/selection/conditional_validation_selection.py +17 -4
- rapidata/rapidata_client/selection/demographic_selection.py +18 -7
- rapidata/rapidata_client/selection/labeling_selection.py +10 -3
- rapidata/rapidata_client/selection/rapidata_selections.py +21 -0
- rapidata/rapidata_client/selection/validation_selection.py +11 -4
- rapidata/rapidata_client/settings/__init__.py +9 -2
- rapidata/rapidata_client/settings/_rapidata_setting.py +11 -0
- rapidata/rapidata_client/settings/alert_on_fast_response.py +21 -0
- rapidata/rapidata_client/settings/custom_setting.py +16 -0
- rapidata/rapidata_client/settings/free_text_minimum_characters.py +16 -0
- rapidata/rapidata_client/settings/models/__init__.py +1 -0
- rapidata/rapidata_client/settings/models/translation_behaviour_options.py +14 -0
- rapidata/rapidata_client/settings/no_shuffle.py +16 -0
- rapidata/rapidata_client/settings/play_video_until_the_end.py +16 -0
- rapidata/rapidata_client/settings/rapidata_settings.py +31 -0
- rapidata/rapidata_client/settings/translation_behaviour.py +18 -0
- rapidata/rapidata_client/validation/__init__.py +1 -0
- rapidata/rapidata_client/{dataset/validation_rapid_parts.py → validation/_validation_rapid_parts.py} +7 -6
- rapidata/rapidata_client/validation/_validation_set_builder.py +371 -0
- rapidata/rapidata_client/{dataset → validation}/rapidata_validation_set.py +54 -50
- rapidata/rapidata_client/validation/rapids/__init__.py +1 -0
- rapidata/rapidata_client/validation/rapids/box.py +17 -0
- rapidata/rapidata_client/validation/rapids/rapids.py +94 -0
- rapidata/rapidata_client/validation/rapids/rapids_manager.py +163 -0
- rapidata/rapidata_client/validation/validation_set_manager.py +338 -0
- rapidata/rapidata_client/workflow/__init__.py +8 -6
- rapidata/rapidata_client/workflow/_base_workflow.py +25 -0
- rapidata/rapidata_client/workflow/{classify_workflow.py → _classify_workflow.py} +6 -6
- rapidata/rapidata_client/workflow/{compare_workflow.py → _compare_workflow.py} +10 -16
- rapidata/rapidata_client/workflow/_draw_workflow.py +22 -0
- rapidata/rapidata_client/workflow/_evaluation_workflow.py +26 -0
- rapidata/rapidata_client/workflow/{free_text_workflow.py → _free_text_workflow.py} +10 -16
- rapidata/rapidata_client/workflow/_locate_workflow.py +22 -0
- rapidata/rapidata_client/workflow/{select_words_workflow.py → _select_words_workflow.py} +2 -8
- rapidata/service/credential_manager.py +11 -1
- rapidata/service/openapi_service.py +23 -4
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/METADATA +2 -1
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/RECORD +122 -96
- rapidata/constants.py +0 -1
- rapidata/rapidata_client/dataset/rapid_builders/__init__.py +0 -4
- rapidata/rapidata_client/dataset/rapid_builders/base_rapid_builder.py +0 -33
- rapidata/rapidata_client/dataset/rapid_builders/classify_rapid_builders.py +0 -166
- rapidata/rapidata_client/dataset/rapid_builders/compare_rapid_builders.py +0 -145
- rapidata/rapidata_client/dataset/rapid_builders/rapids.py +0 -33
- rapidata/rapidata_client/dataset/rapid_builders/select_words_rapid_builders.py +0 -124
- rapidata/rapidata_client/dataset/validation_set_builder.py +0 -336
- rapidata/rapidata_client/order/order_builder.py +0 -25
- rapidata/rapidata_client/order/rapidata_order_builder.py +0 -463
- rapidata/rapidata_client/selection/base_selection.py +0 -9
- rapidata/rapidata_client/settings/feature_flags.py +0 -125
- rapidata/rapidata_client/settings/settings.py +0 -124
- rapidata/rapidata_client/simple_builders/__init__.py +0 -0
- rapidata/rapidata_client/simple_builders/simple_classification_builders.py +0 -271
- rapidata/rapidata_client/simple_builders/simple_compare_builders.py +0 -267
- rapidata/rapidata_client/simple_builders/simple_free_text_builders.py +0 -192
- rapidata/rapidata_client/simple_builders/simple_select_words_builders.py +0 -196
- rapidata/rapidata_client/workflow/base_workflow.py +0 -42
- rapidata/rapidata_client/workflow/evaluation_workflow.py +0 -15
- /rapidata/rapidata_client/assets/{base_asset.py → _base_asset.py} +0 -0
- /rapidata/rapidata_client/{dataset → filter/models}/__init__.py +0 -0
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/LICENSE +0 -0
- {rapidata-1.10.1.dist-info → rapidata-2.1.0.dist-info}/WHEEL +0 -0
rapidata/api_client_README.md
CHANGED
|
@@ -117,9 +117,12 @@ Class | Method | HTTP request | Description
|
|
|
117
117
|
*OrderApi* | [**order_unlock_post**](rapidata/api_client/docs/OrderApi.md#order_unlock_post) | **POST** /Order/Unlock | Unlocks a newly cloned order.
|
|
118
118
|
*OrderApi* | [**order_update_access_put**](rapidata/api_client/docs/OrderApi.md#order_update_access_put) | **PUT** /Order/UpdateAccess | Updates whether an order is public or not.
|
|
119
119
|
*OrderApi* | [**order_update_order_name_put**](rapidata/api_client/docs/OrderApi.md#order_update_order_name_put) | **PUT** /Order/UpdateOrderName | Updates the name of an order.
|
|
120
|
-
*PipelineApi* | [**
|
|
120
|
+
*PipelineApi* | [**pipeline_id_campaign_artifact_id_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_campaign_artifact_id_put) | **PUT** /pipeline/{id}/campaign/{artifact-id} | Updates a specific campaign for a pipeline.
|
|
121
|
+
*PipelineApi* | [**pipeline_id_campaign_post**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_campaign_post) | **POST** /pipeline/{id}/campaign | Adds a campaign to a pipeline.
|
|
122
|
+
*PipelineApi* | [**pipeline_id_campaign_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_campaign_put) | **PUT** /pipeline/{id}/campaign | Updates the default campaign for a pipeline.
|
|
121
123
|
*PipelineApi* | [**pipeline_id_get**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_get) | **GET** /Pipeline/{id} | Gets a pipeline by its id.
|
|
122
|
-
*PipelineApi* | [**
|
|
124
|
+
*PipelineApi* | [**pipeline_id_workflow_artifact_id_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_workflow_artifact_id_put) | **PUT** /pipeline/{id}/workflow/{artifact-id} | Updates the workflow configuration for a pipeline.
|
|
125
|
+
*PipelineApi* | [**pipeline_id_workflow_put**](rapidata/api_client/docs/PipelineApi.md#pipeline_id_workflow_put) | **PUT** /pipeline/{id}/workflow | Updates the workflow configuration for a pipeline.
|
|
123
126
|
*RapidApi* | [**rapid_add_user_guess_post**](rapidata/api_client/docs/RapidApi.md#rapid_add_user_guess_post) | **POST** /Rapid/AddUserGuess | Submits a user guess for a Rapid.
|
|
124
127
|
*RapidApi* | [**rapid_create_demographic_rapid_post**](rapidata/api_client/docs/RapidApi.md#rapid_create_demographic_rapid_post) | **POST** /Rapid/CreateDemographicRapid | Creates a new Demographic Rapid.
|
|
125
128
|
*RapidApi* | [**rapid_query_validation_rapids_get**](rapidata/api_client/docs/RapidApi.md#rapid_query_validation_rapids_get) | **GET** /Rapid/QueryValidationRapids | Queries the validation rapids for a specific validation set.
|
|
@@ -186,10 +189,14 @@ Class | Method | HTTP request | Description
|
|
|
186
189
|
- [CompareTruth](rapidata/api_client/docs/CompareTruth.md)
|
|
187
190
|
- [CompareWorkflowConfig](rapidata/api_client/docs/CompareWorkflowConfig.md)
|
|
188
191
|
- [CompareWorkflowConfigModel](rapidata/api_client/docs/CompareWorkflowConfigModel.md)
|
|
192
|
+
- [CompareWorkflowConfigModelPairMakerConfig](rapidata/api_client/docs/CompareWorkflowConfigModelPairMakerConfig.md)
|
|
193
|
+
- [CompareWorkflowConfigPairMakerConfig](rapidata/api_client/docs/CompareWorkflowConfigPairMakerConfig.md)
|
|
189
194
|
- [CompareWorkflowGetResultOverviewGet200Response](rapidata/api_client/docs/CompareWorkflowGetResultOverviewGet200Response.md)
|
|
190
195
|
- [CompareWorkflowModel](rapidata/api_client/docs/CompareWorkflowModel.md)
|
|
191
196
|
- [CompareWorkflowModel1](rapidata/api_client/docs/CompareWorkflowModel1.md)
|
|
197
|
+
- [CompareWorkflowModel1PairMakerInformation](rapidata/api_client/docs/CompareWorkflowModel1PairMakerInformation.md)
|
|
192
198
|
- [CompareWorkflowModel1Referee](rapidata/api_client/docs/CompareWorkflowModel1Referee.md)
|
|
199
|
+
- [CompareWorkflowModelPairMakerConfig](rapidata/api_client/docs/CompareWorkflowModelPairMakerConfig.md)
|
|
193
200
|
- [CompletedRapidModel](rapidata/api_client/docs/CompletedRapidModel.md)
|
|
194
201
|
- [CompletedRapidModelAsset](rapidata/api_client/docs/CompletedRapidModelAsset.md)
|
|
195
202
|
- [ConditionalValidationSelection](rapidata/api_client/docs/ConditionalValidationSelection.md)
|
|
@@ -217,6 +224,7 @@ Class | Method | HTTP request | Description
|
|
|
217
224
|
- [CreateSimplePipelineModelArtifactsInner](rapidata/api_client/docs/CreateSimplePipelineModelArtifactsInner.md)
|
|
218
225
|
- [CreateSimplePipelineModelPipelineStepsInner](rapidata/api_client/docs/CreateSimplePipelineModelPipelineStepsInner.md)
|
|
219
226
|
- [CreateUnsupportedOrderModel](rapidata/api_client/docs/CreateUnsupportedOrderModel.md)
|
|
227
|
+
- [CustomUserFilterModel](rapidata/api_client/docs/CustomUserFilterModel.md)
|
|
220
228
|
- [Datapoint](rapidata/api_client/docs/Datapoint.md)
|
|
221
229
|
- [DatapointAsset](rapidata/api_client/docs/DatapointAsset.md)
|
|
222
230
|
- [DatapointGetByIdGet200Response](rapidata/api_client/docs/DatapointGetByIdGet200Response.md)
|
|
@@ -230,7 +238,6 @@ Class | Method | HTTP request | Description
|
|
|
230
238
|
- [DemographicSelection](rapidata/api_client/docs/DemographicSelection.md)
|
|
231
239
|
- [EarlyStoppingRefereeModel](rapidata/api_client/docs/EarlyStoppingRefereeModel.md)
|
|
232
240
|
- [EmptyValidationTruth](rapidata/api_client/docs/EmptyValidationTruth.md)
|
|
233
|
-
- [ErrorType](rapidata/api_client/docs/ErrorType.md)
|
|
234
241
|
- [EvaluationWorkflowConfig](rapidata/api_client/docs/EvaluationWorkflowConfig.md)
|
|
235
242
|
- [EvaluationWorkflowModel](rapidata/api_client/docs/EvaluationWorkflowModel.md)
|
|
236
243
|
- [FeatureFlag](rapidata/api_client/docs/FeatureFlag.md)
|
|
@@ -251,8 +258,8 @@ Class | Method | HTTP request | Description
|
|
|
251
258
|
- [FreeTextResult](rapidata/api_client/docs/FreeTextResult.md)
|
|
252
259
|
- [Gender](rapidata/api_client/docs/Gender.md)
|
|
253
260
|
- [GenderUserFilterModel](rapidata/api_client/docs/GenderUserFilterModel.md)
|
|
254
|
-
- [GetAttachCategoryWorkflowResultOverviewResult](rapidata/api_client/docs/GetAttachCategoryWorkflowResultOverviewResult.md)
|
|
255
261
|
- [GetAvailableValidationSetsResult](rapidata/api_client/docs/GetAvailableValidationSetsResult.md)
|
|
262
|
+
- [GetClassifyWorkflowResultOverviewResult](rapidata/api_client/docs/GetClassifyWorkflowResultOverviewResult.md)
|
|
256
263
|
- [GetCompareWorkflowResultOverviewResult](rapidata/api_client/docs/GetCompareWorkflowResultOverviewResult.md)
|
|
257
264
|
- [GetCompareWorkflowResultOverviewSmallResult](rapidata/api_client/docs/GetCompareWorkflowResultOverviewSmallResult.md)
|
|
258
265
|
- [GetDatapointsByDatasetIdResult](rapidata/api_client/docs/GetDatapointsByDatasetIdResult.md)
|
|
@@ -269,6 +276,7 @@ Class | Method | HTTP request | Description
|
|
|
269
276
|
- [GetWorkflowProgressResult](rapidata/api_client/docs/GetWorkflowProgressResult.md)
|
|
270
277
|
- [GetWorkflowResultOverviewResult](rapidata/api_client/docs/GetWorkflowResultOverviewResult.md)
|
|
271
278
|
- [IWorkflowModelPagedResult](rapidata/api_client/docs/IWorkflowModelPagedResult.md)
|
|
279
|
+
- [IdentityReadBridgeTokenGet202Response](rapidata/api_client/docs/IdentityReadBridgeTokenGet202Response.md)
|
|
272
280
|
- [ImageDimensionMetadata](rapidata/api_client/docs/ImageDimensionMetadata.md)
|
|
273
281
|
- [ImageDimensionMetadataModel](rapidata/api_client/docs/ImageDimensionMetadataModel.md)
|
|
274
282
|
- [ImportFromFileResult](rapidata/api_client/docs/ImportFromFileResult.md)
|
|
@@ -306,21 +314,29 @@ Class | Method | HTTP request | Description
|
|
|
306
314
|
- [NamedEntityTruth](rapidata/api_client/docs/NamedEntityTruth.md)
|
|
307
315
|
- [NeverEndingRefereeConfig](rapidata/api_client/docs/NeverEndingRefereeConfig.md)
|
|
308
316
|
- [NewsletterModel](rapidata/api_client/docs/NewsletterModel.md)
|
|
317
|
+
- [NotAvailableYetResult](rapidata/api_client/docs/NotAvailableYetResult.md)
|
|
309
318
|
- [NotStartedRapidModel](rapidata/api_client/docs/NotStartedRapidModel.md)
|
|
310
319
|
- [NullAsset](rapidata/api_client/docs/NullAsset.md)
|
|
311
320
|
- [NullAssetModel](rapidata/api_client/docs/NullAssetModel.md)
|
|
312
321
|
- [NullAssetModel1](rapidata/api_client/docs/NullAssetModel1.md)
|
|
313
322
|
- [NullAssetModel2](rapidata/api_client/docs/NullAssetModel2.md)
|
|
323
|
+
- [OnlinePairMakerConfig](rapidata/api_client/docs/OnlinePairMakerConfig.md)
|
|
324
|
+
- [OnlinePairMakerConfigModel](rapidata/api_client/docs/OnlinePairMakerConfigModel.md)
|
|
325
|
+
- [OnlinePairMakerInformation](rapidata/api_client/docs/OnlinePairMakerInformation.md)
|
|
314
326
|
- [OrderModel](rapidata/api_client/docs/OrderModel.md)
|
|
315
327
|
- [OrderModelPagedResult](rapidata/api_client/docs/OrderModelPagedResult.md)
|
|
316
328
|
- [OrderState](rapidata/api_client/docs/OrderState.md)
|
|
317
329
|
- [OriginalFilenameMetadata](rapidata/api_client/docs/OriginalFilenameMetadata.md)
|
|
318
330
|
- [OriginalFilenameMetadataModel](rapidata/api_client/docs/OriginalFilenameMetadataModel.md)
|
|
319
331
|
- [PageInfo](rapidata/api_client/docs/PageInfo.md)
|
|
332
|
+
- [PipelineIdWorkflowPutRequest](rapidata/api_client/docs/PipelineIdWorkflowPutRequest.md)
|
|
320
333
|
- [PolygonPayload](rapidata/api_client/docs/PolygonPayload.md)
|
|
321
334
|
- [PolygonRapidBlueprint](rapidata/api_client/docs/PolygonRapidBlueprint.md)
|
|
322
335
|
- [PolygonResult](rapidata/api_client/docs/PolygonResult.md)
|
|
323
336
|
- [PolygonTruth](rapidata/api_client/docs/PolygonTruth.md)
|
|
337
|
+
- [PreArrangedPairMakerConfig](rapidata/api_client/docs/PreArrangedPairMakerConfig.md)
|
|
338
|
+
- [PreArrangedPairMakerConfigModel](rapidata/api_client/docs/PreArrangedPairMakerConfigModel.md)
|
|
339
|
+
- [PreArrangedPairMakerInformation](rapidata/api_client/docs/PreArrangedPairMakerInformation.md)
|
|
324
340
|
- [PrivateTextMetadataInput](rapidata/api_client/docs/PrivateTextMetadataInput.md)
|
|
325
341
|
- [ProbabilisticAttachCategoryRefereeConfig](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeConfig.md)
|
|
326
342
|
- [ProblemDetails](rapidata/api_client/docs/ProblemDetails.md)
|
|
@@ -354,7 +370,6 @@ Class | Method | HTTP request | Description
|
|
|
354
370
|
- [SimpleWorkflowGetResultOverviewGet200Response](rapidata/api_client/docs/SimpleWorkflowGetResultOverviewGet200Response.md)
|
|
355
371
|
- [SimpleWorkflowModel](rapidata/api_client/docs/SimpleWorkflowModel.md)
|
|
356
372
|
- [SimpleWorkflowModel1](rapidata/api_client/docs/SimpleWorkflowModel1.md)
|
|
357
|
-
- [SimpleWorkflowModel1Blueprint](rapidata/api_client/docs/SimpleWorkflowModel1Blueprint.md)
|
|
358
373
|
- [SimpleWorkflowModelBlueprint](rapidata/api_client/docs/SimpleWorkflowModelBlueprint.md)
|
|
359
374
|
- [SkipResult](rapidata/api_client/docs/SkipResult.md)
|
|
360
375
|
- [SortCriterion](rapidata/api_client/docs/SortCriterion.md)
|
|
@@ -380,9 +395,8 @@ Class | Method | HTTP request | Description
|
|
|
380
395
|
- [TranslatedString](rapidata/api_client/docs/TranslatedString.md)
|
|
381
396
|
- [UnlockOrderResult](rapidata/api_client/docs/UnlockOrderResult.md)
|
|
382
397
|
- [UpdateAccessModel](rapidata/api_client/docs/UpdateAccessModel.md)
|
|
398
|
+
- [UpdateCampaignModel](rapidata/api_client/docs/UpdateCampaignModel.md)
|
|
383
399
|
- [UpdateOrderModel](rapidata/api_client/docs/UpdateOrderModel.md)
|
|
384
|
-
- [UpdateWorkflowConfigRequest](rapidata/api_client/docs/UpdateWorkflowConfigRequest.md)
|
|
385
|
-
- [UpdateWorkflowConfigRequestConfig](rapidata/api_client/docs/UpdateWorkflowConfigRequestConfig.md)
|
|
386
400
|
- [UploadCocoResult](rapidata/api_client/docs/UploadCocoResult.md)
|
|
387
401
|
- [UploadDatapointsResult](rapidata/api_client/docs/UploadDatapointsResult.md)
|
|
388
402
|
- [UploadFilesFromS3BucketModel](rapidata/api_client/docs/UploadFilesFromS3BucketModel.md)
|
|
@@ -1,10 +1,4 @@
|
|
|
1
1
|
from .rapidata_client import RapidataClient
|
|
2
|
-
from .workflow import (
|
|
3
|
-
ClassifyWorkflow,
|
|
4
|
-
SelectWordsWorkflow,
|
|
5
|
-
CompareWorkflow,
|
|
6
|
-
FreeTextWorkflow,
|
|
7
|
-
)
|
|
8
2
|
from .selection import (
|
|
9
3
|
DemographicSelection,
|
|
10
4
|
LabelingSelection,
|
|
@@ -12,23 +6,39 @@ from .selection import (
|
|
|
12
6
|
ConditionalValidationSelection,
|
|
13
7
|
CappedSelection,
|
|
14
8
|
)
|
|
15
|
-
from .referee import NaiveReferee, EarlyStoppingReferee
|
|
16
9
|
from .metadata import (
|
|
17
10
|
PrivateTextMetadata,
|
|
18
11
|
PublicTextMetadata,
|
|
19
12
|
PromptMetadata,
|
|
20
13
|
SelectWordsMetadata,
|
|
21
14
|
)
|
|
22
|
-
from .settings import
|
|
15
|
+
from .settings import (
|
|
16
|
+
RapidataSettings,
|
|
17
|
+
TranslationBehaviourOptions,
|
|
18
|
+
AlertOnFastResponse,
|
|
19
|
+
TranslationBehaviour,
|
|
20
|
+
FreeTextMinimumCharacters,
|
|
21
|
+
NoShuffle,
|
|
22
|
+
PlayVideoUntilTheEnd,
|
|
23
|
+
CustomSetting,
|
|
24
|
+
)
|
|
23
25
|
from .country_codes import CountryCodes
|
|
24
|
-
from .assets import
|
|
26
|
+
from .assets import (
|
|
27
|
+
MediaAsset,
|
|
28
|
+
TextAsset,
|
|
29
|
+
MultiAsset,
|
|
30
|
+
RapidataDataTypes
|
|
31
|
+
)
|
|
25
32
|
from .filter import (
|
|
26
33
|
CountryFilter,
|
|
27
34
|
LanguageFilter,
|
|
28
35
|
UserScoreFilter,
|
|
29
36
|
CampaignFilter,
|
|
30
37
|
AgeFilter,
|
|
31
|
-
AgeGroup,
|
|
32
38
|
GenderFilter,
|
|
39
|
+
CustomFilter,
|
|
40
|
+
AgeGroup,
|
|
33
41
|
Gender,
|
|
34
42
|
)
|
|
43
|
+
|
|
44
|
+
from .validation import Box
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
This package provides classes for different types of assets, including MediaAsset, TextAsset, and MultiAsset.
|
|
4
4
|
"""
|
|
5
|
-
from .
|
|
6
|
-
from .
|
|
7
|
-
from .
|
|
8
|
-
from .
|
|
5
|
+
from ._base_asset import BaseAsset
|
|
6
|
+
from ._media_asset import MediaAsset
|
|
7
|
+
from ._text_asset import TextAsset
|
|
8
|
+
from ._multi_asset import MultiAsset
|
|
9
|
+
from .data_type_enum import RapidataDataTypes
|
|
@@ -5,9 +5,10 @@ Defines the MediaAsset class for handling media file paths within assets.
|
|
|
5
5
|
|
|
6
6
|
import os
|
|
7
7
|
from io import BytesIO
|
|
8
|
-
from rapidata.rapidata_client.assets.
|
|
8
|
+
from rapidata.rapidata_client.assets._base_asset import BaseAsset
|
|
9
9
|
import requests
|
|
10
10
|
import re
|
|
11
|
+
from PIL import Image
|
|
11
12
|
|
|
12
13
|
class MediaAsset(BaseAsset):
|
|
13
14
|
"""MediaAsset Class
|
|
@@ -41,32 +42,52 @@ class MediaAsset(BaseAsset):
|
|
|
41
42
|
"""
|
|
42
43
|
if not isinstance(path, str):
|
|
43
44
|
raise ValueError("Media must be a string, either a local file path or a URL")
|
|
44
|
-
|
|
45
|
+
|
|
45
46
|
if re.match(r'^https?://', path):
|
|
46
|
-
self.path = self.
|
|
47
|
+
self.path = self.__get_media_bytes(path)
|
|
47
48
|
self.name = path.split('/')[-1]
|
|
48
|
-
|
|
49
|
-
raise ValueError("Supported file types for custom names: jpg, jpeg, png, gif, mp3, mp4")
|
|
49
|
+
self.name = self.__check_name_ending(self.name)
|
|
50
50
|
return
|
|
51
51
|
|
|
52
52
|
if not os.path.exists(path):
|
|
53
53
|
raise FileNotFoundError(f"File not found: {path}")
|
|
54
54
|
|
|
55
|
-
|
|
56
55
|
self.path: str | bytes = path
|
|
57
56
|
self.name = path
|
|
58
|
-
|
|
57
|
+
|
|
58
|
+
def get_image_dimension(self) -> tuple[int, int] | None:
|
|
59
|
+
"""
|
|
60
|
+
Get the dimensions (width, height) of an image file.
|
|
61
|
+
Returns None for non-image files or if dimensions can't be determined.
|
|
62
|
+
"""
|
|
63
|
+
if not any(self.name.lower().endswith(ext) for ext in ('.jpg', '.jpeg', '.png', '.gif', '.webp')):
|
|
64
|
+
return None
|
|
65
|
+
|
|
66
|
+
try:
|
|
67
|
+
if isinstance(self.path, bytes):
|
|
68
|
+
img = Image.open(BytesIO(self.path))
|
|
69
|
+
else:
|
|
70
|
+
img = Image.open(self.path)
|
|
71
|
+
return img.size
|
|
72
|
+
except Exception:
|
|
73
|
+
return None
|
|
74
|
+
|
|
59
75
|
def set_custom_name(self, name: str) -> 'MediaAsset':
|
|
60
76
|
"""Set a custom name for the media asset (only works with URLs)."""
|
|
61
77
|
if isinstance(self.path, bytes):
|
|
62
|
-
|
|
63
|
-
raise ValueError("Supported file types for custom names: jpg, jpeg, png, gif, mp3, mp4")
|
|
64
|
-
self.name = name
|
|
78
|
+
self.name = self.__check_name_ending(name)
|
|
65
79
|
else:
|
|
66
80
|
raise ValueError("Custom name can only be set for URLs.")
|
|
67
81
|
return self
|
|
82
|
+
|
|
83
|
+
def __check_name_ending(self, name: str) -> str:
|
|
84
|
+
"""Check if the media path is valid."""
|
|
85
|
+
if not name.endswith(('.jpg', '.jpeg', '.png', '.gif', '.mp3', '.mp4', '.webp')):
|
|
86
|
+
print("Warning: Supported file types: jpg, jpeg, png, gif, mp3, mp4. Image might not be displayed correctly.")
|
|
87
|
+
name = name + '.jpg'
|
|
88
|
+
return name
|
|
68
89
|
|
|
69
|
-
def
|
|
90
|
+
def __get_media_bytes(self, url: str) -> bytes:
|
|
70
91
|
"""
|
|
71
92
|
Downloads media files from URL and validates type and duration.
|
|
72
93
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Defines the MultiAsset class for handling multiple BaseAsset instances.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from rapidata.rapidata_client.assets.
|
|
6
|
+
from rapidata.rapidata_client.assets._base_asset import BaseAsset
|
|
7
7
|
from rapidata.rapidata_client.assets import MediaAsset, TextAsset
|
|
8
8
|
from typing import Iterator, Sequence
|
|
9
9
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
from .
|
|
1
|
+
from ._base_filter import RapidataFilter
|
|
2
2
|
from .age_filter import AgeFilter, AgeGroup
|
|
3
3
|
from .campaign_filter import CampaignFilter
|
|
4
4
|
from .country_filter import CountryFilter
|
|
5
5
|
from .gender_filter import GenderFilter, Gender
|
|
6
6
|
from .language_filter import LanguageFilter
|
|
7
7
|
from .user_score_filter import UserScoreFilter
|
|
8
|
+
from .custom_filter import CustomFilter
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.age_user_filter_model import AgeUserFilterModel
|
|
4
|
-
from rapidata.
|
|
4
|
+
from rapidata.rapidata_client.filter.models.age_group import AgeGroup
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class AgeFilter(
|
|
7
|
+
class AgeFilter(RapidataFilter):
|
|
8
|
+
"""AgeFilter Class
|
|
9
|
+
|
|
10
|
+
Can be used to filter who to target based on age groups.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
age_groups (list[AgeGroup]): List of age groups to filter by."""
|
|
8
15
|
|
|
9
16
|
def __init__(self, age_groups: list[AgeGroup]):
|
|
10
17
|
self.age_groups = age_groups
|
|
11
18
|
|
|
12
|
-
def
|
|
19
|
+
def _to_model(self):
|
|
13
20
|
return AgeUserFilterModel(
|
|
14
21
|
_t="AgeFilter",
|
|
15
|
-
ageGroups=self.age_groups,
|
|
22
|
+
ageGroups=[age_group._to_backend_model() for age_group in self.age_groups],
|
|
16
23
|
)
|
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.campaign_user_filter_model import (
|
|
4
4
|
CampaignUserFilterModel,
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class CampaignFilter(
|
|
8
|
+
class CampaignFilter(RapidataFilter):
|
|
9
|
+
"""CampaignFilter Class
|
|
10
|
+
|
|
11
|
+
Can be used to filter who to target based on campaign IDs.
|
|
12
|
+
|
|
13
|
+
This filter can only be used when directly in contact with Rapidata.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
campaign_ids (list[str]): List of campaign IDs to filter by.
|
|
17
|
+
"""
|
|
9
18
|
|
|
10
19
|
def __init__(self, campaign_ids: list[str]):
|
|
11
20
|
self.campaign_ids = campaign_ids
|
|
12
21
|
|
|
13
|
-
def
|
|
22
|
+
def _to_model(self):
|
|
14
23
|
return CampaignUserFilterModel(
|
|
15
24
|
_t="CampaignFilter",
|
|
16
25
|
campaignIds=self.campaign_ids,
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.country_user_filter_model import CountryUserFilterModel
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
class CountryFilter(
|
|
6
|
+
class CountryFilter(RapidataFilter):
|
|
7
|
+
"""CountryFilter Class
|
|
8
|
+
|
|
9
|
+
Can be used to filter who to target based on country codes.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
country_codes (list[str]): List of country codes (capizalized) to filter by.
|
|
13
|
+
"""
|
|
7
14
|
|
|
8
15
|
def __init__(self, country_codes: list[str]):
|
|
9
16
|
# check that all characters in the country codes are uppercase
|
|
@@ -15,5 +22,5 @@ class CountryFilter(Filter):
|
|
|
15
22
|
|
|
16
23
|
self.country_codes = country_codes
|
|
17
24
|
|
|
18
|
-
def
|
|
25
|
+
def _to_model(self):
|
|
19
26
|
return CountryUserFilterModel(_t="CountryFilter", countries=self.country_codes)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
|
+
from rapidata.api_client.models.custom_user_filter_model import CustomUserFilterModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CustomFilter(RapidataFilter):
|
|
7
|
+
"""CustomFilter Class
|
|
8
|
+
|
|
9
|
+
Can be used to filter who to target based on custom filters.
|
|
10
|
+
|
|
11
|
+
Ought to be used with contact to Rapidata.
|
|
12
|
+
|
|
13
|
+
Warning: If identifier does not exist, order will not get any responses.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
identifier (str): Identifier of the custom filter.
|
|
17
|
+
values (list[str]): List of values to filter by.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
def __init__(self, identifier: str, values: list[str]):
|
|
21
|
+
self.identifier = identifier
|
|
22
|
+
self.values = values
|
|
23
|
+
|
|
24
|
+
def _to_model(self):
|
|
25
|
+
return CustomUserFilterModel(
|
|
26
|
+
_t="CustomFilter",
|
|
27
|
+
identifier=self.identifier,
|
|
28
|
+
values=self.values,
|
|
29
|
+
)
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.gender_user_filter_model import GenderUserFilterModel
|
|
4
|
-
from rapidata.
|
|
4
|
+
from rapidata.rapidata_client.filter.models.gender import Gender
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class GenderFilter(
|
|
7
|
+
class GenderFilter(RapidataFilter):
|
|
8
|
+
"""GenderFilter Class
|
|
9
|
+
|
|
10
|
+
Can be used to filter who to target based on their gender.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Args:
|
|
14
|
+
genders (list[Gender]): List of genders to filter by."""
|
|
8
15
|
|
|
9
16
|
def __init__(self, genders: list[Gender]):
|
|
10
17
|
self.genders = genders
|
|
11
18
|
|
|
12
|
-
def
|
|
19
|
+
def _to_model(self):
|
|
13
20
|
return GenderUserFilterModel(
|
|
14
21
|
_t="GenderFilter",
|
|
15
|
-
genders=self.genders,
|
|
22
|
+
genders=[gender._to_backend_model() for gender in self.genders],
|
|
16
23
|
)
|
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.language_user_filter_model import (
|
|
4
4
|
LanguageUserFilterModel,
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class LanguageFilter(
|
|
8
|
+
class LanguageFilter(RapidataFilter):
|
|
9
|
+
"""LanguageFilter Class
|
|
10
|
+
|
|
11
|
+
Can be used to filter who to target based on language codes.
|
|
12
|
+
|
|
13
|
+
example: LanguageFilter(["en", "de"]) -> will limit the order to be shown to only people who have their phone set to english or german
|
|
9
14
|
|
|
15
|
+
Args:
|
|
16
|
+
language_codes (list[str]): List of language codes to filter by."""
|
|
10
17
|
def __init__(self, language_codes: list[str]):
|
|
11
18
|
if not isinstance(language_codes, list):
|
|
12
19
|
raise ValueError("Language codes must be a list")
|
|
@@ -14,8 +21,12 @@ class LanguageFilter(Filter):
|
|
|
14
21
|
# check that all characters in the language codes are lowercase
|
|
15
22
|
if not all([code.islower() for code in language_codes]):
|
|
16
23
|
raise ValueError("Language codes must be lowercase")
|
|
24
|
+
|
|
25
|
+
for code in language_codes:
|
|
26
|
+
if not len(code) == 2:
|
|
27
|
+
raise ValueError("Language codes must be two characters long")
|
|
17
28
|
|
|
18
29
|
self.languages = language_codes
|
|
19
30
|
|
|
20
|
-
def
|
|
31
|
+
def _to_model(self):
|
|
21
32
|
return LanguageUserFilterModel(_t="LanguageFilter", languages=self.languages)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from rapidata.api_client.models.age_group import AgeGroup as BackendAgeGroupModel
|
|
2
|
+
from enum import Enum
|
|
3
|
+
|
|
4
|
+
class AgeGroup(Enum):
|
|
5
|
+
"""AgeGroup Enum
|
|
6
|
+
|
|
7
|
+
Represents the age group of a user. Used to filter who to target based on age groups.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
UNDER_18 (AgeGroup): Represents the age group of users under 18.
|
|
11
|
+
BETWEEN_18_29 (AgeGroup): Represents the age group of users between 18 and 29.
|
|
12
|
+
BETWEEN_30_39 (AgeGroup): Represents the age group of users between 30 and 39.
|
|
13
|
+
BETWEEN_40_49 (AgeGroup): Represents the age group of users between 40 and 49.
|
|
14
|
+
BETWEEN_50_64 (AgeGroup): Represents the age group of users between 50 and 64.
|
|
15
|
+
OVER_65 (AgeGroup): Represents the age group of users over 65."""
|
|
16
|
+
|
|
17
|
+
UNDER_18 = BackendAgeGroupModel.ENUM_0_MINUS_17
|
|
18
|
+
BETWEEN_18_29 = BackendAgeGroupModel.ENUM_18_MINUS_29
|
|
19
|
+
BETWEEN_30_39 = BackendAgeGroupModel.ENUM_30_MINUS_39
|
|
20
|
+
BETWEEN_40_49 = BackendAgeGroupModel.ENUM_40_MINUS_49
|
|
21
|
+
BETWEEN_50_64 = BackendAgeGroupModel.ENUM_50_MINUS_64
|
|
22
|
+
OVER_65 = BackendAgeGroupModel.ENUM_65_PLUS
|
|
23
|
+
|
|
24
|
+
def _to_backend_model(self) -> BackendAgeGroupModel:
|
|
25
|
+
return BackendAgeGroupModel(self.value)
|
|
26
|
+
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from enum import Enum
|
|
2
|
+
from rapidata.api_client.models.gender import Gender as BackendGenderModel
|
|
3
|
+
|
|
4
|
+
class Gender(Enum):
|
|
5
|
+
"""Gender Enum
|
|
6
|
+
|
|
7
|
+
Represents the gender of a user. Used to filter who to target based on genders.
|
|
8
|
+
|
|
9
|
+
Attributes:
|
|
10
|
+
MALE (Gender): Represents the Male gender.
|
|
11
|
+
FEMALE (Gender): Represents the Female gender.
|
|
12
|
+
OTHER (Gender): Represents any other gender.
|
|
13
|
+
"""
|
|
14
|
+
MALE = BackendGenderModel.MALE
|
|
15
|
+
FEMALE = BackendGenderModel.FEMALE
|
|
16
|
+
OTHER = BackendGenderModel.OTHER
|
|
17
|
+
|
|
18
|
+
def _to_backend_model(self) -> BackendGenderModel:
|
|
19
|
+
return BackendGenderModel(self.value)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from rapidata.rapidata_client.filter import (
|
|
2
|
+
AgeFilter,
|
|
3
|
+
CampaignFilter,
|
|
4
|
+
CountryFilter,
|
|
5
|
+
GenderFilter,
|
|
6
|
+
LanguageFilter,
|
|
7
|
+
UserScoreFilter,
|
|
8
|
+
CustomFilter)
|
|
9
|
+
|
|
10
|
+
class RapidataFilters:
|
|
11
|
+
"""RapidataFilters Classes
|
|
12
|
+
|
|
13
|
+
These filters can be added to the order to specifically target a certain group of users.
|
|
14
|
+
|
|
15
|
+
Note that adding multiple filters to the same order will result in a logical AND operation between the filters.
|
|
16
|
+
|
|
17
|
+
Warning: this might significantly slow down the number of responses you receive.
|
|
18
|
+
|
|
19
|
+
Attributes:
|
|
20
|
+
user_score (UserScoreFilter): The UserScoreFilter instance.
|
|
21
|
+
age (AgeFilter): The AgeFilter instance.
|
|
22
|
+
campaign (CampaignFilter): The CampaignFilter instance.
|
|
23
|
+
country (CountryFilter): The CountryFilter instance.
|
|
24
|
+
campaign (CampaignFilter): The CampaignFilter instance
|
|
25
|
+
gender (GenderFilter): The GenderFilter instance.
|
|
26
|
+
language (LanguageFilter): The LanguageFilter instance.
|
|
27
|
+
custom_filter (CustomFilter): The CustomFilter instance.
|
|
28
|
+
"""
|
|
29
|
+
user_score = UserScoreFilter
|
|
30
|
+
age = AgeFilter
|
|
31
|
+
campaign = CampaignFilter
|
|
32
|
+
country = CountryFilter
|
|
33
|
+
gender = GenderFilter
|
|
34
|
+
language = LanguageFilter
|
|
35
|
+
custom_filter = CustomFilter
|
|
@@ -1,17 +1,33 @@
|
|
|
1
1
|
from typing import Any
|
|
2
|
-
from rapidata.rapidata_client.filter.
|
|
2
|
+
from rapidata.rapidata_client.filter._base_filter import RapidataFilter
|
|
3
3
|
from rapidata.api_client.models.user_score_user_filter_model import (
|
|
4
4
|
UserScoreUserFilterModel,
|
|
5
5
|
)
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
class UserScoreFilter(
|
|
8
|
+
class UserScoreFilter(RapidataFilter):
|
|
9
|
+
"""UserScoreFilter Class
|
|
10
|
+
|
|
11
|
+
Can be used to filter who to target based on their user score.
|
|
12
|
+
|
|
13
|
+
example: UserScoreFilter(0.5, 0.9) -> will only show the order to users that have a UserScore of >=0.5 and <=0.9
|
|
9
14
|
|
|
10
|
-
|
|
15
|
+
Args:
|
|
16
|
+
lower_bound (float): The lower bound of the user score.
|
|
17
|
+
upper_bound (float): The upper bound of the user score.
|
|
18
|
+
"""
|
|
19
|
+
def __init__(self, lower_bound: float = 0.0, upper_bound: float = 1.0):
|
|
20
|
+
if lower_bound < 0 or lower_bound > 1:
|
|
21
|
+
raise ValueError("The lower bound must be between 0 and 1.")
|
|
22
|
+
if upper_bound < 0 or upper_bound > 1:
|
|
23
|
+
raise ValueError("The upper bound must be between 0 and 1.")
|
|
24
|
+
if lower_bound >= upper_bound:
|
|
25
|
+
raise ValueError("The lower bound must be less than the upper bound.")
|
|
26
|
+
|
|
11
27
|
self.upper_bound = upper_bound
|
|
12
28
|
self.lower_bound = lower_bound
|
|
13
29
|
|
|
14
|
-
def
|
|
30
|
+
def _to_model(self):
|
|
15
31
|
return UserScoreUserFilterModel(
|
|
16
32
|
_t="UserScoreFilter",
|
|
17
33
|
upperbound=self.upper_bound,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
from .
|
|
2
|
-
from .
|
|
3
|
-
from .
|
|
4
|
-
from .
|
|
5
|
-
from .
|
|
1
|
+
from ._base_metadata import Metadata
|
|
2
|
+
from ._private_text_metadata import PrivateTextMetadata
|
|
3
|
+
from ._public_text_metadata import PublicTextMetadata
|
|
4
|
+
from ._prompt_metadata import PromptMetadata
|
|
5
|
+
from ._select_words_metadata import SelectWordsMetadata
|
|
@@ -3,10 +3,11 @@ from typing import Any
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
class Metadata:
|
|
6
|
+
"""The base class for all Rapidata Metadata."""
|
|
6
7
|
|
|
7
8
|
def __init__(self, identifier: str):
|
|
8
9
|
self._identifier = identifier
|
|
9
10
|
|
|
10
11
|
@abstractmethod
|
|
11
|
-
def
|
|
12
|
+
def _to_model(self) -> Any:
|
|
12
13
|
pass
|