Rapidata benchmark
RapidataBenchmark #
An instance of a Rapidata benchmark.
Used to interact with a specific benchmark in the Rapidata system, such as retrieving prompts and evaluating models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name that will be used to identify the benchmark on the overview. |
required |
id
|
str
|
The id of the benchmark. |
required |
openapi_service
|
OpenAPIService
|
The OpenAPI service to use to interact with the Rapidata API. |
required |
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark.py
prompts
property
#
Returns the prompts that are registered for the leaderboard.
prompt_assets
property
#
Returns the prompt assets that are registered for the benchmark.
leaderboards
property
#
leaderboards: list[RapidataLeaderboard]
Returns the leaderboards that are registered for the benchmark.
add_prompt #
add_prompt(
identifier: str | None = None,
prompt: str | None = None,
prompt_asset: str | None = None,
tags: Optional[list[str]] = None,
)
Adds a prompt to the benchmark.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
identifier
|
str | None
|
The identifier of the prompt/asset/tags that will be used to match up the media. If not provided, it will use the prompt, asset or prompt + asset as the identifier. |
None
|
prompt
|
str | None
|
The prompt that will be used to evaluate the model. |
None
|
prompt_asset
|
str | None
|
The prompt asset that will be used to evaluate the model. Provided as a link to the asset. |
None
|
tags
|
Optional[list[str]]
|
The tags can be used to filter the leaderboard results. They will NOT be shown to the users. |
None
|
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
|
create_leaderboard #
create_leaderboard(
name: str,
instruction: str,
show_prompt: bool = False,
show_prompt_asset: bool = False,
inverse_ranking: bool = False,
level_of_detail: Literal[
"low", "medium", "high", "very high"
] = "low",
min_responses_per_matchup: int = 3,
validation_set_id: str | None = None,
filters: Sequence[RapidataFilter] = [],
settings: Sequence[RapidataSetting] = [],
) -> RapidataLeaderboard
Creates a new leaderboard for the benchmark.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the leaderboard. (not shown to the users) |
required |
instruction
|
str
|
The instruction decides how the models will be evaluated. |
required |
show_prompt
|
bool
|
Whether to show the prompt to the users. (default: False) |
False
|
show_prompt_asset
|
bool
|
Whether to show the prompt asset to the users. (only works if the prompt asset is a URL) (default: False) |
False
|
inverse_ranking
|
bool
|
Whether to inverse the ranking of the leaderboard. (if the question is inversed, e.g. "Which video is worse?") |
False
|
level_of_detail
|
Literal['low', 'medium', 'high', 'very high']
|
The level of detail of the leaderboard. This will effect how many comparisons are done per model evaluation. (default: "low") |
'low'
|
min_responses_per_matchup
|
int
|
The minimum number of responses required to be considered for the leaderboard. (default: 3) |
3
|
validation_set_id
|
str | None
|
The id of the validation set that should be attached to the leaderboard. (default: None) |
None
|
filters
|
Sequence[RapidataFilter]
|
The filters that should be applied to the leaderboard. Will determine who can solve answer in the leaderboard. (default: []) |
[]
|
settings
|
Sequence[RapidataSetting]
|
The settings that should be applied to the leaderboard. Will determine the behavior of the tasks on the leaderboard. (default: []) |
[]
|
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark.py
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
evaluate_model #
evaluate_model(
name: str,
media: list[str],
identifiers: list[str] | None = None,
prompts: list[str] | None = None,
) -> None
Evaluates a model on the benchmark across all leaderboards.
prompts or identifiers must be provided to match the media.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
The name of the model. |
required |
media
|
list[str]
|
The generated images/videos that will be used to evaluate the model. |
required |
identifiers
|
list[str] | None
|
The identifiers that correspond to the media. The order of the identifiers must match the order of the media. The identifiers that are used must be registered for the benchmark. To see the registered identifiers, use the identifiers property. |
None
|
prompts
|
list[str] | None
|
The prompts that correspond to the media. The order of the prompts must match the order of the media. |
None
|
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark.py
373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 |
|
view #
Views the benchmark.