rapidata 2.27.4__py3-none-any.whl → 2.27.6__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of rapidata might be problematic. Click here for more details.

Files changed (32) hide show
  1. rapidata/__init__.py +1 -1
  2. rapidata/api_client/__init__.py +19 -1
  3. rapidata/api_client/api/__init__.py +1 -0
  4. rapidata/api_client/api/client_api.py +319 -46
  5. rapidata/api_client/api/leaderboard_api.py +2506 -0
  6. rapidata/api_client/models/__init__.py +18 -1
  7. rapidata/api_client/models/client_model.py +191 -0
  8. rapidata/api_client/models/create_customer_client_result.py +89 -0
  9. rapidata/api_client/models/create_leaderboard_model.py +91 -0
  10. rapidata/api_client/models/create_leaderboard_participant_model.py +87 -0
  11. rapidata/api_client/models/create_leaderboard_participant_result.py +89 -0
  12. rapidata/api_client/models/create_leaderboard_result.py +87 -0
  13. rapidata/api_client/models/dynamic_client_registration_request.py +175 -0
  14. rapidata/api_client/models/get_leaderboard_by_id_result.py +91 -0
  15. rapidata/api_client/models/get_participant_by_id_result.py +102 -0
  16. rapidata/api_client/models/json_web_key.py +258 -0
  17. rapidata/api_client/models/json_web_key_set.py +115 -0
  18. rapidata/api_client/models/leaderboard_query_result.py +93 -0
  19. rapidata/api_client/models/leaderboard_query_result_paged_result.py +105 -0
  20. rapidata/api_client/models/participant_by_leaderboard.py +102 -0
  21. rapidata/api_client/models/participant_by_leaderboard_paged_result.py +105 -0
  22. rapidata/api_client/models/participant_status.py +39 -0
  23. rapidata/api_client/models/prompt_by_leaderboard_result.py +90 -0
  24. rapidata/api_client/models/prompt_by_leaderboard_result_paged_result.py +105 -0
  25. rapidata/api_client_README.md +29 -2
  26. rapidata/rapidata_client/order/_rapidata_dataset.py +91 -41
  27. rapidata/rapidata_client/order/_rapidata_order_builder.py +2 -44
  28. rapidata/rapidata_client/validation/validation_set_manager.py +14 -0
  29. {rapidata-2.27.4.dist-info → rapidata-2.27.6.dist-info}/METADATA +1 -1
  30. {rapidata-2.27.4.dist-info → rapidata-2.27.6.dist-info}/RECORD +32 -13
  31. {rapidata-2.27.4.dist-info → rapidata-2.27.6.dist-info}/LICENSE +0 -0
  32. {rapidata-2.27.4.dist-info → rapidata-2.27.6.dist-info}/WHEEL +0 -0
@@ -0,0 +1,105 @@
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, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.participant_by_leaderboard import ParticipantByLeaderboard
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ParticipantByLeaderboardPagedResult(BaseModel):
27
+ """
28
+ ParticipantByLeaderboardPagedResult
29
+ """ # noqa: E501
30
+ total: StrictInt
31
+ page: StrictInt
32
+ page_size: StrictInt = Field(alias="pageSize")
33
+ items: List[ParticipantByLeaderboard]
34
+ total_pages: Optional[StrictInt] = Field(default=None, alias="totalPages")
35
+ __properties: ClassVar[List[str]] = ["total", "page", "pageSize", "items", "totalPages"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of ParticipantByLeaderboardPagedResult from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * OpenAPI `readOnly` fields are excluded.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "total_pages",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
79
+ _items = []
80
+ if self.items:
81
+ for _item_items in self.items:
82
+ if _item_items:
83
+ _items.append(_item_items.to_dict())
84
+ _dict['items'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of ParticipantByLeaderboardPagedResult from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "total": obj.get("total"),
98
+ "page": obj.get("page"),
99
+ "pageSize": obj.get("pageSize"),
100
+ "items": [ParticipantByLeaderboard.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
101
+ "totalPages": obj.get("totalPages")
102
+ })
103
+ return _obj
104
+
105
+
@@ -0,0 +1,39 @@
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 json
17
+ from enum import Enum
18
+ from typing_extensions import Self
19
+
20
+
21
+ class ParticipantStatus(str, Enum):
22
+ """
23
+ ParticipantStatus
24
+ """
25
+
26
+ """
27
+ allowed enum values
28
+ """
29
+ CREATED = 'Created'
30
+ QUEUED = 'Queued'
31
+ RUNNING = 'Running'
32
+ COMPLETED = 'Completed'
33
+
34
+ @classmethod
35
+ def from_json(cls, json_str: str) -> Self:
36
+ """Create an instance of ParticipantStatus from a JSON string"""
37
+ return cls(json.loads(json_str))
38
+
39
+
@@ -0,0 +1,90 @@
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 datetime import datetime
21
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
22
+ from typing import Any, ClassVar, Dict, List
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PromptByLeaderboardResult(BaseModel):
27
+ """
28
+ PromptByLeaderboardResult
29
+ """ # noqa: E501
30
+ prompt: StrictStr
31
+ created_at: datetime = Field(alias="createdAt")
32
+ __properties: ClassVar[List[str]] = ["prompt", "createdAt"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
39
+
40
+
41
+ def to_str(self) -> str:
42
+ """Returns the string representation of the model using alias"""
43
+ return pprint.pformat(self.model_dump(by_alias=True))
44
+
45
+ def to_json(self) -> str:
46
+ """Returns the JSON representation of the model using alias"""
47
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
+ return json.dumps(self.to_dict())
49
+
50
+ @classmethod
51
+ def from_json(cls, json_str: str) -> Optional[Self]:
52
+ """Create an instance of PromptByLeaderboardResult from a JSON string"""
53
+ return cls.from_dict(json.loads(json_str))
54
+
55
+ def to_dict(self) -> Dict[str, Any]:
56
+ """Return the dictionary representation of the model using alias.
57
+
58
+ This has the following differences from calling pydantic's
59
+ `self.model_dump(by_alias=True)`:
60
+
61
+ * `None` is only added to the output dict for nullable fields that
62
+ were set at model initialization. Other fields with value `None`
63
+ are ignored.
64
+ """
65
+ excluded_fields: Set[str] = set([
66
+ ])
67
+
68
+ _dict = self.model_dump(
69
+ by_alias=True,
70
+ exclude=excluded_fields,
71
+ exclude_none=True,
72
+ )
73
+ return _dict
74
+
75
+ @classmethod
76
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
+ """Create an instance of PromptByLeaderboardResult from a dict"""
78
+ if obj is None:
79
+ return None
80
+
81
+ if not isinstance(obj, dict):
82
+ return cls.model_validate(obj)
83
+
84
+ _obj = cls.model_validate({
85
+ "prompt": obj.get("prompt"),
86
+ "createdAt": obj.get("createdAt")
87
+ })
88
+ return _obj
89
+
90
+
@@ -0,0 +1,105 @@
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, Field, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from rapidata.api_client.models.prompt_by_leaderboard_result import PromptByLeaderboardResult
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class PromptByLeaderboardResultPagedResult(BaseModel):
27
+ """
28
+ PromptByLeaderboardResultPagedResult
29
+ """ # noqa: E501
30
+ total: StrictInt
31
+ page: StrictInt
32
+ page_size: StrictInt = Field(alias="pageSize")
33
+ items: List[PromptByLeaderboardResult]
34
+ total_pages: Optional[StrictInt] = Field(default=None, alias="totalPages")
35
+ __properties: ClassVar[List[str]] = ["total", "page", "pageSize", "items", "totalPages"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of PromptByLeaderboardResultPagedResult from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ * OpenAPI `readOnly` fields are excluded.
68
+ """
69
+ excluded_fields: Set[str] = set([
70
+ "total_pages",
71
+ ])
72
+
73
+ _dict = self.model_dump(
74
+ by_alias=True,
75
+ exclude=excluded_fields,
76
+ exclude_none=True,
77
+ )
78
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
79
+ _items = []
80
+ if self.items:
81
+ for _item_items in self.items:
82
+ if _item_items:
83
+ _items.append(_item_items.to_dict())
84
+ _dict['items'] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of PromptByLeaderboardResultPagedResult from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate({
97
+ "total": obj.get("total"),
98
+ "page": obj.get("page"),
99
+ "pageSize": obj.get("pageSize"),
100
+ "items": [PromptByLeaderboardResult.from_dict(_item) for _item in obj["items"]] if obj.get("items") is not None else None,
101
+ "totalPages": obj.get("totalPages")
102
+ })
103
+ return _obj
104
+
105
+
@@ -82,8 +82,9 @@ Class | Method | HTTP request | Description
82
82
  *CampaignApi* | [**campaign_resume_post**](rapidata/api_client/docs/CampaignApi.md#campaign_resume_post) | **POST** /campaign/resume | Resumes a campaign.
83
83
  *CampaignApi* | [**campaigns_get**](rapidata/api_client/docs/CampaignApi.md#campaigns_get) | **GET** /campaigns | Queries orders based on a filter, page, and sort criteria.
84
84
  *ClientApi* | [**client_client_id_delete**](rapidata/api_client/docs/ClientApi.md#client_client_id_delete) | **DELETE** /client/{clientId} | Deletes a customers' client.
85
+ *ClientApi* | [**client_client_id_get**](rapidata/api_client/docs/ClientApi.md#client_client_id_get) | **GET** /client/{clientId} | Gets a specific client by its ID.
85
86
  *ClientApi* | [**client_post**](rapidata/api_client/docs/ClientApi.md#client_post) | **POST** /client | Creates a new client for the current customer.
86
- *ClientApi* | [**client_query_get**](rapidata/api_client/docs/ClientApi.md#client_query_get) | **GET** /client/query | Gets the clients for the current customer.
87
+ *ClientApi* | [**client_register_post**](rapidata/api_client/docs/ClientApi.md#client_register_post) | **POST** /client/register | Registers a new client dynamically.
87
88
  *ClientApi* | [**clients_get**](rapidata/api_client/docs/ClientApi.md#clients_get) | **GET** /clients | Queries the clients for the current customer.
88
89
  *CocoApi* | [**coco_coco_set_id_submit_post**](rapidata/api_client/docs/CocoApi.md#coco_coco_set_id_submit_post) | **POST** /coco/{cocoSetId}/submit | Creates a new validation set based on a previously uploaded CoCo set.
89
90
  *CocoApi* | [**coco_post**](rapidata/api_client/docs/CocoApi.md#coco_post) | **POST** /coco | Uploads a CoCo set to the system.
@@ -128,6 +129,15 @@ Class | Method | HTTP request | Description
128
129
  *IdentityApi* | [**identity_referrer_post**](rapidata/api_client/docs/IdentityApi.md#identity_referrer_post) | **POST** /identity/referrer | Sets the referrer for the current customer.
129
130
  *IdentityApi* | [**identity_registertemporary_post**](rapidata/api_client/docs/IdentityApi.md#identity_registertemporary_post) | **POST** /identity/registertemporary | Registers and logs in a temporary customer.
130
131
  *IdentityApi* | [**identity_temporary_post**](rapidata/api_client/docs/IdentityApi.md#identity_temporary_post) | **POST** /identity/temporary | Registers and logs in a temporary customer.
132
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_get) | **GET** /leaderboard/{leaderboardId} | Gets a leaderboard by its ID.
133
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_participants_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_participants_get) | **GET** /leaderboard/{leaderboardId}/participants | queries all the participants of a leaderboard by its Id.
134
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_participants_participant_id_submit_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_participants_participant_id_submit_post) | **POST** /leaderboard/{leaderboardId}/participants/{participantId}/submit | Submits a participant to a leaderboard.
135
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_participants_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_participants_post) | **POST** /leaderboard/{leaderboardId}/participants | Creates a participant in a leaderboard.
136
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_prompts_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_prompts_get) | **GET** /leaderboard/{leaderboardId}/prompts | returns the paged prompts of a leaderboard by its Id.
137
+ *LeaderboardApi* | [**leaderboard_leaderboard_id_prompts_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_prompts_post) | **POST** /leaderboard/{leaderboardId}/prompts | adds a new prompt to a leaderboard.
138
+ *LeaderboardApi* | [**leaderboard_participant_participant_id_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_participant_participant_id_get) | **GET** /leaderboard/participant/{participantId} | Gets a participant by its ID.
139
+ *LeaderboardApi* | [**leaderboard_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_post) | **POST** /leaderboard | Creates a new leaderboard with the specified name and criteria.
140
+ *LeaderboardApi* | [**leaderboards_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboards_get) | **GET** /leaderboards | Queries all leaderboards of the user.
131
141
  *NewsletterApi* | [**newsletter_subscribe_post**](rapidata/api_client/docs/NewsletterApi.md#newsletter_subscribe_post) | **POST** /newsletter/subscribe | Signs a user up to the newsletter.
132
142
  *NewsletterApi* | [**newsletter_unsubscribe_post**](rapidata/api_client/docs/NewsletterApi.md#newsletter_unsubscribe_post) | **POST** /newsletter/unsubscribe | Unsubscribes a user from the newsletter.
133
143
  *OrderApi* | [**order_approve_post**](rapidata/api_client/docs/OrderApi.md#order_approve_post) | **POST** /order/approve | Approves an order that has been submitted for manual approval.
@@ -259,6 +269,7 @@ Class | Method | HTTP request | Description
259
269
  - [ClassificationMetadataFilterConfig](rapidata/api_client/docs/ClassificationMetadataFilterConfig.md)
260
270
  - [ClassificationMetadataModel](rapidata/api_client/docs/ClassificationMetadataModel.md)
261
271
  - [ClassifyPayload](rapidata/api_client/docs/ClassifyPayload.md)
272
+ - [ClientModel](rapidata/api_client/docs/ClientModel.md)
262
273
  - [ClientsQueryResult](rapidata/api_client/docs/ClientsQueryResult.md)
263
274
  - [ClientsQueryResultPagedResult](rapidata/api_client/docs/ClientsQueryResultPagedResult.md)
264
275
  - [CloneDatasetModel](rapidata/api_client/docs/CloneDatasetModel.md)
@@ -287,10 +298,10 @@ Class | Method | HTTP request | Description
287
298
  - [CountryUserFilterModel](rapidata/api_client/docs/CountryUserFilterModel.md)
288
299
  - [CreateBridgeTokenResult](rapidata/api_client/docs/CreateBridgeTokenResult.md)
289
300
  - [CreateClientModel](rapidata/api_client/docs/CreateClientModel.md)
290
- - [CreateClientResult](rapidata/api_client/docs/CreateClientResult.md)
291
301
  - [CreateComplexOrderModel](rapidata/api_client/docs/CreateComplexOrderModel.md)
292
302
  - [CreateComplexOrderModelPipeline](rapidata/api_client/docs/CreateComplexOrderModelPipeline.md)
293
303
  - [CreateComplexOrderResult](rapidata/api_client/docs/CreateComplexOrderResult.md)
304
+ - [CreateCustomerClientResult](rapidata/api_client/docs/CreateCustomerClientResult.md)
294
305
  - [CreateDatapointFromFilesModel](rapidata/api_client/docs/CreateDatapointFromFilesModel.md)
295
306
  - [CreateDatapointFromTextSourcesModel](rapidata/api_client/docs/CreateDatapointFromTextSourcesModel.md)
296
307
  - [CreateDatapointFromUrlsModel](rapidata/api_client/docs/CreateDatapointFromUrlsModel.md)
@@ -300,6 +311,10 @@ Class | Method | HTTP request | Description
300
311
  - [CreateDatasetArtifactModelDataset](rapidata/api_client/docs/CreateDatasetArtifactModelDataset.md)
301
312
  - [CreateDemographicRapidModel](rapidata/api_client/docs/CreateDemographicRapidModel.md)
302
313
  - [CreateEmptyValidationSetResult](rapidata/api_client/docs/CreateEmptyValidationSetResult.md)
314
+ - [CreateLeaderboardModel](rapidata/api_client/docs/CreateLeaderboardModel.md)
315
+ - [CreateLeaderboardParticipantModel](rapidata/api_client/docs/CreateLeaderboardParticipantModel.md)
316
+ - [CreateLeaderboardParticipantResult](rapidata/api_client/docs/CreateLeaderboardParticipantResult.md)
317
+ - [CreateLeaderboardResult](rapidata/api_client/docs/CreateLeaderboardResult.md)
303
318
  - [CreateOrderModel](rapidata/api_client/docs/CreateOrderModel.md)
304
319
  - [CreateOrderModelReferee](rapidata/api_client/docs/CreateOrderModelReferee.md)
305
320
  - [CreateOrderModelUserFiltersInner](rapidata/api_client/docs/CreateOrderModelUserFiltersInner.md)
@@ -324,6 +339,7 @@ Class | Method | HTTP request | Description
324
339
  - [Demographic](rapidata/api_client/docs/Demographic.md)
325
340
  - [DemographicMetadataModel](rapidata/api_client/docs/DemographicMetadataModel.md)
326
341
  - [DemographicSelection](rapidata/api_client/docs/DemographicSelection.md)
342
+ - [DynamicClientRegistrationRequest](rapidata/api_client/docs/DynamicClientRegistrationRequest.md)
327
343
  - [EarlyStoppingRefereeModel](rapidata/api_client/docs/EarlyStoppingRefereeModel.md)
328
344
  - [EffortCappedSelection](rapidata/api_client/docs/EffortCappedSelection.md)
329
345
  - [EloConfig](rapidata/api_client/docs/EloConfig.md)
@@ -355,7 +371,9 @@ Class | Method | HTTP request | Description
355
371
  - [GetDatasetByIdResult](rapidata/api_client/docs/GetDatasetByIdResult.md)
356
372
  - [GetDatasetProgressResult](rapidata/api_client/docs/GetDatasetProgressResult.md)
357
373
  - [GetFailedDatapointsResult](rapidata/api_client/docs/GetFailedDatapointsResult.md)
374
+ - [GetLeaderboardByIdResult](rapidata/api_client/docs/GetLeaderboardByIdResult.md)
358
375
  - [GetOrderByIdResult](rapidata/api_client/docs/GetOrderByIdResult.md)
376
+ - [GetParticipantByIdResult](rapidata/api_client/docs/GetParticipantByIdResult.md)
359
377
  - [GetPipelineByIdResult](rapidata/api_client/docs/GetPipelineByIdResult.md)
360
378
  - [GetPipelineByIdResultArtifactsValue](rapidata/api_client/docs/GetPipelineByIdResultArtifactsValue.md)
361
379
  - [GetPublicOrdersResult](rapidata/api_client/docs/GetPublicOrdersResult.md)
@@ -379,8 +397,12 @@ Class | Method | HTTP request | Description
379
397
  - [ImportFromFileResult](rapidata/api_client/docs/ImportFromFileResult.md)
380
398
  - [ImportValidationSetFromFileResult](rapidata/api_client/docs/ImportValidationSetFromFileResult.md)
381
399
  - [InspectReportResult](rapidata/api_client/docs/InspectReportResult.md)
400
+ - [JsonWebKey](rapidata/api_client/docs/JsonWebKey.md)
401
+ - [JsonWebKeySet](rapidata/api_client/docs/JsonWebKeySet.md)
382
402
  - [LabelingSelection](rapidata/api_client/docs/LabelingSelection.md)
383
403
  - [LanguageUserFilterModel](rapidata/api_client/docs/LanguageUserFilterModel.md)
404
+ - [LeaderboardQueryResult](rapidata/api_client/docs/LeaderboardQueryResult.md)
405
+ - [LeaderboardQueryResultPagedResult](rapidata/api_client/docs/LeaderboardQueryResultPagedResult.md)
384
406
  - [Line](rapidata/api_client/docs/Line.md)
385
407
  - [LinePayload](rapidata/api_client/docs/LinePayload.md)
386
408
  - [LinePoint](rapidata/api_client/docs/LinePoint.md)
@@ -426,6 +448,9 @@ Class | Method | HTTP request | Description
426
448
  - [OriginalFilenameMetadata](rapidata/api_client/docs/OriginalFilenameMetadata.md)
427
449
  - [OriginalFilenameMetadataModel](rapidata/api_client/docs/OriginalFilenameMetadataModel.md)
428
450
  - [PageInfo](rapidata/api_client/docs/PageInfo.md)
451
+ - [ParticipantByLeaderboard](rapidata/api_client/docs/ParticipantByLeaderboard.md)
452
+ - [ParticipantByLeaderboardPagedResult](rapidata/api_client/docs/ParticipantByLeaderboardPagedResult.md)
453
+ - [ParticipantStatus](rapidata/api_client/docs/ParticipantStatus.md)
429
454
  - [PipelineIdWorkflowArtifactIdPutRequest](rapidata/api_client/docs/PipelineIdWorkflowArtifactIdPutRequest.md)
430
455
  - [PolygonPayload](rapidata/api_client/docs/PolygonPayload.md)
431
456
  - [PolygonRapidBlueprint](rapidata/api_client/docs/PolygonRapidBlueprint.md)
@@ -437,6 +462,8 @@ Class | Method | HTTP request | Description
437
462
  - [ProbabilisticAttachCategoryRefereeConfig](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeConfig.md)
438
463
  - [ProbabilisticAttachCategoryRefereeInfo](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeInfo.md)
439
464
  - [PromptAssetMetadataInput](rapidata/api_client/docs/PromptAssetMetadataInput.md)
465
+ - [PromptByLeaderboardResult](rapidata/api_client/docs/PromptByLeaderboardResult.md)
466
+ - [PromptByLeaderboardResultPagedResult](rapidata/api_client/docs/PromptByLeaderboardResultPagedResult.md)
440
467
  - [PromptMetadata](rapidata/api_client/docs/PromptMetadata.md)
441
468
  - [PromptMetadataInput](rapidata/api_client/docs/PromptMetadataInput.md)
442
469
  - [PromptMetadataModel](rapidata/api_client/docs/PromptMetadataModel.md)
@@ -3,20 +3,19 @@ from itertools import zip_longest
3
3
  from rapidata.api_client.models.create_datapoint_from_text_sources_model import CreateDatapointFromTextSourcesModel
4
4
  from rapidata.api_client.models.dataset_dataset_id_datapoints_post_request_metadata_inner import DatasetDatasetIdDatapointsPostRequestMetadataInner
5
5
  from rapidata.rapidata_client.metadata._base_metadata import Metadata
6
- from rapidata.rapidata_client.assets import TextAsset, MediaAsset, MultiAsset
6
+ from rapidata.rapidata_client.assets import TextAsset, MediaAsset, MultiAsset, BaseAsset
7
7
  from rapidata.service import LocalFileService
8
8
  from rapidata.service.openapi_service import OpenAPIService
9
9
  from concurrent.futures import ThreadPoolExecutor, as_completed
10
10
  from tqdm import tqdm
11
11
 
12
12
  from typing import cast, Sequence, Generator
13
- from rapidata.rapidata_client.logging import logger, RapidataOutputManager
13
+ from rapidata.rapidata_client.logging import logger, managed_print, RapidataOutputManager
14
14
  import time
15
15
  import threading
16
16
 
17
17
 
18
18
  def chunk_list(lst: list, chunk_size: int) -> Generator:
19
- """Split list into chunks to prevent resource exhaustion"""
20
19
  for i in range(0, len(lst), chunk_size):
21
20
  yield lst[i:i + chunk_size]
22
21
 
@@ -27,6 +26,43 @@ class RapidataDataset:
27
26
  self.openapi_service = openapi_service
28
27
  self.local_file_service = LocalFileService()
29
28
 
29
+ def _get_effective_asset_type(self, datapoints: Sequence[BaseAsset]) -> type:
30
+ if not datapoints:
31
+ raise ValueError("Cannot determine asset type from empty datapoints list.")
32
+
33
+ first_item = datapoints[0]
34
+
35
+ if isinstance(first_item, MultiAsset):
36
+ if not first_item.assets:
37
+ raise ValueError("MultiAsset cannot be empty.")
38
+ return type(first_item.assets[0])
39
+
40
+ return type(first_item)
41
+
42
+ def _add_datapoints(
43
+ self,
44
+ datapoints: Sequence[BaseAsset],
45
+ metadata_list: Sequence[Sequence[Metadata]] | None = None,
46
+ max_workers: int = 10,
47
+ ):
48
+ effective_asset_type = self._get_effective_asset_type(datapoints)
49
+
50
+ for item in datapoints:
51
+ if isinstance(item, MultiAsset):
52
+ if not all(isinstance(asset, effective_asset_type) for asset in item.assets):
53
+ raise ValueError("All MultiAssets must contain the same type of assets.")
54
+ elif not isinstance(item, (MediaAsset, TextAsset, MultiAsset)):
55
+ raise ValueError("All datapoints must be MediaAsset, TextAsset, or MultiAsset.")
56
+
57
+ if issubclass(effective_asset_type, MediaAsset):
58
+ media_datapoints = cast(list[MediaAsset] | list[MultiAsset], datapoints)
59
+ self._add_media_from_paths(media_datapoints, metadata_list, max_workers)
60
+ elif issubclass(effective_asset_type, TextAsset):
61
+ text_datapoints = cast(list[TextAsset] | list[MultiAsset], datapoints)
62
+ self._add_texts(text_datapoints, metadata_list)
63
+ else:
64
+ raise ValueError(f"Unsupported asset type: {effective_asset_type}")
65
+
30
66
  def _add_texts(
31
67
  self,
32
68
  text_assets: list[TextAsset] | list[MultiAsset],
@@ -60,7 +96,7 @@ class RapidataDataset:
60
96
  metadata=metadata,
61
97
  )
62
98
 
63
- upload_response = self.openapi_service.dataset_api.dataset_dataset_id_datapoints_texts_post(dataset_id=self.dataset_id, create_datapoint_from_text_sources_model=model)
99
+ self.openapi_service.dataset_api.dataset_dataset_id_datapoints_texts_post(dataset_id=self.dataset_id, create_datapoint_from_text_sources_model=model)
64
100
 
65
101
  total_uploads = len(text_assets)
66
102
  with ThreadPoolExecutor(max_workers=max_workers) as executor:
@@ -79,14 +115,16 @@ class RapidataDataset:
79
115
  media_asset: MediaAsset | MultiAsset,
80
116
  meta_list: Sequence[Metadata] | None,
81
117
  index: int,
118
+ max_retries: int = 3,
82
119
  ) -> tuple[list[str], list[str]]:
83
120
  """
84
- Process single upload with error tracking.
121
+ Process single upload with retry logic and error tracking.
85
122
 
86
123
  Args:
87
124
  media_asset: MediaAsset or MultiAsset to upload
88
125
  meta_list: Optional sequence of metadata for the asset
89
126
  index: Sort index for the upload
127
+ max_retries: Maximum number of retry attempts (default: 3)
90
128
 
91
129
  Returns:
92
130
  tuple[list[str], list[str]]: Lists of successful and failed identifiers
@@ -95,44 +133,56 @@ class RapidataDataset:
95
133
  local_failed: list[str] = []
96
134
  identifiers_to_track: list[str] = []
97
135
 
98
- try:
99
- # Get identifier for this upload (URL or file path)
100
- if isinstance(media_asset, MediaAsset):
101
- assets = [media_asset]
102
- identifier = media_asset._url if media_asset._url else media_asset.path
103
- identifiers_to_track = [identifier] if identifier else []
104
- elif isinstance(media_asset, MultiAsset):
105
- assets = cast(list[MediaAsset], media_asset.assets)
106
- identifiers_to_track = [
107
- (asset._url if asset._url else cast(str, asset.path))
108
- for asset in assets
109
- ]
110
- else:
111
- raise ValueError(f"Unsupported asset type: {type(media_asset)}")
112
-
113
- metadata: list[DatasetDatasetIdDatapointsPostRequestMetadataInner] = []
114
- if meta_list:
115
- for meta in meta_list:
116
- meta_model = meta.to_model() if meta else None
117
- if meta_model:
118
- metadata.append(DatasetDatasetIdDatapointsPostRequestMetadataInner(meta_model))
119
-
120
- local_paths = [asset.to_file() for asset in assets if asset.is_local()]
121
- urls = [asset.path for asset in assets if not asset.is_local()]
136
+ # Get identifier for this upload (URL or file path)
137
+ if isinstance(media_asset, MediaAsset):
138
+ assets = [media_asset]
139
+ identifier = media_asset._url if media_asset._url else media_asset.path
140
+ identifiers_to_track = [identifier] if identifier else []
141
+ elif isinstance(media_asset, MultiAsset):
142
+ assets = cast(list[MediaAsset], media_asset.assets)
143
+ identifiers_to_track = [
144
+ (asset._url if asset._url else cast(str, asset.path))
145
+ for asset in assets
146
+ ]
147
+ else:
148
+ raise ValueError(f"Unsupported asset type: {type(media_asset)}")
122
149
 
123
- self.openapi_service.dataset_api.dataset_dataset_id_datapoints_post(
124
- dataset_id=self.dataset_id,
125
- file=local_paths,
126
- url=urls,
127
- metadata=metadata,
128
- sort_index=index,
129
- )
150
+ metadata: list[DatasetDatasetIdDatapointsPostRequestMetadataInner] = []
151
+ if meta_list:
152
+ for meta in meta_list:
153
+ meta_model = meta.to_model() if meta else None
154
+ if meta_model:
155
+ metadata.append(DatasetDatasetIdDatapointsPostRequestMetadataInner(meta_model))
130
156
 
131
- local_successful.extend(identifiers_to_track)
157
+ local_paths = [asset.to_file() for asset in assets if asset.is_local()]
158
+ urls = [asset.path for asset in assets if not asset.is_local()]
132
159
 
133
- except Exception as e:
134
- logger.error(f"\nUpload failed for {identifiers_to_track}: {str(e)}") # \n to avoid same line as tqdm
135
- local_failed.extend(identifiers_to_track)
160
+ last_exception = None
161
+ for attempt in range(max_retries):
162
+ try:
163
+ self.openapi_service.dataset_api.dataset_dataset_id_datapoints_post(
164
+ dataset_id=self.dataset_id,
165
+ file=local_paths,
166
+ url=urls,
167
+ metadata=metadata,
168
+ sort_index=index,
169
+ )
170
+
171
+ # If we get here, the upload was successful
172
+ local_successful.extend(identifiers_to_track)
173
+ return local_successful, local_failed
174
+
175
+ except Exception as e:
176
+ last_exception = e
177
+ if attempt < max_retries - 1:
178
+ # Exponential backoff: wait 1s, then 2s, then 4s
179
+ retry_delay = 2 ** attempt
180
+ time.sleep(retry_delay)
181
+ managed_print(f"\nRetrying {attempt + 1} of {max_retries}...\n")
182
+
183
+ # If we get here, all retries failed
184
+ logger.error(f"\nUpload failed for {identifiers_to_track} after {max_retries} attempts. Final error: {str(last_exception)}")
185
+ local_failed.extend(identifiers_to_track)
136
186
 
137
187
  return local_successful, local_failed
138
188
 
@@ -341,7 +391,7 @@ class RapidataDataset:
341
391
  self,
342
392
  media_paths: list[MediaAsset] | list[MultiAsset],
343
393
  multi_metadata: Sequence[Sequence[Metadata]] | None = None,
344
- max_workers: int = 5,
394
+ max_workers: int = 10,
345
395
  chunk_size: int = 50,
346
396
  progress_poll_interval: float = 0.5,
347
397
  ) -> tuple[list[str], list[str]]: