Skip to content

pixano_inference.api.v1.schemas

Re-export of the /v1 wire schemas (canonical home: pixano_inference.schemas.v1).

DeployModelRequest(**data)

Bases: _BaseModel

Admin request to deploy a model at runtime (mirrors a config-file ModelConfig).

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

JobStatus(**data)

Bases: _BaseModel

Status envelope for an asynchronous job.

Attributes:

Name Type Description
job_id str

Identifier of the job, from the submit response.

status Literal['running', 'completed', 'failed', 'canceled']

running until the job reaches a terminal state.

detail str | None

Why the job failed or was canceled, when it did.

data TrackingOutput | None

The result of a completed job, None otherwise. Jobs run tracking requests, so it is the :class:TrackingOutput the synchronous route would have returned.

metadata dict[str, Any]

Metadata of the model that ran the job.

timestamp datetime | None

When the job was submitted or, once terminal, when it ended.

processing_time float

Seconds from submission to the terminal state, 0 while running.

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

ModelStatusInfo(**data)

Bases: _BaseModel

Model listing entry with its live Serve status.

Attributes:

Name Type Description
name str

Deployment name, the model a request names.

capability str

Capability of the model, which fixes its route.

model_class str | None

Registered class name of the model.

model_path str | None

Checkpoint id or location, when the model has one.

status str

Live Ray Serve status of the deployment.

interface ModelInterface | None

How the model is called, as the model declares it (see :mod:pixano_inference.schemas.interface). None when the model declares none or the server could not fetch it.

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

TrackingKeyframeV1(**data)

Bases: _BaseModel

A keyframe with nested prompts, matching the Pixano frontend contract.

Frame indices are 0-based relative to the submitted media window.

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

TrackingPrompts(**data)

Bases: _BaseModel

Prompt payload for a single keyframe (points/box XOR mask).

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

TrackingRequestV1(**data)

Bases: BaseRequest

Video-tracking request with nested keyframe prompts.

A prompted request gives objects_ids and one keyframe per object. A prompt-free request (tracking by detection) gives only the video, and optionally classes and box_threshold.

Media is passed by value (URL/base64/frame list/path within an allowed media root); dataset-reference resolution belongs in the caller (the Pixano backend).

Source code in pydantic/main.py
def __init__(self, /, **data: Any) -> None:
    """Create a new model by parsing and validating input data from keyword arguments.

    Raises [`ValidationError`][pydantic_core.ValidationError] if the input data cannot be
    validated to form a valid model.

    `self` is explicitly positional-only to allow `self` as a field name.
    """
    # `__tracebackhide__` tells pytest and some other tools to omit this function from tracebacks
    __tracebackhide__ = True
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
    if self is not validated_self:
        warnings.warn(
            'A custom validator is returning a value other than `self`.\n'
            "Returning anything other than `self` from a top level model validator isn't supported when validating via `__init__`.\n"
            f'See the `model_validator` docs (https://pydantic.dev/docs/validation/{version_short()}/concepts/validators/#model-validators) for more details.',
            stacklevel=2,
        )

to_input()

Flatten the nested keyframes onto the internal :class:TrackingInput.

Source code in pixano_inference/schemas/v1.py
def to_input(self) -> TrackingInput:
    """Flatten the nested keyframes onto the internal :class:`TrackingInput`."""
    flat_keyframes = None
    if self.keyframes is not None:
        flat_keyframes = [
            TrackingKeyframe(
                frame_index=kf.frame_index,
                points=kf.prompts.points,
                box=kf.prompts.box,
                mask=kf.prompts.mask,
            )
            for kf in self.keyframes
        ]
    return TrackingInput(
        video=self.video,
        objects_ids=self.objects_ids,
        frame_indexes=self.frame_indexes,
        propagate=self.propagate,
        interval=self.interval,
        keyframes=flat_keyframes,
        classes=self.classes,
        box_threshold=self.box_threshold,
    )