Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,212 changes: 194 additions & 1,018 deletions openapi/schemas/leaderboard.openapi.json

Large diffs are not rendered by default.

2,629 changes: 1,088 additions & 1,541 deletions openapi/schemas/rapidata.filtered.openapi.json

Large diffs are not rendered by default.

2,629 changes: 1,088 additions & 1,541 deletions openapi/schemas/rapidata.openapi.json

Large diffs are not rendered by default.

26 changes: 2 additions & 24 deletions src/rapidata/api_client/models/create_leaderboard_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from rapidata.api_client.models.feature_flag import FeatureFlag
from rapidata.api_client.models.i_user_filter_model import IUserFilterModel
from typing import Optional, Set
from typing_extensions import Self

Expand All @@ -37,11 +36,9 @@ class CreateLeaderboardModel(BaseModel):
response_budget: Optional[StrictInt] = Field(default=None, description="Total amount of responses that get collected per run", alias="responseBudget")
min_responses: Optional[StrictInt] = Field(default=None, description="The minimum amount of responses that need to be collected per comparison.", alias="minResponses")
is_inversed: Optional[StrictBool] = Field(default=None, description="If the results should be inversed, meaning people should select the worse model.", alias="isInversed")
validation_set_id: Optional[StrictStr] = Field(default=None, description="The Validation set that should be attached to every run.", alias="validationSetId")
audience_id: Optional[StrictStr] = Field(default=None, description="Optional audience ID. When provided, the leaderboard will target users who have graduated from the audience (i.e., users with a score at or above the audience's minimum threshold). Cannot be specified together with Filters.", alias="audienceId")
filters: Optional[List[IUserFilterModel]] = None
audience_id: Optional[StrictStr] = Field(default=None, description="Optional audience ID. When provided, evaluations run on the specified audience. Defaults to the global audience when not specified.", alias="audienceId")
feature_flags: Optional[List[FeatureFlag]] = Field(default=None, alias="featureFlags")
__properties: ClassVar[List[str]] = ["benchmarkId", "benchmarkName", "name", "instruction", "showPrompt", "showPromptAsset", "responseBudget", "minResponses", "isInversed", "validationSetId", "audienceId", "filters", "featureFlags"]
__properties: ClassVar[List[str]] = ["benchmarkId", "benchmarkName", "name", "instruction", "showPrompt", "showPromptAsset", "responseBudget", "minResponses", "isInversed", "audienceId", "featureFlags"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -82,13 +79,6 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in filters (list)
_items = []
if self.filters:
for _item_filters in self.filters:
if _item_filters:
_items.append(_item_filters.to_dict())
_dict['filters'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
_items = []
if self.feature_flags:
Expand All @@ -106,21 +96,11 @@ def to_dict(self) -> Dict[str, Any]:
if self.benchmark_name is None and "benchmark_name" in self.model_fields_set:
_dict['benchmarkName'] = None

# set to None if validation_set_id (nullable) is None
# and model_fields_set contains the field
if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
_dict['validationSetId'] = None

# set to None if audience_id (nullable) is None
# and model_fields_set contains the field
if self.audience_id is None and "audience_id" in self.model_fields_set:
_dict['audienceId'] = None

# set to None if filters (nullable) is None
# and model_fields_set contains the field
if self.filters is None and "filters" in self.model_fields_set:
_dict['filters'] = None

# set to None if feature_flags (nullable) is None
# and model_fields_set contains the field
if self.feature_flags is None and "feature_flags" in self.model_fields_set:
Expand All @@ -147,9 +127,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"responseBudget": obj.get("responseBudget"),
"minResponses": obj.get("minResponses"),
"isInversed": obj.get("isInversed"),
"validationSetId": obj.get("validationSetId"),
"audienceId": obj.get("audienceId"),
"filters": [IUserFilterModel.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
})
return _obj
Expand Down
31 changes: 8 additions & 23 deletions src/rapidata/api_client/models/get_leaderboard_by_id_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from rapidata.api_client.models.feature_flag import FeatureFlag
from rapidata.api_client.models.i_campaign_filter import ICampaignFilter
from typing import Optional, Set
from typing_extensions import Self

Expand All @@ -29,18 +28,17 @@ class GetLeaderboardByIdResult(BaseModel):
GetLeaderboardByIdResult
""" # noqa: E501
id: StrictStr
order_id: Optional[StrictStr] = Field(default=None, alias="orderId")
name: StrictStr
instruction: StrictStr
show_prompt: StrictBool = Field(alias="showPrompt")
show_prompt_asset: StrictBool = Field(alias="showPromptAsset")
is_inversed: StrictBool = Field(alias="isInversed")
response_budget: StrictInt = Field(alias="responseBudget")
min_responses: StrictInt = Field(alias="minResponses")
validation_set_id: Optional[StrictStr] = Field(default=None, alias="validationSetId")
filters: List[ICampaignFilter]
audience_id: StrictStr = Field(alias="audienceId")
job_definition_id: Optional[StrictStr] = Field(default=None, alias="jobDefinitionId")
feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
__properties: ClassVar[List[str]] = ["id", "orderId", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses", "validationSetId", "filters", "featureFlags"]
__properties: ClassVar[List[str]] = ["id", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses", "audienceId", "jobDefinitionId", "featureFlags"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -81,29 +79,17 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in filters (list)
_items = []
if self.filters:
for _item_filters in self.filters:
if _item_filters:
_items.append(_item_filters.to_dict())
_dict['filters'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
_items = []
if self.feature_flags:
for _item_feature_flags in self.feature_flags:
if _item_feature_flags:
_items.append(_item_feature_flags.to_dict())
_dict['featureFlags'] = _items
# set to None if order_id (nullable) is None
# and model_fields_set contains the field
if self.order_id is None and "order_id" in self.model_fields_set:
_dict['orderId'] = None

# set to None if validation_set_id (nullable) is None
# set to None if job_definition_id (nullable) is None
# and model_fields_set contains the field
if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
_dict['validationSetId'] = None
if self.job_definition_id is None and "job_definition_id" in self.model_fields_set:
_dict['jobDefinitionId'] = None

return _dict

Expand All @@ -118,16 +104,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"id": obj.get("id"),
"orderId": obj.get("orderId"),
"name": obj.get("name"),
"instruction": obj.get("instruction"),
"showPrompt": obj.get("showPrompt"),
"showPromptAsset": obj.get("showPromptAsset"),
"isInversed": obj.get("isInversed"),
"responseBudget": obj.get("responseBudget"),
"minResponses": obj.get("minResponses"),
"validationSetId": obj.get("validationSetId"),
"filters": [ICampaignFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
"audienceId": obj.get("audienceId"),
"jobDefinitionId": obj.get("jobDefinitionId"),
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
})
return _obj
Expand Down
31 changes: 8 additions & 23 deletions src/rapidata/api_client/models/leaderboards_query_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
from typing import Any, ClassVar, Dict, List, Optional
from rapidata.api_client.models.feature_flag import FeatureFlag
from rapidata.api_client.models.i_campaign_filter import ICampaignFilter
from typing import Optional, Set
from typing_extensions import Self

Expand All @@ -29,18 +28,17 @@ class LeaderboardsQueryResult(BaseModel):
LeaderboardsQueryResult
""" # noqa: E501
id: StrictStr
order_id: Optional[StrictStr] = Field(default=None, alias="orderId")
name: StrictStr
instruction: StrictStr
show_prompt: StrictBool = Field(alias="showPrompt")
show_prompt_asset: StrictBool = Field(alias="showPromptAsset")
is_inversed: StrictBool = Field(alias="isInversed")
response_budget: StrictInt = Field(alias="responseBudget")
min_responses: StrictInt = Field(alias="minResponses")
validation_set_id: Optional[StrictStr] = Field(default=None, alias="validationSetId")
filters: List[ICampaignFilter]
audience_id: StrictStr = Field(alias="audienceId")
job_definition_id: Optional[StrictStr] = Field(default=None, alias="jobDefinitionId")
feature_flags: List[FeatureFlag] = Field(alias="featureFlags")
__properties: ClassVar[List[str]] = ["id", "orderId", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses", "validationSetId", "filters", "featureFlags"]
__properties: ClassVar[List[str]] = ["id", "name", "instruction", "showPrompt", "showPromptAsset", "isInversed", "responseBudget", "minResponses", "audienceId", "jobDefinitionId", "featureFlags"]

model_config = ConfigDict(
populate_by_name=True,
Expand Down Expand Up @@ -81,29 +79,17 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of each item in filters (list)
_items = []
if self.filters:
for _item_filters in self.filters:
if _item_filters:
_items.append(_item_filters.to_dict())
_dict['filters'] = _items
# override the default output from pydantic by calling `to_dict()` of each item in feature_flags (list)
_items = []
if self.feature_flags:
for _item_feature_flags in self.feature_flags:
if _item_feature_flags:
_items.append(_item_feature_flags.to_dict())
_dict['featureFlags'] = _items
# set to None if order_id (nullable) is None
# and model_fields_set contains the field
if self.order_id is None and "order_id" in self.model_fields_set:
_dict['orderId'] = None

# set to None if validation_set_id (nullable) is None
# set to None if job_definition_id (nullable) is None
# and model_fields_set contains the field
if self.validation_set_id is None and "validation_set_id" in self.model_fields_set:
_dict['validationSetId'] = None
if self.job_definition_id is None and "job_definition_id" in self.model_fields_set:
_dict['jobDefinitionId'] = None

return _dict

Expand All @@ -118,16 +104,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate({
"id": obj.get("id"),
"orderId": obj.get("orderId"),
"name": obj.get("name"),
"instruction": obj.get("instruction"),
"showPrompt": obj.get("showPrompt"),
"showPromptAsset": obj.get("showPromptAsset"),
"isInversed": obj.get("isInversed"),
"responseBudget": obj.get("responseBudget"),
"minResponses": obj.get("minResponses"),
"validationSetId": obj.get("validationSetId"),
"filters": [ICampaignFilter.from_dict(_item) for _item in obj["filters"]] if obj.get("filters") is not None else None,
"audienceId": obj.get("audienceId"),
"jobDefinitionId": obj.get("jobDefinitionId"),
"featureFlags": [FeatureFlag.from_dict(_item) for _item in obj["featureFlags"]] if obj.get("featureFlags") is not None else None
})
return _obj
Expand Down
15 changes: 0 additions & 15 deletions src/rapidata/api_client_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -471,15 +471,6 @@ Class | Method | HTTP request | Description
- [IAudienceFilterLanguageAudienceFilter](rapidata/api_client/docs/IAudienceFilterLanguageAudienceFilter.md)
- [IAudienceFilterNotAudienceFilter](rapidata/api_client/docs/IAudienceFilterNotAudienceFilter.md)
- [IAudienceFilterOrAudienceFilter](rapidata/api_client/docs/IAudienceFilterOrAudienceFilter.md)
- [ICampaignFilter](rapidata/api_client/docs/ICampaignFilter.md)
- [ICampaignFilterAndFilter](rapidata/api_client/docs/ICampaignFilterAndFilter.md)
- [ICampaignFilterAudienceStateFilter](rapidata/api_client/docs/ICampaignFilterAudienceStateFilter.md)
- [ICampaignFilterCampaignFilter](rapidata/api_client/docs/ICampaignFilterCampaignFilter.md)
- [ICampaignFilterCampaignSessionCountFilter](rapidata/api_client/docs/ICampaignFilterCampaignSessionCountFilter.md)
- [ICampaignFilterCountryFilter](rapidata/api_client/docs/ICampaignFilterCountryFilter.md)
- [ICampaignFilterDemographicFilter](rapidata/api_client/docs/ICampaignFilterDemographicFilter.md)
- [ICampaignFilterDeviceFilter](rapidata/api_client/docs/ICampaignFilterDeviceFilter.md)
- [ICampaignFilterLanguageFilter](rapidata/api_client/docs/ICampaignFilterLanguageFilter.md)
- [ICampaignFilterModel](rapidata/api_client/docs/ICampaignFilterModel.md)
- [ICampaignFilterModelAndFilterModel](rapidata/api_client/docs/ICampaignFilterModelAndFilterModel.md)
- [ICampaignFilterModelAudienceStateFilterModel](rapidata/api_client/docs/ICampaignFilterModelAudienceStateFilterModel.md)
Expand All @@ -495,12 +486,6 @@ Class | Method | HTTP request | Description
- [ICampaignFilterModelResponseCountFilterModel](rapidata/api_client/docs/ICampaignFilterModelResponseCountFilterModel.md)
- [ICampaignFilterModelUserActionRestrictionFilterModel](rapidata/api_client/docs/ICampaignFilterModelUserActionRestrictionFilterModel.md)
- [ICampaignFilterModelUserScoreFilterModel](rapidata/api_client/docs/ICampaignFilterModelUserScoreFilterModel.md)
- [ICampaignFilterNewUserFilter](rapidata/api_client/docs/ICampaignFilterNewUserFilter.md)
- [ICampaignFilterNotFilter](rapidata/api_client/docs/ICampaignFilterNotFilter.md)
- [ICampaignFilterOrFilter](rapidata/api_client/docs/ICampaignFilterOrFilter.md)
- [ICampaignFilterResponseCountFilter](rapidata/api_client/docs/ICampaignFilterResponseCountFilter.md)
- [ICampaignFilterUserActionRestrictionFilter](rapidata/api_client/docs/ICampaignFilterUserActionRestrictionFilter.md)
- [ICampaignFilterUserScoreFilter](rapidata/api_client/docs/ICampaignFilterUserScoreFilter.md)
- [ICampaignSelectionModel](rapidata/api_client/docs/ICampaignSelectionModel.md)
- [ICampaignSelectionModelAbTestSelectionModel](rapidata/api_client/docs/ICampaignSelectionModelAbTestSelectionModel.md)
- [ICampaignSelectionModelAudienceSelectionModel](rapidata/api_client/docs/ICampaignSelectionModelAudienceSelectionModel.md)
Expand Down
19 changes: 5 additions & 14 deletions src/rapidata/rapidata_client/benchmark/rapidata_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
from rapidata.rapidata_client.benchmark.participant.participant import (
BenchmarkParticipant,
)
from rapidata.rapidata_client.filter import RapidataFilter
from rapidata.rapidata_client.settings import RapidataSetting
from rapidata.service.openapi_service import OpenAPIService

Expand Down Expand Up @@ -323,8 +322,7 @@ def create_leaderboard(
inverse_ranking: bool = False,
level_of_detail: LevelOfDetail | None = None,
min_responses_per_matchup: int | None = None,
validation_set_id: str | None = None,
filters: Sequence["RapidataFilter"] | None = None,
audience_id: str | None = None,
settings: Sequence["RapidataSetting"] | None = None,
) -> RapidataLeaderboard:
"""
Expand All @@ -338,8 +336,7 @@ def create_leaderboard(
inverse_ranking: Whether to inverse the ranking of the leaderboard. (if the question is inversed, e.g. "Which video is worse?")
level_of_detail: The level of detail of the leaderboard. This will effect how many comparisons are done per model evaluation. (default: "low")
min_responses_per_matchup: The minimum number of responses required to be considered for the leaderboard. (default: 3)
validation_set_id: The id of the validation set that should be attached to the leaderboard. (default: None)
filters: The filters that should be applied to the leaderboard. Will determine who can solve answer in the leaderboard. (default: [])
audience_id: The id of the audience that should answer the leaderboard. Defaults to the global audience when not specified.
settings: The settings that should be applied to the leaderboard. Will determine the behavior of the tasks on the leaderboard. (default: [])
"""
from rapidata.api_client.models.create_leaderboard_model import (
Expand Down Expand Up @@ -368,16 +365,15 @@ def create_leaderboard(
)

logger.info(
"Creating leaderboard %s with instruction %s, show_prompt %s, show_prompt_asset %s, inverse_ranking %s, level_of_detail %s, min_responses_per_matchup %s, validation_set_id %s, filters %s, settings %s",
"Creating leaderboard %s with instruction %s, show_prompt %s, show_prompt_asset %s, inverse_ranking %s, level_of_detail %s, min_responses_per_matchup %s, audience_id %s, settings %s",
name,
instruction,
show_prompt,
show_prompt_asset,
inverse_ranking,
level_of_detail,
min_responses_per_matchup,
validation_set_id,
filters,
audience_id,
settings,
)

Expand All @@ -396,12 +392,7 @@ def create_leaderboard(
if level_of_detail is not None
else None
),
validationSetId=validation_set_id,
filters=(
[filter._to_model() for filter in filters]
if filters
else None
),
audienceId=audience_id,
featureFlags=(
[setting._to_feature_flag() for setting in settings]
if settings
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading