Skip to content

_status

Generation

Bases: HordeAPIObjectBaseModel

Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
class Generation(HordeAPIObjectBaseModel):
    model: str = Field(title="Generation Model")
    """The model which generated this image."""
    state: GENERATION_STATE = Field(
        ...,
        examples=["ok"],
        title="Generation State",
    )
    """OBSOLETE (Use the gen_metadata field). The state of this generation."""
    worker_id: str | WorkerID = Field(
        title="Worker ID",
    )
    """The UUID of the worker which generated this image."""
    worker_name: str = Field(
        title="Worker Name",
    )
    """The name of the worker which generated this image."""

model class-attribute instance-attribute

model: str = Field(title='Generation Model')

The model which generated this image.

state class-attribute instance-attribute

state: GENERATION_STATE = Field(..., examples=['ok'], title='Generation State')

OBSOLETE (Use the gen_metadata field). The state of this generation.

worker_id class-attribute instance-attribute

worker_id: str | WorkerID = Field(title='Worker ID')

The UUID of the worker which generated this image.

worker_name class-attribute instance-attribute

worker_name: str = Field(title='Worker Name')

The name of the worker which generated this image.

ImageGeneration

Bases: Generation

Represents the individual image generation responses in a ImageGenerateStatusResponse.

v2 API Model: GenerationStable

Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
class ImageGeneration(Generation):
    """Represents the individual image generation responses in a ImageGenerateStatusResponse.

    v2 API Model: `GenerationStable`
    """

    id_: JobID = Field(alias="id")
    """The UUID of this generation. Is always returned as a `JobID`, but can initialized from a `str`."""
    # todo: remove `str`?
    img: str
    """The generated image as a Base64-encoded .webp file."""
    seed: str
    """The seed which generated this image."""
    censored: bool
    """When true this image has been censored by the worker's safety filter."""
    gen_metadata: list[GenMetadataEntry] | None = None
    """Extra metadata about faulted or defaulted components of the generation"""

    @override
    @classmethod
    def get_api_model_name(self) -> str | None:
        return "GenerationStable"

    @field_validator("id_", mode="before")
    def validate_id(cls, v: str | JobID) -> JobID | str:
        if isinstance(v, str) and v == "":
            logger.warning("Job ID is empty")
            return JobID(root=uuid.uuid4())

        return v

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, ImageGeneration):
            return False
        return self.id_ == other.id_

    def __hash__(self) -> int:
        return hash(ImageGeneration.__name__) + hash(self.id_)

id_ class-attribute instance-attribute

id_: JobID = Field(alias='id')

The UUID of this generation. Is always returned as a JobID, but can initialized from a str.

img instance-attribute

img: str

The generated image as a Base64-encoded .webp file.

seed instance-attribute

seed: str

The seed which generated this image.

censored instance-attribute

censored: bool

When true this image has been censored by the worker's safety filter.

gen_metadata class-attribute instance-attribute

gen_metadata: list[GenMetadataEntry] | None = None

Extra metadata about faulted or defaulted components of the generation

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_model_name(self) -> str | None:
    return "GenerationStable"

validate_id

validate_id(v: str | JobID) -> JobID | str
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@field_validator("id_", mode="before")
def validate_id(cls, v: str | JobID) -> JobID | str:
    if isinstance(v, str) and v == "":
        logger.warning("Job ID is empty")
        return JobID(root=uuid.uuid4())

    return v

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, ImageGeneration):
        return False
    return self.id_ == other.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
def __hash__(self) -> int:
    return hash(ImageGeneration.__name__) + hash(self.id_)

ImageGenerateStatusResponse

Bases: HordeResponseBaseModel, ResponseWithProgressMixin, ResponseGenerationProgressInfoMixin

Represent the response from the AI-Horde API when checking the status of an image generation job.

v2 API Model: RequestStatusStable

Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
class ImageGenerateStatusResponse(
    HordeResponseBaseModel,
    ResponseWithProgressMixin,
    ResponseGenerationProgressInfoMixin,
):
    """Represent the response from the AI-Horde API when checking the status of an image generation job.

    v2 API Model: `RequestStatusStable`
    """

    generations: list[ImageGeneration] = Field(default_factory=list)
    """The individual image generation responses in this request."""
    shared: bool | None = False
    """If True, These images have been shared with LAION."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return "RequestStatusStable"

    @override
    @classmethod
    def get_finalize_success_request_type(cls) -> None:
        return None

    @override
    def is_job_complete(self, number_of_result_expected: int) -> bool:
        return len(self.generations) == number_of_result_expected

    @override
    def is_job_possible(self) -> bool:
        return self.is_possible

    @override
    @classmethod
    def is_final_follow_up(cls) -> bool:
        return True

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, ImageGenerateStatusResponse):
            return False
        return all(gen in other.generations for gen in self.generations)

    def __hash__(self) -> int:
        return hash(tuple(self.generations))

generations class-attribute instance-attribute

generations: list[ImageGeneration] = Field(default_factory=list)

The individual image generation responses in this request.

shared class-attribute instance-attribute

shared: bool | None = False

If True, These images have been shared with LAION.

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return "RequestStatusStable"

get_finalize_success_request_type classmethod

get_finalize_success_request_type() -> None
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_finalize_success_request_type(cls) -> None:
    return None

is_job_complete

is_job_complete(number_of_result_expected: int) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def is_job_complete(self, number_of_result_expected: int) -> bool:
    return len(self.generations) == number_of_result_expected

is_job_possible

is_job_possible() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def is_job_possible(self) -> bool:
    return self.is_possible

is_final_follow_up classmethod

is_final_follow_up() -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def is_final_follow_up(cls) -> bool:
    return True

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, ImageGenerateStatusResponse):
        return False
    return all(gen in other.generations for gen in self.generations)

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
def __hash__(self) -> int:
    return hash(tuple(self.generations))

DeleteImageGenerateRequest

Bases: BaseAIHordeRequest, JobRequestMixin

Represents a DELETE request to the /v2/generate/status/{id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
class DeleteImageGenerateRequest(
    BaseAIHordeRequest,
    JobRequestMixin,
):
    """Represents a DELETE request to the `/v2/generate/status/{id}` endpoint."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.DELETE

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_status

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ImageGenerateStatusResponse]:
        return ImageGenerateStatusResponse

    @override
    def __eq__(self, value: object) -> bool:
        if not isinstance(value, DeleteImageGenerateRequest):
            return False

        return self.id_ == value.id_

    @override
    def __hash__(self) -> int:
        return hash(DeleteImageGenerateRequest.__name__) + hash(self.id_)

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.DELETE

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_status

get_default_success_response_type classmethod

get_default_success_response_type() -> type[ImageGenerateStatusResponse]
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ImageGenerateStatusResponse]:
    return ImageGenerateStatusResponse

__eq__

__eq__(value: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def __eq__(self, value: object) -> bool:
    if not isinstance(value, DeleteImageGenerateRequest):
        return False

    return self.id_ == value.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def __hash__(self) -> int:
    return hash(DeleteImageGenerateRequest.__name__) + hash(self.id_)

ImageGenerateStatusRequest

Bases: BaseAIHordeRequest, JobRequestMixin

Represents a GET request to the /v2/generate/status/{id} endpoint.

Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
class ImageGenerateStatusRequest(BaseAIHordeRequest, JobRequestMixin):
    """Represents a GET request to the `/v2/generate/status/{id}` endpoint."""

    @override
    @classmethod
    def get_api_model_name(cls) -> str | None:
        return None

    @override
    @classmethod
    def get_http_method(cls) -> HTTPMethod:
        return HTTPMethod.GET

    @override
    @classmethod
    def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
        return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_status

    @override
    @classmethod
    def get_default_success_response_type(cls) -> type[ImageGenerateStatusResponse]:
        return ImageGenerateStatusResponse

    @override
    def __eq__(self, value: object) -> bool:
        if not isinstance(value, ImageGenerateStatusRequest):
            return False

        return self.id_ == value.id_

    @override
    def __hash__(self) -> int:
        return hash(ImageGenerateStatusRequest.__name__) + hash(self.id_)

get_api_model_name classmethod

get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_model_name(cls) -> str | None:
    return None

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.GET

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_status

get_default_success_response_type classmethod

get_default_success_response_type() -> type[ImageGenerateStatusResponse]
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
@classmethod
def get_default_success_response_type(cls) -> type[ImageGenerateStatusResponse]:
    return ImageGenerateStatusResponse

__eq__

__eq__(value: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def __eq__(self, value: object) -> bool:
    if not isinstance(value, ImageGenerateStatusRequest):
        return False

    return self.id_ == value.id_

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/generate/_status.py
@override
def __hash__(self) -> int:
    return hash(ImageGenerateStatusRequest.__name__) + hash(self.id_)