rapidata 2.14.1__py3-none-any.whl → 2.15.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.

@@ -27,6 +27,7 @@ from rapidata.api_client.models.get_available_validation_sets_result import GetA
27
27
  from rapidata.api_client.models.get_validation_set_by_id_result import GetValidationSetByIdResult
28
28
  from rapidata.api_client.models.import_validation_set_from_file_result import ImportValidationSetFromFileResult
29
29
  from rapidata.api_client.models.query_model import QueryModel
30
+ from rapidata.api_client.models.update_dimensions_model import UpdateDimensionsModel
30
31
  from rapidata.api_client.models.validation_import_post_request_blueprint import ValidationImportPostRequestBlueprint
31
32
  from rapidata.api_client.models.validation_set_model_paged_result import ValidationSetModelPagedResult
32
33
 
@@ -2195,3 +2196,285 @@ class ValidationApi:
2195
2196
  )
2196
2197
 
2197
2198
 
2199
+
2200
+
2201
+ @validate_call
2202
+ def validation_validation_set_id_dimensions_patch(
2203
+ self,
2204
+ validation_set_id: StrictStr,
2205
+ update_dimensions_model: Annotated[Optional[UpdateDimensionsModel], Field(description="The model containing the dimensions")] = None,
2206
+ _request_timeout: Union[
2207
+ None,
2208
+ Annotated[StrictFloat, Field(gt=0)],
2209
+ Tuple[
2210
+ Annotated[StrictFloat, Field(gt=0)],
2211
+ Annotated[StrictFloat, Field(gt=0)]
2212
+ ]
2213
+ ] = None,
2214
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2215
+ _content_type: Optional[StrictStr] = None,
2216
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2217
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2218
+ ) -> None:
2219
+ """Updates the dimensions of all rapids within a validation set.
2220
+
2221
+
2222
+ :param validation_set_id: (required)
2223
+ :type validation_set_id: str
2224
+ :param update_dimensions_model: The model containing the dimensions
2225
+ :type update_dimensions_model: UpdateDimensionsModel
2226
+ :param _request_timeout: timeout setting for this request. If one
2227
+ number provided, it will be total request
2228
+ timeout. It can also be a pair (tuple) of
2229
+ (connection, read) timeouts.
2230
+ :type _request_timeout: int, tuple(int, int), optional
2231
+ :param _request_auth: set to override the auth_settings for an a single
2232
+ request; this effectively ignores the
2233
+ authentication in the spec for a single request.
2234
+ :type _request_auth: dict, optional
2235
+ :param _content_type: force content-type for the request.
2236
+ :type _content_type: str, Optional
2237
+ :param _headers: set to override the headers for a single
2238
+ request; this effectively ignores the headers
2239
+ in the spec for a single request.
2240
+ :type _headers: dict, optional
2241
+ :param _host_index: set to override the host_index for a single
2242
+ request; this effectively ignores the host_index
2243
+ in the spec for a single request.
2244
+ :type _host_index: int, optional
2245
+ :return: Returns the result object.
2246
+ """ # noqa: E501
2247
+
2248
+ _param = self._validation_validation_set_id_dimensions_patch_serialize(
2249
+ validation_set_id=validation_set_id,
2250
+ update_dimensions_model=update_dimensions_model,
2251
+ _request_auth=_request_auth,
2252
+ _content_type=_content_type,
2253
+ _headers=_headers,
2254
+ _host_index=_host_index
2255
+ )
2256
+
2257
+ _response_types_map: Dict[str, Optional[str]] = {
2258
+ '200': None,
2259
+ }
2260
+ response_data = self.api_client.call_api(
2261
+ *_param,
2262
+ _request_timeout=_request_timeout
2263
+ )
2264
+ response_data.read()
2265
+ return self.api_client.response_deserialize(
2266
+ response_data=response_data,
2267
+ response_types_map=_response_types_map,
2268
+ ).data
2269
+
2270
+
2271
+ @validate_call
2272
+ def validation_validation_set_id_dimensions_patch_with_http_info(
2273
+ self,
2274
+ validation_set_id: StrictStr,
2275
+ update_dimensions_model: Annotated[Optional[UpdateDimensionsModel], Field(description="The model containing the dimensions")] = None,
2276
+ _request_timeout: Union[
2277
+ None,
2278
+ Annotated[StrictFloat, Field(gt=0)],
2279
+ Tuple[
2280
+ Annotated[StrictFloat, Field(gt=0)],
2281
+ Annotated[StrictFloat, Field(gt=0)]
2282
+ ]
2283
+ ] = None,
2284
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2285
+ _content_type: Optional[StrictStr] = None,
2286
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2287
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2288
+ ) -> ApiResponse[None]:
2289
+ """Updates the dimensions of all rapids within a validation set.
2290
+
2291
+
2292
+ :param validation_set_id: (required)
2293
+ :type validation_set_id: str
2294
+ :param update_dimensions_model: The model containing the dimensions
2295
+ :type update_dimensions_model: UpdateDimensionsModel
2296
+ :param _request_timeout: timeout setting for this request. If one
2297
+ number provided, it will be total request
2298
+ timeout. It can also be a pair (tuple) of
2299
+ (connection, read) timeouts.
2300
+ :type _request_timeout: int, tuple(int, int), optional
2301
+ :param _request_auth: set to override the auth_settings for an a single
2302
+ request; this effectively ignores the
2303
+ authentication in the spec for a single request.
2304
+ :type _request_auth: dict, optional
2305
+ :param _content_type: force content-type for the request.
2306
+ :type _content_type: str, Optional
2307
+ :param _headers: set to override the headers for a single
2308
+ request; this effectively ignores the headers
2309
+ in the spec for a single request.
2310
+ :type _headers: dict, optional
2311
+ :param _host_index: set to override the host_index for a single
2312
+ request; this effectively ignores the host_index
2313
+ in the spec for a single request.
2314
+ :type _host_index: int, optional
2315
+ :return: Returns the result object.
2316
+ """ # noqa: E501
2317
+
2318
+ _param = self._validation_validation_set_id_dimensions_patch_serialize(
2319
+ validation_set_id=validation_set_id,
2320
+ update_dimensions_model=update_dimensions_model,
2321
+ _request_auth=_request_auth,
2322
+ _content_type=_content_type,
2323
+ _headers=_headers,
2324
+ _host_index=_host_index
2325
+ )
2326
+
2327
+ _response_types_map: Dict[str, Optional[str]] = {
2328
+ '200': None,
2329
+ }
2330
+ response_data = self.api_client.call_api(
2331
+ *_param,
2332
+ _request_timeout=_request_timeout
2333
+ )
2334
+ response_data.read()
2335
+ return self.api_client.response_deserialize(
2336
+ response_data=response_data,
2337
+ response_types_map=_response_types_map,
2338
+ )
2339
+
2340
+
2341
+ @validate_call
2342
+ def validation_validation_set_id_dimensions_patch_without_preload_content(
2343
+ self,
2344
+ validation_set_id: StrictStr,
2345
+ update_dimensions_model: Annotated[Optional[UpdateDimensionsModel], Field(description="The model containing the dimensions")] = None,
2346
+ _request_timeout: Union[
2347
+ None,
2348
+ Annotated[StrictFloat, Field(gt=0)],
2349
+ Tuple[
2350
+ Annotated[StrictFloat, Field(gt=0)],
2351
+ Annotated[StrictFloat, Field(gt=0)]
2352
+ ]
2353
+ ] = None,
2354
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2355
+ _content_type: Optional[StrictStr] = None,
2356
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2357
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2358
+ ) -> RESTResponseType:
2359
+ """Updates the dimensions of all rapids within a validation set.
2360
+
2361
+
2362
+ :param validation_set_id: (required)
2363
+ :type validation_set_id: str
2364
+ :param update_dimensions_model: The model containing the dimensions
2365
+ :type update_dimensions_model: UpdateDimensionsModel
2366
+ :param _request_timeout: timeout setting for this request. If one
2367
+ number provided, it will be total request
2368
+ timeout. It can also be a pair (tuple) of
2369
+ (connection, read) timeouts.
2370
+ :type _request_timeout: int, tuple(int, int), optional
2371
+ :param _request_auth: set to override the auth_settings for an a single
2372
+ request; this effectively ignores the
2373
+ authentication in the spec for a single request.
2374
+ :type _request_auth: dict, optional
2375
+ :param _content_type: force content-type for the request.
2376
+ :type _content_type: str, Optional
2377
+ :param _headers: set to override the headers for a single
2378
+ request; this effectively ignores the headers
2379
+ in the spec for a single request.
2380
+ :type _headers: dict, optional
2381
+ :param _host_index: set to override the host_index for a single
2382
+ request; this effectively ignores the host_index
2383
+ in the spec for a single request.
2384
+ :type _host_index: int, optional
2385
+ :return: Returns the result object.
2386
+ """ # noqa: E501
2387
+
2388
+ _param = self._validation_validation_set_id_dimensions_patch_serialize(
2389
+ validation_set_id=validation_set_id,
2390
+ update_dimensions_model=update_dimensions_model,
2391
+ _request_auth=_request_auth,
2392
+ _content_type=_content_type,
2393
+ _headers=_headers,
2394
+ _host_index=_host_index
2395
+ )
2396
+
2397
+ _response_types_map: Dict[str, Optional[str]] = {
2398
+ '200': None,
2399
+ }
2400
+ response_data = self.api_client.call_api(
2401
+ *_param,
2402
+ _request_timeout=_request_timeout
2403
+ )
2404
+ return response_data.response
2405
+
2406
+
2407
+ def _validation_validation_set_id_dimensions_patch_serialize(
2408
+ self,
2409
+ validation_set_id,
2410
+ update_dimensions_model,
2411
+ _request_auth,
2412
+ _content_type,
2413
+ _headers,
2414
+ _host_index,
2415
+ ) -> RequestSerialized:
2416
+
2417
+ _host = None
2418
+
2419
+ _collection_formats: Dict[str, str] = {
2420
+ }
2421
+
2422
+ _path_params: Dict[str, str] = {}
2423
+ _query_params: List[Tuple[str, str]] = []
2424
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2425
+ _form_params: List[Tuple[str, str]] = []
2426
+ _files: Dict[
2427
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2428
+ ] = {}
2429
+ _body_params: Optional[bytes] = None
2430
+
2431
+ # process the path parameters
2432
+ if validation_set_id is not None:
2433
+ _path_params['validationSetId'] = validation_set_id
2434
+ # process the query parameters
2435
+ # process the header parameters
2436
+ # process the form parameters
2437
+ # process the body parameter
2438
+ if update_dimensions_model is not None:
2439
+ _body_params = update_dimensions_model
2440
+
2441
+
2442
+
2443
+ # set the HTTP header `Content-Type`
2444
+ if _content_type:
2445
+ _header_params['Content-Type'] = _content_type
2446
+ else:
2447
+ _default_content_type = (
2448
+ self.api_client.select_header_content_type(
2449
+ [
2450
+ 'application/json',
2451
+ 'text/json',
2452
+ 'application/*+json'
2453
+ ]
2454
+ )
2455
+ )
2456
+ if _default_content_type is not None:
2457
+ _header_params['Content-Type'] = _default_content_type
2458
+
2459
+ # authentication setting
2460
+ _auth_settings: List[str] = [
2461
+ 'bearer',
2462
+ 'oauth2'
2463
+ ]
2464
+
2465
+ return self.api_client.param_serialize(
2466
+ method='PATCH',
2467
+ resource_path='/validation/{validationSetId}/dimensions',
2468
+ path_params=_path_params,
2469
+ query_params=_query_params,
2470
+ header_params=_header_params,
2471
+ body=_body_params,
2472
+ post_params=_form_params,
2473
+ files=_files,
2474
+ auth_settings=_auth_settings,
2475
+ collection_formats=_collection_formats,
2476
+ _host=_host,
2477
+ _request_auth=_request_auth
2478
+ )
2479
+
2480
+
@@ -263,6 +263,7 @@ from rapidata.api_client.models.translated_string import TranslatedString
263
263
  from rapidata.api_client.models.unlock_order_result import UnlockOrderResult
264
264
  from rapidata.api_client.models.update_access_model import UpdateAccessModel
265
265
  from rapidata.api_client.models.update_campaign_model import UpdateCampaignModel
266
+ from rapidata.api_client.models.update_dimensions_model import UpdateDimensionsModel
266
267
  from rapidata.api_client.models.update_order_model import UpdateOrderModel
267
268
  from rapidata.api_client.models.update_validation_rapid_model import UpdateValidationRapidModel
268
269
  from rapidata.api_client.models.update_validation_rapid_model_truth import UpdateValidationRapidModelTruth
@@ -38,7 +38,8 @@ class AddCampaignModel(BaseModel):
38
38
  feature_flags: List[FeatureFlag] = Field(description="The feature flags that should be applied to the campaign.", alias="featureFlags")
39
39
  priority: StrictInt = Field(description="The priority of the campaign.")
40
40
  is_sticky: Optional[StrictBool] = Field(default=None, description="Indicates if the campaign is sticky.", alias="isSticky")
41
- __properties: ClassVar[List[str]] = ["_t", "artifactId", "campaignName", "userFilters", "validationSetId", "selections", "featureFlags", "priority", "isSticky"]
41
+ is_preview_enabled: Optional[StrictBool] = Field(default=None, description="A flag to indicate whether the campaign should be put into preview mode after creation. This way the campaign will not start automatically and the user will have to manually start it.", alias="isPreviewEnabled")
42
+ __properties: ClassVar[List[str]] = ["_t", "artifactId", "campaignName", "userFilters", "validationSetId", "selections", "featureFlags", "priority", "isSticky", "isPreviewEnabled"]
42
43
 
43
44
  @field_validator('t')
44
45
  def t_validate_enum(cls, value):
@@ -122,6 +123,11 @@ class AddCampaignModel(BaseModel):
122
123
  if self.selections is None and "selections" in self.model_fields_set:
123
124
  _dict['selections'] = None
124
125
 
126
+ # set to None if is_preview_enabled (nullable) is None
127
+ # and model_fields_set contains the field
128
+ if self.is_preview_enabled is None and "is_preview_enabled" in self.model_fields_set:
129
+ _dict['isPreviewEnabled'] = None
130
+
125
131
  return _dict
126
132
 
127
133
  @classmethod
@@ -142,7 +148,8 @@ class AddCampaignModel(BaseModel):
142
148
  "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None,
143
149
  "featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
144
150
  "priority": obj.get("priority"),
145
- "isSticky": obj.get("isSticky")
151
+ "isSticky": obj.get("isSticky"),
152
+ "isPreviewEnabled": obj.get("isPreviewEnabled")
146
153
  })
147
154
  return _obj
148
155
 
@@ -38,8 +38,8 @@ class CampaignQueryResult(BaseModel):
38
38
  @field_validator('status')
39
39
  def status_validate_enum(cls, value):
40
40
  """Validates the enum"""
41
- if value not in set(['Created', 'Active', 'Paused', 'Completed']):
42
- raise ValueError("must be one of enum values ('Created', 'Active', 'Paused', 'Completed')")
41
+ if value not in set(['Created', 'Active', 'Paused', 'Preview', 'Completed']):
42
+ raise ValueError("must be one of enum values ('Created', 'Active', 'Paused', 'Preview', 'Completed')")
43
43
  return value
44
44
 
45
45
  model_config = ConfigDict(
@@ -29,6 +29,7 @@ class CampaignStatus(str, Enum):
29
29
  CREATED = 'Created'
30
30
  ACTIVE = 'Active'
31
31
  PAUSED = 'Paused'
32
+ PREVIEW = 'Preview'
32
33
  COMPLETED = 'Completed'
33
34
 
34
35
  @classmethod
@@ -39,10 +39,12 @@ class CreateOrderModel(BaseModel):
39
39
  feature_flags: Optional[List[FeatureFlagModel]] = Field(default=None, description="The feature flags are used to enable or disable certain features.", alias="featureFlags")
40
40
  priority: Optional[StrictInt] = Field(default=None, description="The priority is used to prioritize over other orders.")
41
41
  is_sticky: Optional[StrictBool] = Field(default=None, description="Indicates if the underlying campaign should be sticky.", alias="isSticky")
42
+ user_score_dimensions: Optional[List[StrictStr]] = Field(default=None, description="The user score dimensions are used to determine the score of the responses from the user.", alias="userScoreDimensions")
43
+ demographic_keys: Optional[List[StrictStr]] = Field(default=None, description="The demographic keys are used to determine which demographics to store on the resposnes from the user.", alias="demographicKeys")
42
44
  user_filters: List[CreateOrderModelUserFiltersInner] = Field(description="The user filters are used to restrict the order to only collect votes from a specific demographic.", alias="userFilters")
43
45
  validation_set_id: Optional[StrictStr] = Field(default=None, description="The validation set id can be changed to point to a specific validation set. if not provided a sane default will be used.", alias="validationSetId")
44
46
  selections: Optional[List[AbTestSelectionAInner]] = Field(default=None, description="The selections are used to determine which tasks are shown to a user.")
45
- __properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "isSticky", "userFilters", "validationSetId", "selections"]
47
+ __properties: ClassVar[List[str]] = ["_t", "orderName", "workflow", "referee", "aggregator", "featureFlags", "priority", "isSticky", "userScoreDimensions", "demographicKeys", "userFilters", "validationSetId", "selections"]
46
48
 
47
49
  @field_validator('t')
48
50
  def t_validate_enum(cls, value):
@@ -142,6 +144,16 @@ class CreateOrderModel(BaseModel):
142
144
  if self.priority is None and "priority" in self.model_fields_set:
143
145
  _dict['priority'] = None
144
146
 
147
+ # set to None if user_score_dimensions (nullable) is None
148
+ # and model_fields_set contains the field
149
+ if self.user_score_dimensions is None and "user_score_dimensions" in self.model_fields_set:
150
+ _dict['userScoreDimensions'] = None
151
+
152
+ # set to None if demographic_keys (nullable) is None
153
+ # and model_fields_set contains the field
154
+ if self.demographic_keys is None and "demographic_keys" in self.model_fields_set:
155
+ _dict['demographicKeys'] = None
156
+
145
157
  # set to None if validation_set_id (nullable) is None
146
158
  # and model_fields_set contains the field
147
159
  if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
@@ -172,6 +184,8 @@ class CreateOrderModel(BaseModel):
172
184
  "featureFlags": [FeatureFlagModel.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None,
173
185
  "priority": obj.get("priority"),
174
186
  "isSticky": obj.get("isSticky"),
187
+ "userScoreDimensions": obj.get("userScoreDimensions"),
188
+ "demographicKeys": obj.get("demographicKeys"),
175
189
  "userFilters": [CreateOrderModelUserFiltersInner.from_dict(_item) for _item in obj["userFilters"]] if obj.get("userFilters") is not None else None,
176
190
  "validationSetId": obj.get("validationSetId"),
177
191
  "selections": [AbTestSelectionAInner.from_dict(_item) for _item in obj["selections"]] if obj.get("selections") is not None else None
@@ -27,7 +27,7 @@ class EvaluationWorkflowModel(BaseModel):
27
27
  If the EvaluationWorkflow is chosen a validation set will be used as a source for all tasks. It functions similarly to the SimpleWorkflow as there is a 1:1 mapping between validation rapids and tasks.
28
28
  """ # noqa: E501
29
29
  t: StrictStr = Field(description="Discriminator value for EvaluationWorkflow", alias="_t")
30
- validation_set_id: StrictStr = Field(description="The Validation Set Id is used to as a source for the tasks that will be sent to the user.", alias="validationSetId")
30
+ validation_set_id: StrictStr = Field(description="The Validation Set id is used to as a source for the tasks that will be sent to the user.", alias="validationSetId")
31
31
  should_accept_incorrect: StrictBool = Field(description="Indicates if the user should get feedback on their answers if they answer wrong. If set to true the user will not notice that he was tested.", alias="shouldAcceptIncorrect")
32
32
  __properties: ClassVar[List[str]] = ["_t", "validationSetId", "shouldAcceptIncorrect"]
33
33
 
@@ -39,8 +39,8 @@ class OrderModel(BaseModel):
39
39
  @field_validator('state')
40
40
  def state_validate_enum(cls, value):
41
41
  """Validates the enum"""
42
- if value not in set(['Created', 'Submitted', 'ManualReview', 'Processing', 'Paused', 'Completed', 'Cancelled', 'Failed']):
43
- raise ValueError("must be one of enum values ('Created', 'Submitted', 'ManualReview', 'Processing', 'Paused', 'Completed', 'Cancelled', 'Failed')")
42
+ if value not in set(['Created', 'Preview', 'Submitted', 'ManualReview', 'Processing', 'Paused', 'Completed', 'Cancelled', 'Failed']):
43
+ raise ValueError("must be one of enum values ('Created', 'Preview', 'Submitted', 'ManualReview', 'Processing', 'Paused', 'Completed', 'Cancelled', 'Failed')")
44
44
  return value
45
45
 
46
46
  model_config = ConfigDict(
@@ -27,6 +27,7 @@ class OrderState(str, Enum):
27
27
  allowed enum values
28
28
  """
29
29
  CREATED = 'Created'
30
+ PREVIEW = 'Preview'
30
31
  SUBMITTED = 'Submitted'
31
32
  MANUALREVIEW = 'ManualReview'
32
33
  PROCESSING = 'Processing'
@@ -0,0 +1,87 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rapidata.Dataset
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document: v1
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+ import pprint
17
+ import re # noqa: F401
18
+ import json
19
+
20
+ from pydantic import BaseModel, ConfigDict, StrictStr
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class UpdateDimensionsModel(BaseModel):
26
+ """
27
+ The model for updating the dimensions of all rapids within a validation set.
28
+ """ # noqa: E501
29
+ dimensions: List[StrictStr]
30
+ __properties: ClassVar[List[str]] = ["dimensions"]
31
+
32
+ model_config = ConfigDict(
33
+ populate_by_name=True,
34
+ validate_assignment=True,
35
+ protected_namespaces=(),
36
+ )
37
+
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of UpdateDimensionsModel from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([
64
+ ])
65
+
66
+ _dict = self.model_dump(
67
+ by_alias=True,
68
+ exclude=excluded_fields,
69
+ exclude_none=True,
70
+ )
71
+ return _dict
72
+
73
+ @classmethod
74
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
75
+ """Create an instance of UpdateDimensionsModel from a dict"""
76
+ if obj is None:
77
+ return None
78
+
79
+ if not isinstance(obj, dict):
80
+ return cls.model_validate(obj)
81
+
82
+ _obj = cls.model_validate({
83
+ "dimensions": obj.get("dimensions")
84
+ })
85
+ return _obj
86
+
87
+
@@ -56,12 +56,13 @@ configuration.api_key['bearer'] = os.environ["API_KEY"]
56
56
  with rapidata.api_client.ApiClient(configuration) as api_client:
57
57
  # Create an instance of the API class
58
58
  api_instance = rapidata.api_client.CampaignApi(api_client)
59
+ campaign_id = 'campaign_id_example' # str | The campaign id that should be released
59
60
 
60
61
  try:
61
- # The monitor endpoint is used to monitor the health of the service
62
- api_instance.campaign_monitor_get()
62
+ # Releases a campaign from the preview state. This will make the campaign available for the users to be labeled.
63
+ api_instance.campaign_campaign_id_release_post(campaign_id)
63
64
  except ApiException as e:
64
- print("Exception when calling CampaignApi->campaign_monitor_get: %s\n" % e)
65
+ print("Exception when calling CampaignApi->campaign_campaign_id_release_post: %s\n" % e)
65
66
 
66
67
  ```
67
68
 
@@ -71,6 +72,7 @@ All URIs are relative to *http://localhost*
71
72
 
72
73
  Class | Method | HTTP request | Description
73
74
  ------------ | ------------- | ------------- | -------------
75
+ *CampaignApi* | [**campaign_campaign_id_release_post**](rapidata/api_client/docs/CampaignApi.md#campaign_campaign_id_release_post) | **POST** /campaign/{campaignId}/release | Releases a campaign from the preview state. This will make the campaign available for the users to be labeled.
74
76
  *CampaignApi* | [**campaign_monitor_get**](rapidata/api_client/docs/CampaignApi.md#campaign_monitor_get) | **GET** /Campaign/Monitor | The monitor endpoint is used to monitor the health of the service
75
77
  *CampaignApi* | [**campaign_pause_post**](rapidata/api_client/docs/CampaignApi.md#campaign_pause_post) | **POST** /Campaign/Pause | Pauses a campaign.
76
78
  *CampaignApi* | [**campaign_query_get**](rapidata/api_client/docs/CampaignApi.md#campaign_query_get) | **GET** /Campaign/Query | Queries orders based on a filter, page, and sort criteria.
@@ -109,6 +111,7 @@ Class | Method | HTTP request | Description
109
111
  *OrderApi* | [**order_get_by_id_get**](rapidata/api_client/docs/OrderApi.md#order_get_by_id_get) | **GET** /Order/GetById | Retrieves an order by its id.
110
112
  *OrderApi* | [**order_get_order_results_get**](rapidata/api_client/docs/OrderApi.md#order_get_order_results_get) | **GET** /Order/GetOrderResults | Aggregates the results of an order.
111
113
  *OrderApi* | [**order_get_public_get**](rapidata/api_client/docs/OrderApi.md#order_get_public_get) | **GET** /Order/GetPublic | Retrieves orders that are public and can be cloned by any user.
114
+ *OrderApi* | [**order_order_id_preview_post**](rapidata/api_client/docs/OrderApi.md#order_order_id_preview_post) | **POST** /order/{orderId}/preview | Puts the order into preview mode, where it one can inspect what our labelers receive.
112
115
  *OrderApi* | [**order_pause_post**](rapidata/api_client/docs/OrderApi.md#order_pause_post) | **POST** /Order/Pause | Pauses an order that is processing. Meaning all campaigns in the order will be paused.
113
116
  *OrderApi* | [**order_query_get**](rapidata/api_client/docs/OrderApi.md#order_query_get) | **GET** /Order/Query | Queries orders based on a filter, page, and sort criteria.
114
117
  *OrderApi* | [**order_result_get**](rapidata/api_client/docs/OrderApi.md#order_result_get) | **GET** /Order/Result | Aggregates the results of an order.
@@ -148,6 +151,7 @@ Class | Method | HTTP request | Description
148
151
  *ValidationApi* | [**validation_import_compare_post**](rapidata/api_client/docs/ValidationApi.md#validation_import_compare_post) | **POST** /Validation/ImportCompare | Imports a compare validation set from a zip file.
149
152
  *ValidationApi* | [**validation_import_post**](rapidata/api_client/docs/ValidationApi.md#validation_import_post) | **POST** /Validation/Import | Imports a validation set from a zip file.
150
153
  *ValidationApi* | [**validation_query_validation_sets_get**](rapidata/api_client/docs/ValidationApi.md#validation_query_validation_sets_get) | **GET** /Validation/QueryValidationSets | Queries validation sets based on the provided filter, paging and sorting criteria.
154
+ *ValidationApi* | [**validation_validation_set_id_dimensions_patch**](rapidata/api_client/docs/ValidationApi.md#validation_validation_set_id_dimensions_patch) | **PATCH** /validation/{validationSetId}/dimensions | Updates the dimensions of all rapids within a validation set.
151
155
  *WorkflowApi* | [**workflow_delete_delete**](rapidata/api_client/docs/WorkflowApi.md#workflow_delete_delete) | **DELETE** /Workflow/Delete | Deletes a workflow.
152
156
  *WorkflowApi* | [**workflow_get_by_id_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_by_id_get) | **GET** /Workflow/GetById | Get a workflow by its ID.
153
157
  *WorkflowApi* | [**workflow_get_progress_get**](rapidata/api_client/docs/WorkflowApi.md#workflow_get_progress_get) | **GET** /Workflow/GetProgress | Get the progress of a workflow.
@@ -407,6 +411,7 @@ Class | Method | HTTP request | Description
407
411
  - [UnlockOrderResult](rapidata/api_client/docs/UnlockOrderResult.md)
408
412
  - [UpdateAccessModel](rapidata/api_client/docs/UpdateAccessModel.md)
409
413
  - [UpdateCampaignModel](rapidata/api_client/docs/UpdateCampaignModel.md)
414
+ - [UpdateDimensionsModel](rapidata/api_client/docs/UpdateDimensionsModel.md)
410
415
  - [UpdateOrderModel](rapidata/api_client/docs/UpdateOrderModel.md)
411
416
  - [UpdateValidationRapidModel](rapidata/api_client/docs/UpdateValidationRapidModel.md)
412
417
  - [UpdateValidationRapidModelTruth](rapidata/api_client/docs/UpdateValidationRapidModelTruth.md)
@@ -2,6 +2,8 @@ from rapidata.service.openapi_service import OpenAPIService
2
2
  from rapidata.rapidata_client.assets import MediaAsset
3
3
  from rapidata.api_client.models.create_demographic_rapid_model import CreateDemographicRapidModel
4
4
  from rapidata.api_client.models.classify_payload import ClassifyPayload
5
+ import requests
6
+ from requests.adapters import HTTPAdapter, Retry
5
7
 
6
8
 
7
9
  class DemographicManager:
@@ -23,5 +25,38 @@ class DemographicManager:
23
25
  title=instruction
24
26
  )
25
27
  )
28
+ session = self._get_session()
29
+ media.session = session
30
+
26
31
  self._openapi_service.rapid_api.rapid_create_demographic_rapid_post(model=model, file=[media.to_file()])
32
+
33
+ def _get_session(self, max_retries: int = 5, max_workers: int = 10) -> requests.Session:
34
+ """Get a requests session with retry logic.
35
+
36
+
37
+ Args:
38
+ max_retries (int): The maximum number of retries.
39
+ max_workers (int): The maximum number of workers.
40
+
41
+ Returns:
42
+ requests.Session: A requests session with retry logic.
43
+ """
44
+ session = requests.Session()
45
+ retries = Retry(
46
+ total=max_retries,
47
+ backoff_factor=1,
48
+ status_forcelist=[500, 502, 503, 504],
49
+ allowed_methods=["GET"],
50
+ respect_retry_after_header=True
51
+ )
52
+
53
+ adapter = HTTPAdapter(
54
+ pool_connections=max_workers * 2,
55
+ pool_maxsize=max_workers * 4,
56
+ max_retries=retries
57
+ )
58
+ session.mount('http://', adapter)
59
+ session.mount('https://', adapter)
60
+
61
+ return session
27
62
 
@@ -182,6 +182,8 @@ class RapidataOrderBuilder:
182
182
  raise ValueError(
183
183
  "Media paths must all be of the same type: MediaAsset, TextAsset, or MultiAsset."
184
184
  )
185
+
186
+ self.__openapi_service.order_api.order_order_id_preview_post(self.order_id)
185
187
 
186
188
  return order
187
189
 
@@ -70,6 +70,7 @@ class RapidataOrder:
70
70
 
71
71
  States:
72
72
  Created: The order has been created but not started yet.\n
73
+ Preview: The order has been set up and ready but not collecting responses yet.\n
73
74
  Submitted: The order has been submitted and is being reviewed.\n
74
75
  ManualReview: The order is in manual review - something went wrong with the automatic approval.\n
75
76
  Processing: The order is actively being processed.\n
@@ -164,12 +165,9 @@ class RapidataOrder:
164
165
 
165
166
  Raises:
166
167
  Exception: If the order is not in processing state.
167
- """
168
- if (status := self.get_status()) != OrderState.PROCESSING:
169
- raise Exception(f"Preview only available if order is processing. current status: {status}")
170
-
168
+ """
171
169
  campaign_id = self.__get_campaign_id()
172
- auth_url = f"https://rapids.{self.__openapi_service.enviroment}/preview/campaign?id={campaign_id}"
170
+ auth_url = f"https://app.{self.__openapi_service.enviroment}/order/detail/{self.order_id}/preview?campaignId={campaign_id}"
173
171
  could_open_browser = webbrowser.open(auth_url)
174
172
  if not could_open_browser:
175
173
  encoded_url = urllib.parse.quote(auth_url, safe="%/:=&?~#+!$,;'@()*[]")