rapidata 2.27.5__py3-none-any.whl → 2.28.0__py3-none-any.whl

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

Potentially problematic release.


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

Files changed (44) hide show
  1. rapidata/__init__.py +3 -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/__init__.py +2 -0
  27. rapidata/rapidata_client/leaderboard/__init__.py +0 -0
  28. rapidata/rapidata_client/leaderboard/rapidata_leaderboard.py +127 -0
  29. rapidata/rapidata_client/leaderboard/rapidata_leaderboard_manager.py +80 -0
  30. rapidata/rapidata_client/order/rapidata_order.py +0 -1
  31. rapidata/rapidata_client/order/rapidata_order_manager.py +5 -5
  32. rapidata/rapidata_client/order/rapidata_results.py +17 -9
  33. rapidata/rapidata_client/rapidata_client.py +4 -0
  34. rapidata/rapidata_client/selection/__init__.py +1 -0
  35. rapidata/rapidata_client/selection/effort_selection.py +19 -0
  36. rapidata/rapidata_client/settings/__init__.py +1 -0
  37. rapidata/rapidata_client/settings/allow_neither_both.py +15 -0
  38. rapidata/rapidata_client/settings/rapidata_settings.py +3 -1
  39. rapidata/rapidata_client/validation/validation_set_manager.py +14 -0
  40. rapidata/service/openapi_service.py +5 -0
  41. {rapidata-2.27.5.dist-info → rapidata-2.28.0.dist-info}/METADATA +1 -1
  42. {rapidata-2.27.5.dist-info → rapidata-2.28.0.dist-info}/RECORD +44 -20
  43. {rapidata-2.27.5.dist-info → rapidata-2.28.0.dist-info}/LICENSE +0 -0
  44. {rapidata-2.27.5.dist-info → rapidata-2.28.0.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)
@@ -7,6 +7,7 @@ from .selection import (
7
7
  CappedSelection,
8
8
  ShufflingSelection,
9
9
  RetrievalMode,
10
+ EffortEstimationSelection,
10
11
  )
11
12
  from .metadata import (
12
13
  PrivateTextMetadata,
@@ -23,6 +24,7 @@ from .settings import (
23
24
  NoShuffle,
24
25
  PlayVideoUntilTheEnd,
25
26
  CustomSetting,
27
+ AllowNeitherBoth,
26
28
  )
27
29
  from .country_codes import CountryCodes
28
30
  from .assets import (
File without changes
@@ -0,0 +1,127 @@
1
+ from rapidata.api_client.models.create_leaderboard_participant_model import CreateLeaderboardParticipantModel
2
+ from rapidata.api_client.models.page_info import PageInfo
3
+ from rapidata.api_client.models.query_model import QueryModel
4
+
5
+ from rapidata.rapidata_client.order._rapidata_dataset import RapidataDataset
6
+ from rapidata.rapidata_client.assets import MediaAsset
7
+ from rapidata.rapidata_client.metadata import PromptMetadata
8
+ from rapidata.service.openapi_service import OpenAPIService
9
+
10
+
11
+ class RapidataLeaderboard:
12
+ """
13
+ An instance of a Rapidata leaderboard.
14
+
15
+ Used to interact with a specific leaderboard in the Rapidata system, such as retrieving prompts and evaluating models.
16
+
17
+ Args:
18
+ name: The name that will be used to identify the leaderboard on the overview.
19
+ instruction: The instruction that will determine what how the models will be evaluated.
20
+ show_prompt: Whether to show the prompt to the users.
21
+ id: The ID of the leaderboard.
22
+ openapi_service: The OpenAPIService instance for API interaction.
23
+ """
24
+ def __init__(self, name: str, instruction: str, show_prompt: bool, id: str, openapi_service: OpenAPIService):
25
+ self.__openapi_service = openapi_service
26
+ self.name = name
27
+ self.instruction = instruction
28
+ self.show_prompt = show_prompt
29
+ self._prompts: list[str] = []
30
+ self.id = id
31
+
32
+ @property
33
+ def prompts(self) -> list[str]:
34
+ """
35
+ Returns the prompts that are registered for the leaderboard.
36
+ """
37
+ if not self._prompts:
38
+ current_page = 1
39
+ total_pages = None
40
+
41
+ while True:
42
+ prompts_result = self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_prompts_get(
43
+ leaderboard_id=self.id,
44
+ request=QueryModel(
45
+ page=PageInfo(
46
+ index=current_page,
47
+ size=100
48
+ )
49
+ )
50
+ )
51
+
52
+ if prompts_result.total_pages is None:
53
+ raise ValueError("An error occurred while fetching prompts: total_pages is None")
54
+
55
+ total_pages = prompts_result.total_pages
56
+
57
+ self._prompts.extend([prompt.prompt for prompt in prompts_result.items])
58
+
59
+ if current_page >= total_pages:
60
+ break
61
+
62
+ current_page += 1
63
+
64
+ return self._prompts
65
+
66
+ def _register_prompts(self, prompts: list[str]):
67
+ """
68
+ Registers the prompts for the leaderboard.
69
+ """
70
+ for prompt in prompts:
71
+ self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_prompts_post(
72
+ leaderboard_id=self.id,
73
+ body=prompt
74
+ )
75
+ self._prompts = prompts
76
+
77
+ def evaluate_model(self, name: str, media: list[str], prompts: list[str]) -> None:
78
+ """
79
+ Evaluates a model on the leaderboard.
80
+
81
+ Args:
82
+ name: The name of the model.
83
+ media: The generated images/videos that will be used to evaluate the model.
84
+ prompts: The prompts that correspond to the media. The order of the prompts must match the order of the media.
85
+ The prompts that are used must be registered for the leaderboard. To see the registered prompts, use the prompts property.
86
+ """
87
+ if not media:
88
+ raise ValueError("Media must be a non-empty list of strings")
89
+
90
+ if len(media) != len(prompts):
91
+ raise ValueError("Media and prompts must have the same length")
92
+
93
+ if not all(prompt in self.prompts for prompt in prompts):
94
+ raise ValueError("All prompts must be in the registered prompts list. To see the registered prompts, use the prompts property.")
95
+
96
+ # happens before the creation of the participant to ensure all media paths are valid
97
+ assets = []
98
+ prompts_metadata: list[list[PromptMetadata]] = []
99
+ for media_path, prompt in zip(media, prompts):
100
+ assets.append(MediaAsset(media_path))
101
+ prompts_metadata.append([PromptMetadata(prompt)])
102
+
103
+ participant_result = self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_participants_post(
104
+ leaderboard_id=self.id,
105
+ create_leaderboard_participant_model=CreateLeaderboardParticipantModel(
106
+ name=name,
107
+ )
108
+ )
109
+ dataset = RapidataDataset(participant_result.dataset_id, self.__openapi_service)
110
+
111
+ dataset._add_datapoints(assets, prompts_metadata)
112
+
113
+ self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_participants_participant_id_submit_post(
114
+ leaderboard_id=self.id,
115
+ participant_id=participant_result.participant_id
116
+ )
117
+
118
+ def __str__(self) -> str:
119
+ return f"RapidataLeaderboard(name={self.name}, instruction={self.instruction}, show_prompt={self.show_prompt}, leaderboard_id={self.id})"
120
+
121
+ def __repr__(self) -> str:
122
+ return self.__str__()
123
+
124
+
125
+
126
+
127
+