Skip to content

Rapidata template manager

TemplateUploadException #

TemplateUploadException(
    dataset: RapidataDataset,
    failed_uploads: list[FailedUpload[Datapoint]],
    method: str,
)

Bases: FailedUploadException

Some pairs failed to upload, so no job was started.

Source code in src/rapidata/rapidata_client/job/rapidata_template_manager.py
def __init__(
    self,
    dataset: RapidataDataset,
    failed_uploads: list[FailedUpload[Datapoint]],
    method: str,
):
    self._method = method
    super().__init__(dataset, failed_uploads)

RapidataTemplateManager #

RapidataTemplateManager(openapi_service: OpenAPIService)

Run a Rapidata template on your own pairs in one call. 11 votes per pair.

Source code in src/rapidata/rapidata_client/job/rapidata_template_manager.py
def __init__(self, openapi_service: OpenAPIService):
    self._openapi_service = openapi_service

run_alignment #

run_alignment(
    name: str,
    datapoints: list[list[str]],
    *,
    contexts: list[str],
    a_b_names: list[str] | None = None
) -> RapidataJob

Asks which image (or video) matches the description better.

Parameters:

Name Type Description Default
name str

The name of the job. Not shown to annotators.

required
datapoints list[list[str]]

Pairs of file paths or URLs, [[a, b], ...]. One call is all images or all videos.

required
contexts list[str]

One prompt per pair. Warns above 200 characters; above 400 they are shortened to what the question needs.

required
a_b_names list[str] | None

Names for the first and second file of every pair, as in create_compare_job_definition. The results show them instead of "A" and "B".

None
Source code in src/rapidata/rapidata_client/job/rapidata_template_manager.py
def run_alignment(
    self,
    name: str,
    datapoints: list[list[str]],
    *,
    contexts: list[str],
    a_b_names: list[str] | None = None,
) -> RapidataJob:
    """Asks which image (or video) matches the description better.

    Args:
        name: The name of the job. Not shown to annotators.
        datapoints: Pairs of file paths or URLs, [[a, b], ...]. One call is all images
            or all videos.
        contexts: One prompt per pair. Warns above 200 characters; above 400 they
            are shortened to what the question needs.
        a_b_names: Names for the first and second file of every pair, as in
            create_compare_job_definition. The results show them instead of "A" and "B".
    """
    with tracer.start_as_current_span("TemplateManager.run_alignment"):
        return self._run("alignment", name, datapoints, contexts, a_b_names)

run_preference #

run_preference(
    name: str,
    datapoints: list[list[str]],
    *,
    a_b_names: list[str] | None = None
) -> RapidataJob

Asks which image (or video) annotators prefer. Arguments as run_alignment.

Source code in src/rapidata/rapidata_client/job/rapidata_template_manager.py
def run_preference(
    self,
    name: str,
    datapoints: list[list[str]],
    *,
    a_b_names: list[str] | None = None,
) -> RapidataJob:
    """Asks which image (or video) annotators prefer. Arguments as run_alignment."""
    with tracer.start_as_current_span("TemplateManager.run_preference"):
        return self._run("preference", name, datapoints, None, a_b_names)

run_coherence #

run_coherence(
    name: str,
    datapoints: list[list[str]],
    *,
    a_b_names: list[str] | None = None
) -> RapidataJob

Asks which image (or video) is more likely AI-generated. The winner is the side that looks more AI-generated. Arguments as run_alignment.

Source code in src/rapidata/rapidata_client/job/rapidata_template_manager.py
def run_coherence(
    self,
    name: str,
    datapoints: list[list[str]],
    *,
    a_b_names: list[str] | None = None,
) -> RapidataJob:
    """Asks which image (or video) is more likely AI-generated. The winner is the
    side that looks more AI-generated. Arguments as run_alignment."""
    with tracer.start_as_current_span("TemplateManager.run_coherence"):
        return self._run("coherence", name, datapoints, None, a_b_names)