rapidata 2.28.5__py3-none-any.whl → 2.29.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/__init__.py +1 -1
- rapidata/api_client/__init__.py +45 -8
- rapidata/api_client/api/__init__.py +1 -0
- rapidata/api_client/api/benchmark_api.py +3033 -0
- rapidata/api_client/api/customer_rapid_api.py +332 -1
- rapidata/api_client/api/dataset_api.py +16 -0
- rapidata/api_client/api/leaderboard_api.py +1392 -270
- rapidata/api_client/models/__init__.py +44 -8
- rapidata/api_client/models/add_campaign_model.py +3 -3
- rapidata/api_client/models/and_user_filter_model.py +106 -0
- rapidata/api_client/models/and_user_filter_model_filters_inner.py +282 -0
- rapidata/api_client/models/benchmark_query_result.py +94 -0
- rapidata/api_client/models/benchmark_query_result_paged_result.py +105 -0
- rapidata/api_client/models/boost_leaderboard_model.py +89 -0
- rapidata/api_client/models/create_benchmark_model.py +87 -0
- rapidata/api_client/models/create_benchmark_participant_model.py +87 -0
- rapidata/api_client/models/create_benchmark_participant_result.py +89 -0
- rapidata/api_client/models/create_benchmark_result.py +87 -0
- rapidata/api_client/models/create_datapoint_result.py +4 -16
- rapidata/api_client/models/create_leaderboard_model.py +20 -2
- rapidata/api_client/models/create_leaderboard_result.py +15 -3
- rapidata/api_client/models/create_order_model.py +3 -3
- rapidata/api_client/models/file_asset_input.py +104 -0
- rapidata/api_client/models/file_asset_input1.py +104 -0
- rapidata/api_client/models/file_asset_input1_file.py +168 -0
- rapidata/api_client/models/file_asset_input2.py +104 -0
- rapidata/api_client/models/file_asset_input3.py +104 -0
- rapidata/api_client/models/file_asset_input_file.py +182 -0
- rapidata/api_client/models/form_file_wrapper.py +120 -0
- rapidata/api_client/models/get_benchmark_by_id_query.py +96 -0
- rapidata/api_client/models/get_benchmark_by_id_query_result.py +94 -0
- rapidata/api_client/models/get_benchmark_by_id_query_result_paged_result.py +105 -0
- rapidata/api_client/models/get_benchmark_by_id_result.py +94 -0
- rapidata/api_client/models/get_leaderboard_by_id_result.py +11 -3
- rapidata/api_client/models/get_participant_by_id_result.py +6 -26
- rapidata/api_client/models/get_standing_by_id_result.py +113 -0
- rapidata/api_client/models/leaderboard_query_result.py +11 -3
- rapidata/api_client/models/local_file_wrapper.py +120 -0
- rapidata/api_client/models/multi_asset_input.py +110 -0
- rapidata/api_client/models/multi_asset_input1.py +110 -0
- rapidata/api_client/models/multi_asset_input1_assets_inner.py +170 -0
- rapidata/api_client/models/multi_asset_input2.py +110 -0
- rapidata/api_client/models/multi_asset_input3.py +110 -0
- rapidata/api_client/models/multi_asset_input3_assets_inner.py +170 -0
- rapidata/api_client/models/multi_asset_input_assets_inner.py +170 -0
- rapidata/api_client/models/not_user_filter_model.py +3 -3
- rapidata/api_client/models/or_user_filter_model.py +3 -3
- rapidata/api_client/models/participant_by_benchmark.py +102 -0
- rapidata/api_client/models/participant_by_benchmark_paged_result.py +105 -0
- rapidata/api_client/models/participant_status.py +1 -4
- rapidata/api_client/models/potential_validation_rapid.py +103 -0
- rapidata/api_client/models/potential_validation_rapid_paged_result.py +105 -0
- rapidata/api_client/models/potential_validation_rapid_truth.py +280 -0
- rapidata/api_client/models/prompt_asset_metadata_input.py +3 -3
- rapidata/api_client/models/prompt_asset_metadata_input_asset.py +170 -0
- rapidata/api_client/models/prompt_by_benchmark_result.py +92 -0
- rapidata/api_client/models/prompt_by_benchmark_result_paged_result.py +105 -0
- rapidata/api_client/models/prompt_metadata_input.py +5 -3
- rapidata/api_client/models/proxy_file_wrapper.py +114 -0
- rapidata/api_client/models/query_validation_model.py +97 -0
- rapidata/api_client/models/standing_by_leaderboard.py +113 -0
- rapidata/api_client/models/standing_by_leaderboard_paged_result.py +105 -0
- rapidata/api_client/models/standing_status.py +38 -0
- rapidata/api_client/models/stream_file_wrapper.py +116 -0
- rapidata/api_client/models/submit_prompt_model.py +105 -0
- rapidata/api_client/models/submit_prompt_model_prompt_asset.py +174 -0
- rapidata/api_client/models/text_asset_input.py +100 -0
- rapidata/api_client/models/transcription_metadata_input.py +5 -3
- rapidata/api_client/models/zip_entry_file_wrapper.py +120 -0
- rapidata/api_client_README.md +67 -16
- rapidata/rapidata_client/benchmark/leaderboard/__init__.py +0 -0
- rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py +115 -0
- rapidata/rapidata_client/benchmark/rapidata_benchmark.py +256 -0
- rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py +83 -0
- rapidata/rapidata_client/filter/not_filter.py +2 -2
- rapidata/rapidata_client/filter/or_filter.py +2 -2
- rapidata/rapidata_client/metadata/__init__.py +1 -0
- rapidata/rapidata_client/metadata/_media_asset_metadata.py +8 -1
- rapidata/rapidata_client/metadata/_prompt_identifier_metadata.py +15 -0
- rapidata/rapidata_client/order/_rapidata_dataset.py +6 -6
- rapidata/rapidata_client/order/_rapidata_order_builder.py +4 -4
- rapidata/rapidata_client/rapidata_client.py +3 -3
- rapidata/service/openapi_service.py +5 -0
- {rapidata-2.28.5.dist-info → rapidata-2.29.1.dist-info}/METADATA +1 -1
- {rapidata-2.28.5.dist-info → rapidata-2.29.1.dist-info}/RECORD +88 -37
- rapidata/rapidata_client/leaderboard/rapidata_leaderboard.py +0 -127
- rapidata/rapidata_client/leaderboard/rapidata_leaderboard_manager.py +0 -92
- /rapidata/rapidata_client/{leaderboard → benchmark}/__init__.py +0 -0
- {rapidata-2.28.5.dist-info → rapidata-2.29.1.dist-info}/LICENSE +0 -0
- {rapidata-2.28.5.dist-info → rapidata-2.29.1.dist-info}/WHEEL +0 -0
rapidata/api_client_README.md
CHANGED
|
@@ -55,15 +55,14 @@ configuration.api_key['bearer'] = os.environ["API_KEY"]
|
|
|
55
55
|
# Enter a context with an instance of the API client
|
|
56
56
|
with rapidata.api_client.ApiClient(configuration) as api_client:
|
|
57
57
|
# Create an instance of the API class
|
|
58
|
-
api_instance = rapidata.api_client.
|
|
58
|
+
api_instance = rapidata.api_client.BenchmarkApi(api_client)
|
|
59
|
+
benchmark_id = 'benchmark_id_example' # str |
|
|
59
60
|
|
|
60
61
|
try:
|
|
61
|
-
#
|
|
62
|
-
|
|
63
|
-
print("The response of CampaignApi->campaign_boost_status_get:\n")
|
|
64
|
-
pprint(api_response)
|
|
62
|
+
# Deletes a single benchmark.
|
|
63
|
+
api_instance.benchmark_benchmark_id_delete(benchmark_id)
|
|
65
64
|
except ApiException as e:
|
|
66
|
-
print("Exception when calling
|
|
65
|
+
print("Exception when calling BenchmarkApi->benchmark_benchmark_id_delete: %s\n" % e)
|
|
67
66
|
|
|
68
67
|
```
|
|
69
68
|
|
|
@@ -73,6 +72,17 @@ All URIs are relative to *http://localhost*
|
|
|
73
72
|
|
|
74
73
|
Class | Method | HTTP request | Description
|
|
75
74
|
------------ | ------------- | ------------- | -------------
|
|
75
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_delete**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_delete) | **DELETE** /benchmark/{benchmarkId} | Deletes a single benchmark.
|
|
76
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_get**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_get) | **GET** /benchmark/{benchmarkId} | Returns a single benchmark by its ID.
|
|
77
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_participant_participant_id_delete**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_participant_participant_id_delete) | **DELETE** /benchmark/{benchmarkId}/participant/{participantId} | Deletes a participant on a benchmark.
|
|
78
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_participant_participant_id_get**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_participant_participant_id_get) | **GET** /benchmark/{benchmarkId}/participant/{participantId} | Gets a participant by it's Id.
|
|
79
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_participants_get**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_participants_get) | **GET** /benchmark/{benchmarkId}/participants | Query all participants within a benchmark
|
|
80
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_participants_participant_id_submit_post**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_participants_participant_id_submit_post) | **POST** /benchmark/{benchmarkId}/participants/{participantId}/submit | Submits a participant to a benchmark.
|
|
81
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_participants_post**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_participants_post) | **POST** /benchmark/{benchmarkId}/participants | Creates a participant in a benchmark.
|
|
82
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_prompt_post**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_prompt_post) | **POST** /benchmark/{benchmarkId}/prompt | Adds a new prompt to a benchmark.
|
|
83
|
+
*BenchmarkApi* | [**benchmark_benchmark_id_prompts_get**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_benchmark_id_prompts_get) | **GET** /benchmark/{benchmarkId}/prompts | Returns the paged prompts of a benchmark by its ID.
|
|
84
|
+
*BenchmarkApi* | [**benchmark_post**](rapidata/api_client/docs/BenchmarkApi.md#benchmark_post) | **POST** /benchmark | Creates a benchmark
|
|
85
|
+
*BenchmarkApi* | [**benchmarks_get**](rapidata/api_client/docs/BenchmarkApi.md#benchmarks_get) | **GET** /benchmarks | Queries all benchmarks of the user.
|
|
76
86
|
*CampaignApi* | [**campaign_boost_status_get**](rapidata/api_client/docs/CampaignApi.md#campaign_boost_status_get) | **GET** /campaign/boost/status | Gets the status of the boost.
|
|
77
87
|
*CampaignApi* | [**campaign_campaign_id_pause_post**](rapidata/api_client/docs/CampaignApi.md#campaign_campaign_id_pause_post) | **POST** /campaign/{campaignId}/pause | Pauses a campaign.
|
|
78
88
|
*CampaignApi* | [**campaign_campaign_id_resume_post**](rapidata/api_client/docs/CampaignApi.md#campaign_campaign_id_resume_post) | **POST** /campaign/{campaignId}/resume | Resumes a campaign.
|
|
@@ -86,6 +96,7 @@ Class | Method | HTTP request | Description
|
|
|
86
96
|
*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.
|
|
87
97
|
*CocoApi* | [**coco_post**](rapidata/api_client/docs/CocoApi.md#coco_post) | **POST** /coco | Uploads a CoCo set to the system.
|
|
88
98
|
*CompareWorkflowApi* | [**workflow_compare_workflow_id_results_get**](rapidata/api_client/docs/CompareWorkflowApi.md#workflow_compare_workflow_id_results_get) | **GET** /workflow/compare/{workflowId}/results | Get the result overview for a compare workflow.
|
|
99
|
+
*CustomerRapidApi* | [**rapid_correlation_id_validation_potential_get**](rapidata/api_client/docs/CustomerRapidApi.md#rapid_correlation_id_validation_potential_get) | **GET** /rapid/{correlationId}/validation-potential | Queries rapids that are potentially eligible for validation set creation.
|
|
89
100
|
*CustomerRapidApi* | [**rapid_demographic_post**](rapidata/api_client/docs/CustomerRapidApi.md#rapid_demographic_post) | **POST** /rapid/demographic | Creates a new Demographic Rapid.
|
|
90
101
|
*CustomerRapidApi* | [**rapid_rapid_id_delete**](rapidata/api_client/docs/CustomerRapidApi.md#rapid_rapid_id_delete) | **DELETE** /rapid/{rapidId} | Deletes a rapid.
|
|
91
102
|
*CustomerRapidApi* | [**rapid_rapid_id_responses_get**](rapidata/api_client/docs/CustomerRapidApi.md#rapid_rapid_id_responses_get) | **GET** /rapid/{rapidId}/responses | Gets all responses for a given rapid.
|
|
@@ -112,14 +123,18 @@ Class | Method | HTTP request | Description
|
|
|
112
123
|
*IdentityApi* | [**identity_google_one_tap_post**](rapidata/api_client/docs/IdentityApi.md#identity_google_one_tap_post) | **POST** /identity/google-one-tap | Signs in a user using a token received from Google One Tap.
|
|
113
124
|
*IdentityApi* | [**identity_referrer_post**](rapidata/api_client/docs/IdentityApi.md#identity_referrer_post) | **POST** /identity/referrer | Sets the referrer for the current customer.
|
|
114
125
|
*IdentityApi* | [**identity_temporary_post**](rapidata/api_client/docs/IdentityApi.md#identity_temporary_post) | **POST** /identity/temporary | Registers and logs in a temporary customer.
|
|
126
|
+
*LeaderboardApi* | [**benchmark_standing_leaderboard_id_participant_id_get**](rapidata/api_client/docs/LeaderboardApi.md#benchmark_standing_leaderboard_id_participant_id_get) | **GET** /benchmark/standing/{leaderboardId}/{participantId} | Gets a standing by leaderboardId and participantId.
|
|
127
|
+
*LeaderboardApi* | [**leaderboard_leaderboard_id_boost_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_boost_post) | **POST** /leaderboard/{leaderboardId}/boost | Boosts a subset of participants within a leaderboard.
|
|
115
128
|
*LeaderboardApi* | [**leaderboard_leaderboard_id_delete**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_delete) | **DELETE** /leaderboard/{leaderboardId} | Deletes a leaderboard by its ID.
|
|
116
129
|
*LeaderboardApi* | [**leaderboard_leaderboard_id_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_get) | **GET** /leaderboard/{leaderboardId} | Gets a leaderboard by its ID.
|
|
117
|
-
*LeaderboardApi* | [**
|
|
130
|
+
*LeaderboardApi* | [**leaderboard_leaderboard_id_participant_participant_id_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_participant_participant_id_get) | **GET** /leaderboard/{leaderboardId}/participant/{participantId} | Gets a participant by its ID.
|
|
131
|
+
*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 connected to leaderboard by its ID.
|
|
118
132
|
*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.
|
|
119
133
|
*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.
|
|
120
134
|
*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.
|
|
121
135
|
*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.
|
|
122
|
-
*LeaderboardApi* | [**
|
|
136
|
+
*LeaderboardApi* | [**leaderboard_leaderboard_id_refresh_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_refresh_post) | **POST** /leaderboard/{leaderboardId}/refresh | This will force an update to all standings of a leaderboard. this could happen if the recorded matches and scores are out of sync
|
|
137
|
+
*LeaderboardApi* | [**leaderboard_leaderboard_id_standings_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_leaderboard_id_standings_get) | **GET** /leaderboard/{leaderboardId}/standings | queries all the participants connected to leaderboard by its ID.
|
|
123
138
|
*LeaderboardApi* | [**leaderboard_post**](rapidata/api_client/docs/LeaderboardApi.md#leaderboard_post) | **POST** /leaderboard | Creates a new leaderboard with the specified name and criteria.
|
|
124
139
|
*LeaderboardApi* | [**leaderboards_get**](rapidata/api_client/docs/LeaderboardApi.md#leaderboards_get) | **GET** /leaderboards | Queries all leaderboards of the user.
|
|
125
140
|
*NewsletterApi* | [**newsletter_subscribe_post**](rapidata/api_client/docs/NewsletterApi.md#newsletter_subscribe_post) | **POST** /newsletter/subscribe | Signs a user up to the newsletter.
|
|
@@ -195,6 +210,8 @@ Class | Method | HTTP request | Description
|
|
|
195
210
|
- [AgeGroup](rapidata/api_client/docs/AgeGroup.md)
|
|
196
211
|
- [AgeUserFilterModel](rapidata/api_client/docs/AgeUserFilterModel.md)
|
|
197
212
|
- [AggregatorType](rapidata/api_client/docs/AggregatorType.md)
|
|
213
|
+
- [AndUserFilterModel](rapidata/api_client/docs/AndUserFilterModel.md)
|
|
214
|
+
- [AndUserFilterModelFiltersInner](rapidata/api_client/docs/AndUserFilterModelFiltersInner.md)
|
|
198
215
|
- [AreRapidsActiveResult](rapidata/api_client/docs/AreRapidsActiveResult.md)
|
|
199
216
|
- [AssetMetadata](rapidata/api_client/docs/AssetMetadata.md)
|
|
200
217
|
- [AssetMetadataAsset](rapidata/api_client/docs/AssetMetadataAsset.md)
|
|
@@ -202,7 +219,9 @@ Class | Method | HTTP request | Description
|
|
|
202
219
|
- [AttachCategoryRapidBlueprint](rapidata/api_client/docs/AttachCategoryRapidBlueprint.md)
|
|
203
220
|
- [AttachCategoryResult](rapidata/api_client/docs/AttachCategoryResult.md)
|
|
204
221
|
- [AttachCategoryTruth](rapidata/api_client/docs/AttachCategoryTruth.md)
|
|
205
|
-
- [
|
|
222
|
+
- [BenchmarkQueryResult](rapidata/api_client/docs/BenchmarkQueryResult.md)
|
|
223
|
+
- [BenchmarkQueryResultPagedResult](rapidata/api_client/docs/BenchmarkQueryResultPagedResult.md)
|
|
224
|
+
- [BoostLeaderboardModel](rapidata/api_client/docs/BoostLeaderboardModel.md)
|
|
206
225
|
- [BoostQueryResult](rapidata/api_client/docs/BoostQueryResult.md)
|
|
207
226
|
- [BoostStatus](rapidata/api_client/docs/BoostStatus.md)
|
|
208
227
|
- [BoundingBoxPayload](rapidata/api_client/docs/BoundingBoxPayload.md)
|
|
@@ -247,6 +266,10 @@ Class | Method | HTTP request | Description
|
|
|
247
266
|
- [CountMetadata](rapidata/api_client/docs/CountMetadata.md)
|
|
248
267
|
- [CountMetadataModel](rapidata/api_client/docs/CountMetadataModel.md)
|
|
249
268
|
- [CountryUserFilterModel](rapidata/api_client/docs/CountryUserFilterModel.md)
|
|
269
|
+
- [CreateBenchmarkModel](rapidata/api_client/docs/CreateBenchmarkModel.md)
|
|
270
|
+
- [CreateBenchmarkParticipantModel](rapidata/api_client/docs/CreateBenchmarkParticipantModel.md)
|
|
271
|
+
- [CreateBenchmarkParticipantResult](rapidata/api_client/docs/CreateBenchmarkParticipantResult.md)
|
|
272
|
+
- [CreateBenchmarkResult](rapidata/api_client/docs/CreateBenchmarkResult.md)
|
|
250
273
|
- [CreateBridgeTokenResult](rapidata/api_client/docs/CreateBridgeTokenResult.md)
|
|
251
274
|
- [CreateClientModel](rapidata/api_client/docs/CreateClientModel.md)
|
|
252
275
|
- [CreateComplexOrderModel](rapidata/api_client/docs/CreateComplexOrderModel.md)
|
|
@@ -263,12 +286,9 @@ Class | Method | HTTP request | Description
|
|
|
263
286
|
- [CreateDemographicRapidModel](rapidata/api_client/docs/CreateDemographicRapidModel.md)
|
|
264
287
|
- [CreateEmptyValidationSetResult](rapidata/api_client/docs/CreateEmptyValidationSetResult.md)
|
|
265
288
|
- [CreateLeaderboardModel](rapidata/api_client/docs/CreateLeaderboardModel.md)
|
|
266
|
-
- [CreateLeaderboardParticipantModel](rapidata/api_client/docs/CreateLeaderboardParticipantModel.md)
|
|
267
|
-
- [CreateLeaderboardParticipantResult](rapidata/api_client/docs/CreateLeaderboardParticipantResult.md)
|
|
268
289
|
- [CreateLeaderboardResult](rapidata/api_client/docs/CreateLeaderboardResult.md)
|
|
269
290
|
- [CreateOrderModel](rapidata/api_client/docs/CreateOrderModel.md)
|
|
270
291
|
- [CreateOrderModelReferee](rapidata/api_client/docs/CreateOrderModelReferee.md)
|
|
271
|
-
- [CreateOrderModelUserFiltersInner](rapidata/api_client/docs/CreateOrderModelUserFiltersInner.md)
|
|
272
292
|
- [CreateOrderModelWorkflow](rapidata/api_client/docs/CreateOrderModelWorkflow.md)
|
|
273
293
|
- [CreateOrderResult](rapidata/api_client/docs/CreateOrderResult.md)
|
|
274
294
|
- [CreateRapidResult](rapidata/api_client/docs/CreateRapidResult.md)
|
|
@@ -303,6 +323,12 @@ Class | Method | HTTP request | Description
|
|
|
303
323
|
- [FeedbackModel](rapidata/api_client/docs/FeedbackModel.md)
|
|
304
324
|
- [FileArtifactModel](rapidata/api_client/docs/FileArtifactModel.md)
|
|
305
325
|
- [FileAsset](rapidata/api_client/docs/FileAsset.md)
|
|
326
|
+
- [FileAssetInput](rapidata/api_client/docs/FileAssetInput.md)
|
|
327
|
+
- [FileAssetInput1](rapidata/api_client/docs/FileAssetInput1.md)
|
|
328
|
+
- [FileAssetInput1File](rapidata/api_client/docs/FileAssetInput1File.md)
|
|
329
|
+
- [FileAssetInput2](rapidata/api_client/docs/FileAssetInput2.md)
|
|
330
|
+
- [FileAssetInput3](rapidata/api_client/docs/FileAssetInput3.md)
|
|
331
|
+
- [FileAssetInputFile](rapidata/api_client/docs/FileAssetInputFile.md)
|
|
306
332
|
- [FileAssetModel](rapidata/api_client/docs/FileAssetModel.md)
|
|
307
333
|
- [FileAssetModelMetadataValue](rapidata/api_client/docs/FileAssetModelMetadataValue.md)
|
|
308
334
|
- [FileType](rapidata/api_client/docs/FileType.md)
|
|
@@ -310,12 +336,14 @@ Class | Method | HTTP request | Description
|
|
|
310
336
|
- [FileTypeMetadataModel](rapidata/api_client/docs/FileTypeMetadataModel.md)
|
|
311
337
|
- [Filter](rapidata/api_client/docs/Filter.md)
|
|
312
338
|
- [FilterOperator](rapidata/api_client/docs/FilterOperator.md)
|
|
339
|
+
- [FormFileWrapper](rapidata/api_client/docs/FormFileWrapper.md)
|
|
313
340
|
- [FreeTextPayload](rapidata/api_client/docs/FreeTextPayload.md)
|
|
314
341
|
- [FreeTextRapidBlueprint](rapidata/api_client/docs/FreeTextRapidBlueprint.md)
|
|
315
342
|
- [FreeTextResult](rapidata/api_client/docs/FreeTextResult.md)
|
|
316
343
|
- [Gender](rapidata/api_client/docs/Gender.md)
|
|
317
344
|
- [GenderUserFilterModel](rapidata/api_client/docs/GenderUserFilterModel.md)
|
|
318
345
|
- [GetAvailableValidationSetsResult](rapidata/api_client/docs/GetAvailableValidationSetsResult.md)
|
|
346
|
+
- [GetBenchmarkByIdResult](rapidata/api_client/docs/GetBenchmarkByIdResult.md)
|
|
319
347
|
- [GetCompareAbSummaryResult](rapidata/api_client/docs/GetCompareAbSummaryResult.md)
|
|
320
348
|
- [GetCompareWorkflowResultsModel](rapidata/api_client/docs/GetCompareWorkflowResultsModel.md)
|
|
321
349
|
- [GetCompareWorkflowResultsResult](rapidata/api_client/docs/GetCompareWorkflowResultsResult.md)
|
|
@@ -333,6 +361,7 @@ Class | Method | HTTP request | Description
|
|
|
333
361
|
- [GetRapidResponsesResult](rapidata/api_client/docs/GetRapidResponsesResult.md)
|
|
334
362
|
- [GetResponsesResult](rapidata/api_client/docs/GetResponsesResult.md)
|
|
335
363
|
- [GetSimpleWorkflowResultsModel](rapidata/api_client/docs/GetSimpleWorkflowResultsModel.md)
|
|
364
|
+
- [GetStandingByIdResult](rapidata/api_client/docs/GetStandingByIdResult.md)
|
|
336
365
|
- [GetValidationRapidsResult](rapidata/api_client/docs/GetValidationRapidsResult.md)
|
|
337
366
|
- [GetValidationRapidsResultAsset](rapidata/api_client/docs/GetValidationRapidsResultAsset.md)
|
|
338
367
|
- [GetValidationRapidsResultPagedResult](rapidata/api_client/docs/GetValidationRapidsResultPagedResult.md)
|
|
@@ -363,6 +392,7 @@ Class | Method | HTTP request | Description
|
|
|
363
392
|
- [LineRapidBlueprint](rapidata/api_client/docs/LineRapidBlueprint.md)
|
|
364
393
|
- [LineResult](rapidata/api_client/docs/LineResult.md)
|
|
365
394
|
- [LineTruth](rapidata/api_client/docs/LineTruth.md)
|
|
395
|
+
- [LocalFileWrapper](rapidata/api_client/docs/LocalFileWrapper.md)
|
|
366
396
|
- [LocateBoxTruth](rapidata/api_client/docs/LocateBoxTruth.md)
|
|
367
397
|
- [LocateCoordinate](rapidata/api_client/docs/LocateCoordinate.md)
|
|
368
398
|
- [LocatePayload](rapidata/api_client/docs/LocatePayload.md)
|
|
@@ -374,6 +404,13 @@ Class | Method | HTTP request | Description
|
|
|
374
404
|
- [LogicOperator](rapidata/api_client/docs/LogicOperator.md)
|
|
375
405
|
- [MetadataVisibilities](rapidata/api_client/docs/MetadataVisibilities.md)
|
|
376
406
|
- [MultiAsset](rapidata/api_client/docs/MultiAsset.md)
|
|
407
|
+
- [MultiAssetInput](rapidata/api_client/docs/MultiAssetInput.md)
|
|
408
|
+
- [MultiAssetInput1](rapidata/api_client/docs/MultiAssetInput1.md)
|
|
409
|
+
- [MultiAssetInput1AssetsInner](rapidata/api_client/docs/MultiAssetInput1AssetsInner.md)
|
|
410
|
+
- [MultiAssetInput2](rapidata/api_client/docs/MultiAssetInput2.md)
|
|
411
|
+
- [MultiAssetInput3](rapidata/api_client/docs/MultiAssetInput3.md)
|
|
412
|
+
- [MultiAssetInput3AssetsInner](rapidata/api_client/docs/MultiAssetInput3AssetsInner.md)
|
|
413
|
+
- [MultiAssetInputAssetsInner](rapidata/api_client/docs/MultiAssetInputAssetsInner.md)
|
|
377
414
|
- [MultiAssetModel](rapidata/api_client/docs/MultiAssetModel.md)
|
|
378
415
|
- [MultiCompareTruth](rapidata/api_client/docs/MultiCompareTruth.md)
|
|
379
416
|
- [NaiveRefereeConfig](rapidata/api_client/docs/NaiveRefereeConfig.md)
|
|
@@ -402,28 +439,34 @@ Class | Method | HTTP request | Description
|
|
|
402
439
|
- [OriginalFilenameMetadata](rapidata/api_client/docs/OriginalFilenameMetadata.md)
|
|
403
440
|
- [OriginalFilenameMetadataModel](rapidata/api_client/docs/OriginalFilenameMetadataModel.md)
|
|
404
441
|
- [PageInfo](rapidata/api_client/docs/PageInfo.md)
|
|
405
|
-
- [
|
|
406
|
-
- [
|
|
442
|
+
- [ParticipantByBenchmark](rapidata/api_client/docs/ParticipantByBenchmark.md)
|
|
443
|
+
- [ParticipantByBenchmarkPagedResult](rapidata/api_client/docs/ParticipantByBenchmarkPagedResult.md)
|
|
407
444
|
- [ParticipantStatus](rapidata/api_client/docs/ParticipantStatus.md)
|
|
408
445
|
- [PipelineIdWorkflowConfigPutRequest](rapidata/api_client/docs/PipelineIdWorkflowConfigPutRequest.md)
|
|
409
446
|
- [PolygonPayload](rapidata/api_client/docs/PolygonPayload.md)
|
|
410
447
|
- [PolygonRapidBlueprint](rapidata/api_client/docs/PolygonRapidBlueprint.md)
|
|
411
448
|
- [PolygonResult](rapidata/api_client/docs/PolygonResult.md)
|
|
412
449
|
- [PolygonTruth](rapidata/api_client/docs/PolygonTruth.md)
|
|
450
|
+
- [PotentialValidationRapid](rapidata/api_client/docs/PotentialValidationRapid.md)
|
|
451
|
+
- [PotentialValidationRapidPagedResult](rapidata/api_client/docs/PotentialValidationRapidPagedResult.md)
|
|
452
|
+
- [PotentialValidationRapidTruth](rapidata/api_client/docs/PotentialValidationRapidTruth.md)
|
|
413
453
|
- [PreliminaryDownloadModel](rapidata/api_client/docs/PreliminaryDownloadModel.md)
|
|
414
454
|
- [PreliminaryDownloadResult](rapidata/api_client/docs/PreliminaryDownloadResult.md)
|
|
415
455
|
- [PrivateTextMetadataInput](rapidata/api_client/docs/PrivateTextMetadataInput.md)
|
|
416
456
|
- [ProbabilisticAttachCategoryRefereeConfig](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeConfig.md)
|
|
417
457
|
- [ProbabilisticAttachCategoryRefereeInfo](rapidata/api_client/docs/ProbabilisticAttachCategoryRefereeInfo.md)
|
|
418
458
|
- [PromptAssetMetadataInput](rapidata/api_client/docs/PromptAssetMetadataInput.md)
|
|
419
|
-
- [
|
|
420
|
-
- [
|
|
459
|
+
- [PromptAssetMetadataInputAsset](rapidata/api_client/docs/PromptAssetMetadataInputAsset.md)
|
|
460
|
+
- [PromptByBenchmarkResult](rapidata/api_client/docs/PromptByBenchmarkResult.md)
|
|
461
|
+
- [PromptByBenchmarkResultPagedResult](rapidata/api_client/docs/PromptByBenchmarkResultPagedResult.md)
|
|
421
462
|
- [PromptMetadata](rapidata/api_client/docs/PromptMetadata.md)
|
|
422
463
|
- [PromptMetadataInput](rapidata/api_client/docs/PromptMetadataInput.md)
|
|
423
464
|
- [PromptMetadataModel](rapidata/api_client/docs/PromptMetadataModel.md)
|
|
465
|
+
- [ProxyFileWrapper](rapidata/api_client/docs/ProxyFileWrapper.md)
|
|
424
466
|
- [PublicOrderModel](rapidata/api_client/docs/PublicOrderModel.md)
|
|
425
467
|
- [PublicTextMetadataInput](rapidata/api_client/docs/PublicTextMetadataInput.md)
|
|
426
468
|
- [QueryModel](rapidata/api_client/docs/QueryModel.md)
|
|
469
|
+
- [QueryValidationModel](rapidata/api_client/docs/QueryValidationModel.md)
|
|
427
470
|
- [RapidIssue](rapidata/api_client/docs/RapidIssue.md)
|
|
428
471
|
- [RapidModel](rapidata/api_client/docs/RapidModel.md)
|
|
429
472
|
- [RapidModelPagedResult](rapidata/api_client/docs/RapidModelPagedResult.md)
|
|
@@ -461,14 +504,21 @@ Class | Method | HTTP request | Description
|
|
|
461
504
|
- [SortDirection](rapidata/api_client/docs/SortDirection.md)
|
|
462
505
|
- [SourceUrlMetadata](rapidata/api_client/docs/SourceUrlMetadata.md)
|
|
463
506
|
- [SourceUrlMetadataModel](rapidata/api_client/docs/SourceUrlMetadataModel.md)
|
|
507
|
+
- [StandingByLeaderboard](rapidata/api_client/docs/StandingByLeaderboard.md)
|
|
508
|
+
- [StandingByLeaderboardPagedResult](rapidata/api_client/docs/StandingByLeaderboardPagedResult.md)
|
|
509
|
+
- [StandingStatus](rapidata/api_client/docs/StandingStatus.md)
|
|
464
510
|
- [StaticSelection](rapidata/api_client/docs/StaticSelection.md)
|
|
465
511
|
- [StickyState](rapidata/api_client/docs/StickyState.md)
|
|
512
|
+
- [StreamFileWrapper](rapidata/api_client/docs/StreamFileWrapper.md)
|
|
466
513
|
- [StreamsMetadata](rapidata/api_client/docs/StreamsMetadata.md)
|
|
467
514
|
- [StreamsMetadataModel](rapidata/api_client/docs/StreamsMetadataModel.md)
|
|
468
515
|
- [SubmitCocoModel](rapidata/api_client/docs/SubmitCocoModel.md)
|
|
469
516
|
- [SubmitCocoResult](rapidata/api_client/docs/SubmitCocoResult.md)
|
|
470
517
|
- [SubmitParticipantResult](rapidata/api_client/docs/SubmitParticipantResult.md)
|
|
518
|
+
- [SubmitPromptModel](rapidata/api_client/docs/SubmitPromptModel.md)
|
|
519
|
+
- [SubmitPromptModelPromptAsset](rapidata/api_client/docs/SubmitPromptModelPromptAsset.md)
|
|
471
520
|
- [TextAsset](rapidata/api_client/docs/TextAsset.md)
|
|
521
|
+
- [TextAssetInput](rapidata/api_client/docs/TextAssetInput.md)
|
|
472
522
|
- [TextAssetModel](rapidata/api_client/docs/TextAssetModel.md)
|
|
473
523
|
- [TextMetadata](rapidata/api_client/docs/TextMetadata.md)
|
|
474
524
|
- [TextMetadataModel](rapidata/api_client/docs/TextMetadataModel.md)
|
|
@@ -509,6 +559,7 @@ Class | Method | HTTP request | Description
|
|
|
509
559
|
- [WorkflowSplitModel](rapidata/api_client/docs/WorkflowSplitModel.md)
|
|
510
560
|
- [WorkflowSplitModelFilterConfigsInner](rapidata/api_client/docs/WorkflowSplitModelFilterConfigsInner.md)
|
|
511
561
|
- [WorkflowState](rapidata/api_client/docs/WorkflowState.md)
|
|
562
|
+
- [ZipEntryFileWrapper](rapidata/api_client/docs/ZipEntryFileWrapper.md)
|
|
512
563
|
|
|
513
564
|
|
|
514
565
|
<a id="documentation-for-authorization"></a>
|
|
File without changes
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import pandas as pd
|
|
2
|
+
|
|
3
|
+
from rapidata.api_client.models.query_model import QueryModel
|
|
4
|
+
from rapidata.api_client.models.page_info import PageInfo
|
|
5
|
+
from rapidata.api_client.models.sort_criterion import SortCriterion
|
|
6
|
+
|
|
7
|
+
from rapidata.service.openapi_service import OpenAPIService
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class RapidataLeaderboard:
|
|
11
|
+
"""
|
|
12
|
+
An instance of a Rapidata leaderboard.
|
|
13
|
+
|
|
14
|
+
Used to interact with a specific leaderboard in the Rapidata system, such as retrieving prompts and evaluating models.
|
|
15
|
+
|
|
16
|
+
Args:
|
|
17
|
+
name: The name that will be used to identify the leaderboard on the overview.
|
|
18
|
+
instruction: The instruction that will determine what how the models will be evaluated.
|
|
19
|
+
show_prompt: Whether to show the prompt to the users.
|
|
20
|
+
id: The ID of the leaderboard.
|
|
21
|
+
openapi_service: The OpenAPIService instance for API interaction.
|
|
22
|
+
"""
|
|
23
|
+
def __init__(self,
|
|
24
|
+
name: str,
|
|
25
|
+
instruction: str,
|
|
26
|
+
show_prompt: bool,
|
|
27
|
+
inverse_ranking: bool,
|
|
28
|
+
min_responses: int,
|
|
29
|
+
response_budget: int,
|
|
30
|
+
id: str,
|
|
31
|
+
openapi_service: OpenAPIService):
|
|
32
|
+
self.__openapi_service = openapi_service
|
|
33
|
+
self.__name = name
|
|
34
|
+
self.__instruction = instruction
|
|
35
|
+
self.__show_prompt = show_prompt
|
|
36
|
+
self.__inverse_ranking = inverse_ranking
|
|
37
|
+
self.__min_responses = min_responses
|
|
38
|
+
self.__response_budget = response_budget
|
|
39
|
+
self.id = id
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def response_budget(self) -> int:
|
|
43
|
+
"""
|
|
44
|
+
Returns the response budget of the leaderboard.
|
|
45
|
+
"""
|
|
46
|
+
return self.__response_budget
|
|
47
|
+
|
|
48
|
+
@property
|
|
49
|
+
def min_responses(self) -> int:
|
|
50
|
+
"""
|
|
51
|
+
Returns the minimum number of responses required to be considered for the leaderboard.
|
|
52
|
+
"""
|
|
53
|
+
return self.__min_responses
|
|
54
|
+
|
|
55
|
+
@property
|
|
56
|
+
def inverse_ranking(self) -> bool:
|
|
57
|
+
"""
|
|
58
|
+
Returns whether the ranking is inverse.
|
|
59
|
+
"""
|
|
60
|
+
return self.__inverse_ranking
|
|
61
|
+
|
|
62
|
+
@property
|
|
63
|
+
def show_prompt(self) -> bool:
|
|
64
|
+
"""
|
|
65
|
+
Returns whether the prompt is shown to the users.
|
|
66
|
+
"""
|
|
67
|
+
return self.__show_prompt
|
|
68
|
+
|
|
69
|
+
@property
|
|
70
|
+
def instruction(self) -> str:
|
|
71
|
+
"""
|
|
72
|
+
Returns the instruction of the leaderboard.
|
|
73
|
+
"""
|
|
74
|
+
return self.__instruction
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def name(self) -> str:
|
|
78
|
+
"""
|
|
79
|
+
Returns the name of the leaderboard.
|
|
80
|
+
"""
|
|
81
|
+
return self.__name
|
|
82
|
+
|
|
83
|
+
def get_standings(self) -> pd.DataFrame:
|
|
84
|
+
"""
|
|
85
|
+
Returns the standings of the leaderboard.
|
|
86
|
+
"""
|
|
87
|
+
participants = self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_standings_get(
|
|
88
|
+
leaderboard_id=self.id,
|
|
89
|
+
request=QueryModel(
|
|
90
|
+
page=PageInfo(index=1, size=1000),
|
|
91
|
+
sortCriteria=[SortCriterion(direction="Desc", propertyName="Score")]
|
|
92
|
+
)
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
standings = []
|
|
96
|
+
for participant in participants.items:
|
|
97
|
+
standings.append({
|
|
98
|
+
"name": participant.name,
|
|
99
|
+
"wins": participant.wins,
|
|
100
|
+
"total_matches": participant.total_matches,
|
|
101
|
+
"score": round(participant.score, 2) if participant.score is not None else None,
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
return pd.DataFrame(standings)
|
|
105
|
+
|
|
106
|
+
def __str__(self) -> str:
|
|
107
|
+
return f"RapidataLeaderboard(name={self.name}, instruction={self.instruction}, show_prompt={self.show_prompt}, leaderboard_id={self.id})"
|
|
108
|
+
|
|
109
|
+
def __repr__(self) -> str:
|
|
110
|
+
return self.__str__()
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
from rapidata.api_client.models.root_filter import RootFilter
|
|
2
|
+
from rapidata.api_client.models.filter import Filter
|
|
3
|
+
from rapidata.api_client.models.query_model import QueryModel
|
|
4
|
+
from rapidata.api_client.models.page_info import PageInfo
|
|
5
|
+
from rapidata.api_client.models.create_leaderboard_model import CreateLeaderboardModel
|
|
6
|
+
from rapidata.api_client.models.create_benchmark_participant_model import CreateBenchmarkParticipantModel
|
|
7
|
+
from rapidata.api_client.models.submit_prompt_model import SubmitPromptModel
|
|
8
|
+
|
|
9
|
+
from rapidata.rapidata_client.logging import logger
|
|
10
|
+
from rapidata.service.openapi_service import OpenAPIService
|
|
11
|
+
|
|
12
|
+
from rapidata.rapidata_client.benchmark.leaderboard.rapidata_leaderboard import RapidataLeaderboard
|
|
13
|
+
from rapidata.rapidata_client.metadata import PromptIdentifierMetadata
|
|
14
|
+
from rapidata.rapidata_client.assets import MediaAsset
|
|
15
|
+
from rapidata.rapidata_client.order._rapidata_dataset import RapidataDataset
|
|
16
|
+
|
|
17
|
+
class RapidataBenchmark:
|
|
18
|
+
"""
|
|
19
|
+
An instance of a Rapidata benchmark.
|
|
20
|
+
|
|
21
|
+
Used to interact with a specific benchmark in the Rapidata system, such as retrieving prompts and evaluating models.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
name: The name that will be used to identify the benchmark on the overview.
|
|
25
|
+
id: The id of the benchmark.
|
|
26
|
+
openapi_service: The OpenAPI service to use to interact with the Rapidata API.
|
|
27
|
+
"""
|
|
28
|
+
def __init__(self, name: str, id: str, openapi_service: OpenAPIService):
|
|
29
|
+
self.name = name
|
|
30
|
+
self.id = id
|
|
31
|
+
self.__openapi_service = openapi_service
|
|
32
|
+
self.__prompts: list[str] = []
|
|
33
|
+
self.__leaderboards: list[RapidataLeaderboard] = []
|
|
34
|
+
self.__identifiers: list[str] = []
|
|
35
|
+
|
|
36
|
+
def __instantiate_prompts(self) -> None:
|
|
37
|
+
current_page = 1
|
|
38
|
+
total_pages = None
|
|
39
|
+
|
|
40
|
+
while True:
|
|
41
|
+
prompts_result = self.__openapi_service.benchmark_api.benchmark_benchmark_id_prompts_get(
|
|
42
|
+
benchmark_id=self.id,
|
|
43
|
+
request=QueryModel(
|
|
44
|
+
page=PageInfo(
|
|
45
|
+
index=current_page,
|
|
46
|
+
size=100
|
|
47
|
+
)
|
|
48
|
+
)
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
if prompts_result.total_pages is None:
|
|
52
|
+
raise ValueError("An error occurred while fetching prompts: total_pages is None")
|
|
53
|
+
|
|
54
|
+
total_pages = prompts_result.total_pages
|
|
55
|
+
|
|
56
|
+
self.__prompts.extend([prompt.prompt for prompt in prompts_result.items])
|
|
57
|
+
self.__identifiers.extend([prompt.identifier for prompt in prompts_result.items])
|
|
58
|
+
|
|
59
|
+
if current_page >= total_pages:
|
|
60
|
+
break
|
|
61
|
+
|
|
62
|
+
current_page += 1
|
|
63
|
+
|
|
64
|
+
@property
|
|
65
|
+
def prompts(self) -> list[str]:
|
|
66
|
+
"""
|
|
67
|
+
Returns the prompts that are registered for the leaderboard.
|
|
68
|
+
"""
|
|
69
|
+
if not self.__prompts:
|
|
70
|
+
self.__instantiate_prompts()
|
|
71
|
+
|
|
72
|
+
return self.__prompts
|
|
73
|
+
|
|
74
|
+
@property
|
|
75
|
+
def identifiers(self) -> list[str]:
|
|
76
|
+
if not self.__identifiers:
|
|
77
|
+
self.__instantiate_prompts()
|
|
78
|
+
|
|
79
|
+
return self.__identifiers
|
|
80
|
+
|
|
81
|
+
@property
|
|
82
|
+
def leaderboards(self) -> list[RapidataLeaderboard]:
|
|
83
|
+
"""
|
|
84
|
+
Returns the leaderboards that are registered for the benchmark.
|
|
85
|
+
"""
|
|
86
|
+
if not self.__leaderboards:
|
|
87
|
+
current_page = 1
|
|
88
|
+
total_pages = None
|
|
89
|
+
|
|
90
|
+
while True:
|
|
91
|
+
leaderboards_result = self.__openapi_service.leaderboard_api.leaderboards_get(
|
|
92
|
+
request=QueryModel(
|
|
93
|
+
filter=RootFilter(
|
|
94
|
+
filters=[
|
|
95
|
+
Filter(field="BenchmarkId", operator="Eq", value=self.id)
|
|
96
|
+
]
|
|
97
|
+
),
|
|
98
|
+
page=PageInfo(
|
|
99
|
+
index=current_page,
|
|
100
|
+
size=100
|
|
101
|
+
)
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
|
|
105
|
+
if leaderboards_result.total_pages is None:
|
|
106
|
+
raise ValueError("An error occurred while fetching leaderboards: total_pages is None")
|
|
107
|
+
|
|
108
|
+
total_pages = leaderboards_result.total_pages
|
|
109
|
+
|
|
110
|
+
self.__leaderboards.extend([
|
|
111
|
+
RapidataLeaderboard(
|
|
112
|
+
leaderboard.name,
|
|
113
|
+
leaderboard.instruction,
|
|
114
|
+
leaderboard.show_prompt,
|
|
115
|
+
leaderboard.is_inversed,
|
|
116
|
+
leaderboard.min_responses,
|
|
117
|
+
leaderboard.response_budget,
|
|
118
|
+
leaderboard.id,
|
|
119
|
+
self.__openapi_service
|
|
120
|
+
) for leaderboard in leaderboards_result.items])
|
|
121
|
+
|
|
122
|
+
if current_page >= total_pages:
|
|
123
|
+
break
|
|
124
|
+
|
|
125
|
+
current_page += 1
|
|
126
|
+
|
|
127
|
+
return self.__leaderboards
|
|
128
|
+
|
|
129
|
+
def add_prompt(self, identifier: str, prompt: str):
|
|
130
|
+
"""
|
|
131
|
+
Adds a prompt to the benchmark.
|
|
132
|
+
"""
|
|
133
|
+
if not isinstance(identifier, str) or not isinstance(prompt, str):
|
|
134
|
+
raise ValueError("Identifier and prompt must be strings.")
|
|
135
|
+
|
|
136
|
+
if identifier in self.identifiers:
|
|
137
|
+
raise ValueError("Identifier already exists in the benchmark.")
|
|
138
|
+
|
|
139
|
+
self.__identifiers.append(identifier)
|
|
140
|
+
self.__prompts.append(prompt)
|
|
141
|
+
|
|
142
|
+
self.__openapi_service.benchmark_api.benchmark_benchmark_id_prompt_post(
|
|
143
|
+
benchmark_id=self.id,
|
|
144
|
+
submit_prompt_model=SubmitPromptModel(
|
|
145
|
+
identifier=identifier,
|
|
146
|
+
prompt=prompt,
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
|
|
150
|
+
def create_leaderboard(
|
|
151
|
+
self,
|
|
152
|
+
name: str,
|
|
153
|
+
instruction: str,
|
|
154
|
+
show_prompt: bool,
|
|
155
|
+
inverse_ranking: bool = False,
|
|
156
|
+
min_responses: int | None = None,
|
|
157
|
+
response_budget: int | None = None
|
|
158
|
+
) -> RapidataLeaderboard:
|
|
159
|
+
"""
|
|
160
|
+
Creates a new leaderboard for the benchmark.
|
|
161
|
+
|
|
162
|
+
Args:
|
|
163
|
+
name: The name of the leaderboard. (not shown to the users)
|
|
164
|
+
instruction: The instruction decides how the models will be evaluated.
|
|
165
|
+
show_prompt: Whether to show the prompt to the users.
|
|
166
|
+
inverse_ranking: Whether to inverse the ranking of the leaderboard. (if the question is inversed, e.g. "Which video is worse?")
|
|
167
|
+
min_responses: The minimum amount of responses that get collected per comparison. if None, it will be defaulted.
|
|
168
|
+
response_budget: The total amount of responses that get collected per new model evaluation. if None, it will be defaulted. Values below 2000 are not recommended.
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
if response_budget is not None and response_budget < 2000:
|
|
172
|
+
logger.warning("Response budget is below 2000. This is not recommended.")
|
|
173
|
+
|
|
174
|
+
leaderboard_result = self.__openapi_service.leaderboard_api.leaderboard_post(
|
|
175
|
+
create_leaderboard_model=CreateLeaderboardModel(
|
|
176
|
+
benchmarkId=self.id,
|
|
177
|
+
name=name,
|
|
178
|
+
instruction=instruction,
|
|
179
|
+
showPrompt=show_prompt,
|
|
180
|
+
isInversed=inverse_ranking,
|
|
181
|
+
minResponses=min_responses,
|
|
182
|
+
responseBudget=response_budget
|
|
183
|
+
)
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
assert leaderboard_result.benchmark_id == self.id, "The leaderboard was not created for the correct benchmark."
|
|
187
|
+
|
|
188
|
+
return RapidataLeaderboard(
|
|
189
|
+
name,
|
|
190
|
+
instruction,
|
|
191
|
+
show_prompt,
|
|
192
|
+
inverse_ranking,
|
|
193
|
+
leaderboard_result.min_responses,
|
|
194
|
+
leaderboard_result.response_budget,
|
|
195
|
+
leaderboard_result.id,
|
|
196
|
+
self.__openapi_service
|
|
197
|
+
)
|
|
198
|
+
|
|
199
|
+
def evaluate_model(self, name: str, media: list[str], identifiers: list[str]) -> None:
|
|
200
|
+
"""
|
|
201
|
+
Evaluates a model on the benchmark across all leaderboards.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
name: The name of the model.
|
|
205
|
+
media: The generated images/videos that will be used to evaluate the model.
|
|
206
|
+
identifiers: The identifiers that correspond to the media. The order of the identifiers must match the order of the media.
|
|
207
|
+
The identifiers that are used must be registered for the benchmark. To see the registered identifiers, use the identifiers property.
|
|
208
|
+
"""
|
|
209
|
+
if not media:
|
|
210
|
+
raise ValueError("Media must be a non-empty list of strings")
|
|
211
|
+
|
|
212
|
+
if len(media) != len(identifiers):
|
|
213
|
+
raise ValueError("Media and identifiers must have the same length")
|
|
214
|
+
|
|
215
|
+
if not all(identifier in self.identifiers for identifier in identifiers):
|
|
216
|
+
raise ValueError("All identifiers must be in the registered identifiers list. To see the registered identifiers, use the identifiers property.\
|
|
217
|
+
\nTo see the prompts that are associated with the identifiers, use the prompts property.")
|
|
218
|
+
|
|
219
|
+
# happens before the creation of the participant to ensure all media paths are valid
|
|
220
|
+
assets = []
|
|
221
|
+
prompts_metadata: list[list[PromptIdentifierMetadata]] = []
|
|
222
|
+
for media_path, identifier in zip(media, identifiers):
|
|
223
|
+
assets.append(MediaAsset(media_path))
|
|
224
|
+
prompts_metadata.append([PromptIdentifierMetadata(identifier=identifier)])
|
|
225
|
+
|
|
226
|
+
participant_result = self.__openapi_service.benchmark_api.benchmark_benchmark_id_participants_post(
|
|
227
|
+
benchmark_id=self.id,
|
|
228
|
+
create_benchmark_participant_model=CreateBenchmarkParticipantModel(
|
|
229
|
+
name=name,
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
dataset = RapidataDataset(participant_result.dataset_id, self.__openapi_service)
|
|
234
|
+
|
|
235
|
+
try:
|
|
236
|
+
dataset._add_datapoints(assets, prompts_metadata)
|
|
237
|
+
except Exception as e:
|
|
238
|
+
logger.warning(f"An error occurred while adding datapoints to the dataset: {e}")
|
|
239
|
+
upload_progress = self.__openapi_service.dataset_api.dataset_dataset_id_progress_get(
|
|
240
|
+
dataset_id=dataset.id
|
|
241
|
+
)
|
|
242
|
+
if upload_progress.ready == 0:
|
|
243
|
+
raise RuntimeError("None of the media was uploaded successfully. Please check the media paths and try again.")
|
|
244
|
+
|
|
245
|
+
logger.warning(f"{upload_progress.failed} datapoints failed to upload. \n{upload_progress.ready} datapoints were uploaded successfully. \nEvaluation will continue with the uploaded datapoints.")
|
|
246
|
+
|
|
247
|
+
self.__openapi_service.benchmark_api.benchmark_benchmark_id_participants_participant_id_submit_post(
|
|
248
|
+
benchmark_id=self.id,
|
|
249
|
+
participant_id=participant_result.participant_id
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
def __str__(self) -> str:
|
|
253
|
+
return f"RapidataBenchmark(name={self.name}, id={self.id})"
|
|
254
|
+
|
|
255
|
+
def __repr__(self) -> str:
|
|
256
|
+
return self.__str__()
|