rapidata 2.35.0__py3-none-any.whl → 2.35.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 CHANGED
@@ -1,4 +1,4 @@
1
- __version__ = "2.35.0"
1
+ __version__ = "2.35.1"
2
2
 
3
3
  from .rapidata_client import (
4
4
  RapidataClient,
@@ -2,8 +2,6 @@ from typing import Literal
2
2
 
3
3
 
4
4
  class DetailMapper:
5
- MIN_RESPONSES = 3
6
-
7
5
  @staticmethod
8
6
  def get_budget(
9
7
  level_of_detail: Literal["low", "medium", "high", "very high"]
@@ -31,6 +31,7 @@ class RapidataLeaderboard:
31
31
  show_prompt_asset: bool,
32
32
  inverse_ranking: bool,
33
33
  response_budget: int,
34
+ min_responses_per_matchup: int,
34
35
  id: str,
35
36
  openapi_service: OpenAPIService,
36
37
  ):
@@ -41,6 +42,7 @@ class RapidataLeaderboard:
41
42
  self.__show_prompt_asset = show_prompt_asset
42
43
  self.__inverse_ranking = inverse_ranking
43
44
  self.__response_budget = response_budget
45
+ self.__min_responses_per_matchup = min_responses_per_matchup
44
46
  self.id = id
45
47
 
46
48
  @property
@@ -62,11 +64,41 @@ class RapidataLeaderboard:
62
64
  leaderboard_id=self.id,
63
65
  update_leaderboard_response_config_model=UpdateLeaderboardResponseConfigModel(
64
66
  responseBudget=DetailMapper.get_budget(level_of_detail),
65
- minResponses=DetailMapper.MIN_RESPONSES,
67
+ minResponses=self.__min_responses_per_matchup,
66
68
  ),
67
69
  )
68
70
  self.__response_budget = DetailMapper.get_budget(level_of_detail)
69
71
 
72
+ @property
73
+ def min_responses_per_matchup(self) -> int:
74
+ """
75
+ Returns the minimum number of responses required to be considered for the leaderboard.
76
+ """
77
+ return self.__min_responses_per_matchup
78
+
79
+ @min_responses_per_matchup.setter
80
+ def min_responses_per_matchup(self, min_responses: int):
81
+ """
82
+ Sets the minimum number of responses required to be considered for the leaderboard.
83
+ """
84
+ if not isinstance(min_responses, int):
85
+ raise ValueError("Min responses per matchup must be an integer")
86
+
87
+ if min_responses < 3:
88
+ raise ValueError("Min responses per matchup must be at least 3")
89
+
90
+ logger.debug(
91
+ f"Setting min responses per matchup to {min_responses} for leaderboard {self.name}"
92
+ )
93
+ self.__openapi_service.leaderboard_api.leaderboard_leaderboard_id_response_config_put(
94
+ leaderboard_id=self.id,
95
+ update_leaderboard_response_config_model=UpdateLeaderboardResponseConfigModel(
96
+ responseBudget=self.__response_budget,
97
+ minResponses=min_responses,
98
+ ),
99
+ )
100
+ self.__min_responses_per_matchup = min_responses
101
+
70
102
  @property
71
103
  def show_prompt_asset(self) -> bool:
72
104
  """
@@ -172,6 +172,7 @@ class RapidataBenchmark:
172
172
  leaderboard.show_prompt_asset,
173
173
  leaderboard.is_inversed,
174
174
  leaderboard.response_budget,
175
+ leaderboard.min_responses,
175
176
  leaderboard.id,
176
177
  self.__openapi_service,
177
178
  )
@@ -258,6 +259,7 @@ class RapidataBenchmark:
258
259
  show_prompt_asset: bool = False,
259
260
  inverse_ranking: bool = False,
260
261
  level_of_detail: Literal["low", "medium", "high", "very high"] = "low",
262
+ min_responses_per_matchup: int = 3,
261
263
  ) -> RapidataLeaderboard:
262
264
  """
263
265
  Creates a new leaderboard for the benchmark.
@@ -269,7 +271,14 @@ class RapidataBenchmark:
269
271
  show_prompt_asset: Whether to show the prompt asset to the users. (only works if the prompt asset is a URL) (default: False)
270
272
  inverse_ranking: Whether to inverse the ranking of the leaderboard. (if the question is inversed, e.g. "Which video is worse?")
271
273
  level_of_detail: The level of detail of the leaderboard. This will effect how many comparisons are done per model evaluation. (default: "low")
274
+ min_responses_per_matchup: The minimum number of responses required to be considered for the leaderboard. (default: 3)
272
275
  """
276
+ if not isinstance(min_responses_per_matchup, int):
277
+ raise ValueError("Min responses per matchup must be an integer")
278
+
279
+ if min_responses_per_matchup < 3:
280
+ raise ValueError("Min responses per matchup must be at least 3")
281
+
273
282
  leaderboard_result = self.__openapi_service.leaderboard_api.leaderboard_post(
274
283
  create_leaderboard_model=CreateLeaderboardModel(
275
284
  benchmarkId=self.id,
@@ -278,7 +287,7 @@ class RapidataBenchmark:
278
287
  showPrompt=show_prompt,
279
288
  showPromptAsset=show_prompt_asset,
280
289
  isInversed=inverse_ranking,
281
- minResponses=DetailMapper.MIN_RESPONSES,
290
+ minResponses=min_responses_per_matchup,
282
291
  responseBudget=DetailMapper.get_budget(level_of_detail),
283
292
  )
284
293
  )
@@ -294,6 +303,7 @@ class RapidataBenchmark:
294
303
  show_prompt_asset,
295
304
  inverse_ranking,
296
305
  leaderboard_result.response_budget,
306
+ min_responses_per_matchup,
297
307
  leaderboard_result.id,
298
308
  self.__openapi_service,
299
309
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.35.0
3
+ Version: 2.35.1
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG
@@ -1,4 +1,4 @@
1
- rapidata/__init__.py,sha256=LHrPkAuvFTYjxU8zeMmh15W2xmXsvyVcIK_bv8qScRg,897
1
+ rapidata/__init__.py,sha256=7ZoBaYqvNh-HjfP3kpiQCpwmvJYhFGdAVtpwwzyhLsQ,897
2
2
  rapidata/api_client/__init__.py,sha256=fb2lqv3sj48wAgarp3g6hvtTgd7bfI01DJJLuBZQnFI,34850
3
3
  rapidata/api_client/api/__init__.py,sha256=dGnSE9oPO_ahGh-E1jtw4_VuM_vQueQFuv0IVMQo6uo,1546
4
4
  rapidata/api_client/api/benchmark_api.py,sha256=bC8hAPgHIDU5u1e0loWPWnZX33BW6gsAR8oc5199q2k,129777
@@ -542,12 +542,12 @@ rapidata/rapidata_client/__init__.py,sha256=CfkQxCdURXzJsVP6sxKmufze2u-IE_snG_G8
542
542
  rapidata/rapidata_client/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
543
543
  rapidata/rapidata_client/api/rapidata_exception.py,sha256=BIdmHRrJUGW-Mqhp1H_suemZaR6w9TgjWq-ZW5iUPdQ,3878
544
544
  rapidata/rapidata_client/benchmark/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
545
- rapidata/rapidata_client/benchmark/_detail_mapper.py,sha256=IcCW0d3_vwAdyG7V9P5UMPASoblk6JX5UEhrfHcaAIs,967
545
+ rapidata/rapidata_client/benchmark/_detail_mapper.py,sha256=HmzJwR2dojs0c2PaEJ5lwSPtjaqeoPXI7RQk5kwSB9A,944
546
546
  rapidata/rapidata_client/benchmark/leaderboard/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
547
- rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py,sha256=ucbE6wSNaT8Li_XTxoze1iEYppaHw8OTcqlP-PW5KMw,4767
547
+ rapidata/rapidata_client/benchmark/leaderboard/rapidata_leaderboard.py,sha256=xRNXw__K4-4wb4UI-EgLyJRwGO5OkFdoN3A1S3MkdF4,6092
548
548
  rapidata/rapidata_client/benchmark/participant/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
549
549
  rapidata/rapidata_client/benchmark/participant/_participant.py,sha256=yN82EWrZXYszsM8Ns0HRMXCTivltkyxcpGRK-cdT01Y,3683
550
- rapidata/rapidata_client/benchmark/rapidata_benchmark.py,sha256=wZgN79jV4WF6HtNYl8gqTHArCEi8WHy3zN1xnxzTS6A,14268
550
+ rapidata/rapidata_client/benchmark/rapidata_benchmark.py,sha256=Z0jT9hiWyS3km0BwtGXbdmtopdnecf1z-ucDdwg06Y0,14793
551
551
  rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py,sha256=NnXCsU2_8SlGxdI51MeIUWK7Ku0pEylDSPhnzOPzTV0,5291
552
552
  rapidata/rapidata_client/country_codes/__init__.py,sha256=FB9Dcks44J6C6YBSYmTmNZ71tE130x6NO_3aLJ8fKzQ,40
553
553
  rapidata/rapidata_client/country_codes/country_codes.py,sha256=ePHqeb7y9DWQZAnddBzPx1puYBcrgUjdR2sbFijuFD8,283
@@ -651,7 +651,7 @@ rapidata/service/__init__.py,sha256=s9bS1AJZaWIhLtJX_ZA40_CK39rAAkwdAmymTMbeWl4,
651
651
  rapidata/service/credential_manager.py,sha256=pUEEtp6VrFWYhfUUtyqmS0AlRqe2Y0kFkY6o22IT4KM,8682
652
652
  rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5AnfY14BW8,877
653
653
  rapidata/service/openapi_service.py,sha256=v2fhPbHmD0J11ZRZY6f80PdIdGwpRFlbfMH9t8Ypg5A,5403
654
- rapidata-2.35.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
655
- rapidata-2.35.0.dist-info/METADATA,sha256=lGStAMXDWn_ztSIkIrN6bpJJ2HiZE7ivo1Z0LQ_eRAo,1264
656
- rapidata-2.35.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
657
- rapidata-2.35.0.dist-info/RECORD,,
654
+ rapidata-2.35.1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
655
+ rapidata-2.35.1.dist-info/METADATA,sha256=mQGouVcYnBiJg-noTAW2JpQPxqSId68ZqIznzJDyJWE,1264
656
+ rapidata-2.35.1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
657
+ rapidata-2.35.1.dist-info/RECORD,,