Rapidata benchmark manager
RapidataBenchmarkManager #
A manager for benchmarks.
Used to create and retrieve benchmarks.
A benchmark is a collection of leaderboards.
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py
create_new_benchmark #
create_new_benchmark(
name: str,
identifiers: Optional[list[str]] = None,
prompts: Optional[list[str | None] | list[str]] = None,
prompt_assets: Optional[
list[str | None] | list[str]
] = None,
tags: Optional[
Sequence[Sequence[str | Tag] | None]
] = None,
origins: Optional[Sequence[Origin | str | None]] = None,
) -> RapidataBenchmark
Creates a new benchmark with the given name, identifiers, prompts, and media assets. Everything is matched up by the indexes of the lists.
prompts or identifiers must be provided, as well as prompts or prompt_assets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the benchmark. |
required |
identifiers
|
Optional[list[str]]
|
The identifiers of the prompts/assets/tags that will be used to match up the media. If not provided, it will use the prompts as the identifiers. |
None
|
prompts
|
Optional[list[str | None] | list[str]]
|
The prompts that will be registered for the benchmark. |
None
|
prompt_assets
|
Optional[list[str | None] | list[str]]
|
The prompt assets that will be registered for the benchmark. |
None
|
tags
|
Optional[Sequence[Sequence[str | Tag] | None]]
|
The tags per prompt, used to filter and organize the leaderboard results. They are NOT shown to the users. Each entry is a list of plain strings, a list of :class: |
None
|
origins
|
Optional[Sequence[Origin | str | None]]
|
The origin of each prompt (e.g. a source dataset). Each entry is a plain string (converted to |
None
|
Example
name = "Example Benchmark"
identifiers = ["id1", "id2", "id3"]
prompts = ["prompt 1", "prompt 2", "prompt 3"]
prompt_assets = ["https://assets.rapidata.ai/prompt_1.jpg", "https://assets.rapidata.ai/prompt_2.jpg", "https://assets.rapidata.ai/prompt_3.jpg"]
tags = [["tag1", "tag2"], ["tag2"], ["tag2", "tag3"]]
benchmark = create_new_benchmark(name=name, identifiers=identifiers, prompts=prompts, prompt_assets=prompt_assets, tags=tags)
# Add categories, and record where each prompt came from, when you need them.
from rapidata import Tag
benchmark = create_new_benchmark(
name=name,
identifiers=identifiers,
prompts=prompts,
tags=[[Tag("tag1", category="group"), "tag2"], ["tag2"], ["tag3"]],
origins=["coco", "coco", "coco"],
)
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py
get_benchmark_by_id #
get_benchmark_by_id(id: str) -> RapidataBenchmark
Returns a benchmark by its ID.
Source code in src/rapidata/rapidata_client/benchmark/rapidata_benchmark_manager.py
find_benchmarks #
find_benchmarks(
name: str = "", amount: int = 10, page: int = 1
) -> list[RapidataBenchmark]
Returns a list of benchmarks by their name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the benchmark - matching benchmark will contain the name. Defaults to "" for any benchmark. |
''
|
amount
|
int
|
The amount of benchmarks to return. Defaults to 10. |
10
|
page
|
int
|
The page of benchmarks to return. Defaults to 1. |
1
|
Returns:
| Type | Description |
|---|---|
list[RapidataBenchmark]
|
list[RapidataBenchmark]: A list of RapidataBenchmark instances. |