Skip to content

_pop

AlchemyFormPayloadStable

Bases: HordeAPIObjectBaseModel

Currently unsupported.

v2 API Model: ModelInterrogationFormPayloadStable

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
class AlchemyFormPayloadStable(HordeAPIObjectBaseModel):
    """Currently unsupported.

    v2 API Model: `ModelInterrogationFormPayloadStable`
    """

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

    additionalProp1: str = Field(
        validation_alias="additionalProp1",
    )
    """Currently unsupported."""
    additionalProp2: str = Field(
        validation_alias="additionalProp2",
    )
    """Currently unsupported."""
    additionalProp3: str = Field(
        validation_alias="additionalProp3",
    )
    """Currently unsupported."""

additionalProp1 class-attribute instance-attribute

additionalProp1: str = Field(validation_alias='additionalProp1')

Currently unsupported.

additionalProp2 class-attribute instance-attribute

additionalProp2: str = Field(validation_alias='additionalProp2')

Currently unsupported.

additionalProp3 class-attribute instance-attribute

additionalProp3: str = Field(validation_alias='additionalProp3')

Currently unsupported.

get_api_model_name classmethod

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

AlchemyPopFormPayload

Bases: HordeAPIObjectBaseModel, JobRequestMixin

v2 API Model: InterrogationPopFormPayload.

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
class AlchemyPopFormPayload(HordeAPIObjectBaseModel, JobRequestMixin):
    """v2 API Model: `InterrogationPopFormPayload`."""

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

    form: KNOWN_ALCHEMY_TYPES | str = Field(
        examples=["caption"],
    )
    """The name of this interrogation form."""

    @field_validator("form", mode="before")
    def validate_form(cls, v: str | KNOWN_ALCHEMY_TYPES) -> KNOWN_ALCHEMY_TYPES | str:
        if isinstance(v, KNOWN_ALCHEMY_TYPES):
            return v
        if isinstance(v, str) and v not in KNOWN_ALCHEMY_TYPES.__members__:
            logger.warning(f"Unknown form type {v}")
        return v

    payload: AlchemyFormPayloadStable | None = None
    """The setting for this interrogation form."""
    r2_upload: str | None = Field(
        default=None,
    )
    """The URL in which the post-processed image can be uploaded."""
    source_image: str | None = Field(
        default=None,
    )
    """The URL From which the source image can be downloaded."""

form class-attribute instance-attribute

form: KNOWN_ALCHEMY_TYPES | str = Field(examples=['caption'])

The name of this interrogation form.

payload class-attribute instance-attribute

payload: AlchemyFormPayloadStable | None = None

The setting for this interrogation form.

r2_upload class-attribute instance-attribute

r2_upload: str | None = Field(default=None)

The URL in which the post-processed image can be uploaded.

source_image class-attribute instance-attribute

source_image: str | None = Field(default=None)

The URL From which the source image can be downloaded.

get_api_model_name classmethod

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

validate_form

validate_form(v: str | KNOWN_ALCHEMY_TYPES) -> KNOWN_ALCHEMY_TYPES | str
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@field_validator("form", mode="before")
def validate_form(cls, v: str | KNOWN_ALCHEMY_TYPES) -> KNOWN_ALCHEMY_TYPES | str:
    if isinstance(v, KNOWN_ALCHEMY_TYPES):
        return v
    if isinstance(v, str) and v not in KNOWN_ALCHEMY_TYPES.__members__:
        logger.warning(f"Unknown form type {v}")
    return v

NoValidAlchemyFound

Bases: HordeAPIObjectBaseModel

v2 API Model: NoValidInterrogationsFoundStable.

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
class NoValidAlchemyFound(HordeAPIObjectBaseModel):
    """v2 API Model: `NoValidInterrogationsFoundStable`."""

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

    bridge_version: int | None = Field(
        default=None,
        description=(
            "How many waiting requests were skipped because they require a higher version of the bridge than this"
            " worker is running (upgrade if you see this in your skipped list)."
        ),
        examples=[0],
        ge=0,
    )
    """How many waiting requests were skipped because they require a higher version of the bridge than this worker is
    running (upgrade if you see this in your skipped list)."""
    untrusted: int | None = Field(
        default=None,
        description=(
            "How many waiting requests were skipped because they demanded a trusted worker which this worker is not."
        ),
        ge=0,
    )
    """How many waiting requests were skipped because they demanded a trusted worker which this worker is not."""
    worker_id: int | None = Field(
        default=None,
        ge=0,
    )
    """How many waiting requests were skipped because they demanded a specific worker."""

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, NoValidAlchemyFound):
            return False

        return (
            self.bridge_version == other.bridge_version
            and self.untrusted == other.untrusted
            and self.worker_id == other.worker_id
        )

    def __hash__(self) -> int:
        return hash((self.bridge_version, self.untrusted, self.worker_id))

bridge_version class-attribute instance-attribute

bridge_version: int | None = Field(default=None, description='How many waiting requests were skipped because they require a higher version of the bridge than this worker is running (upgrade if you see this in your skipped list).', examples=[0], ge=0)

How many waiting requests were skipped because they require a higher version of the bridge than this worker is running (upgrade if you see this in your skipped list).

untrusted class-attribute instance-attribute

untrusted: int | None = Field(default=None, description='How many waiting requests were skipped because they demanded a trusted worker which this worker is not.', ge=0)

How many waiting requests were skipped because they demanded a trusted worker which this worker is not.

worker_id class-attribute instance-attribute

worker_id: int | None = Field(default=None, ge=0)

How many waiting requests were skipped because they demanded a specific worker.

get_api_model_name classmethod

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

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, NoValidAlchemyFound):
        return False

    return (
        self.bridge_version == other.bridge_version
        and self.untrusted == other.untrusted
        and self.worker_id == other.worker_id
    )

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
def __hash__(self) -> int:
    return hash((self.bridge_version, self.untrusted, self.worker_id))

AlchemyPopResponse

Bases: HordeResponseBaseModel, ResponseRequiringFollowUpMixin

v2 API Model: InterrogationPopPayload.

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
class AlchemyPopResponse(HordeResponseBaseModel, ResponseRequiringFollowUpMixin):
    """v2 API Model: `InterrogationPopPayload`."""

    # and not actually specifying a schema
    forms: list[AlchemyPopFormPayload] | None = None
    """The forms that to be generated"""
    skipped: NoValidAlchemyFound | None = None
    """The requests that were skipped because this worker were not eligible for them."""

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

    @override
    @classmethod
    def get_follow_up_default_request_type(cls) -> type[AlchemyJobSubmitRequest]:
        return AlchemyJobSubmitRequest

    @override
    @classmethod
    def get_follow_up_failure_cleanup_request_type(cls) -> type[AlchemyJobSubmitRequest]:
        return AlchemyJobSubmitRequest

    @override
    def get_follow_up_returned_params(self, *, as_python_field_name: bool = False) -> list[dict[str, object]]:
        if not self.forms:
            return []
        all_ids: list[dict[str, object]] = []
        for form in self.forms:
            if not isinstance(form, AlchemyPopFormPayload):
                logger.warning(f"Skipping form {form} as it is not an AlchemyPopFormPayload")
                continue
            if form.id_:
                if as_python_field_name:
                    all_ids.append({"id_": form.id_})
                else:
                    all_ids.append({"id": form.id_})

        return all_ids

    @model_validator(mode="after")
    def coerce_list_order(self) -> AlchemyPopResponse:
        if self.forms is not None:
            logger.debug("Sorting forms by id")
            self.forms.sort(key=lambda form: form.id_)

        return self

    @override
    @classmethod
    def get_follow_up_request_types(cls) -> list[type[AlchemyJobSubmitRequest]]:  # type: ignore[override]
        """Return a list of all the possible follow up request types for this response."""
        return [AlchemyJobSubmitRequest]

    def __eq__(self, other: object) -> bool:
        if not isinstance(other, AlchemyPopResponse):
            return False

        forms_match = True
        skipped_match = True

        if self.forms is not None and other.forms is not None:
            forms_match = all(form in other.forms for form in self.forms)

        if self.skipped is not None:
            skipped_match = self.skipped == other.skipped

        return forms_match and skipped_match

    def __hash__(self) -> int:
        if self.forms is None:
            return hash(self.skipped)

        return hash((tuple([form.id_ for form in self.forms]), self.skipped))

forms class-attribute instance-attribute

forms: list[AlchemyPopFormPayload] | None = None

The forms that to be generated

skipped class-attribute instance-attribute

skipped: NoValidAlchemyFound | None = None

The requests that were skipped because this worker were not eligible for them.

get_api_model_name classmethod

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

get_follow_up_default_request_type classmethod

get_follow_up_default_request_type() -> type[AlchemyJobSubmitRequest]
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
@classmethod
def get_follow_up_default_request_type(cls) -> type[AlchemyJobSubmitRequest]:
    return AlchemyJobSubmitRequest

get_follow_up_failure_cleanup_request_type classmethod

get_follow_up_failure_cleanup_request_type() -> type[AlchemyJobSubmitRequest]
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
@classmethod
def get_follow_up_failure_cleanup_request_type(cls) -> type[AlchemyJobSubmitRequest]:
    return AlchemyJobSubmitRequest

get_follow_up_returned_params

get_follow_up_returned_params(*, as_python_field_name: bool = False) -> list[dict[str, object]]
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
def get_follow_up_returned_params(self, *, as_python_field_name: bool = False) -> list[dict[str, object]]:
    if not self.forms:
        return []
    all_ids: list[dict[str, object]] = []
    for form in self.forms:
        if not isinstance(form, AlchemyPopFormPayload):
            logger.warning(f"Skipping form {form} as it is not an AlchemyPopFormPayload")
            continue
        if form.id_:
            if as_python_field_name:
                all_ids.append({"id_": form.id_})
            else:
                all_ids.append({"id": form.id_})

    return all_ids

coerce_list_order

coerce_list_order() -> AlchemyPopResponse
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@model_validator(mode="after")
def coerce_list_order(self) -> AlchemyPopResponse:
    if self.forms is not None:
        logger.debug("Sorting forms by id")
        self.forms.sort(key=lambda form: form.id_)

    return self

get_follow_up_request_types classmethod

get_follow_up_request_types() -> list[type[AlchemyJobSubmitRequest]]

Return a list of all the possible follow up request types for this response.

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
@classmethod
def get_follow_up_request_types(cls) -> list[type[AlchemyJobSubmitRequest]]:  # type: ignore[override]
    """Return a list of all the possible follow up request types for this response."""
    return [AlchemyJobSubmitRequest]

__eq__

__eq__(other: object) -> bool
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
def __eq__(self, other: object) -> bool:
    if not isinstance(other, AlchemyPopResponse):
        return False

    forms_match = True
    skipped_match = True

    if self.forms is not None and other.forms is not None:
        forms_match = all(form in other.forms for form in self.forms)

    if self.skipped is not None:
        skipped_match = self.skipped == other.skipped

    return forms_match and skipped_match

__hash__

__hash__() -> int
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
def __hash__(self) -> int:
    if self.forms is None:
        return hash(self.skipped)

    return hash((tuple([form.id_ for form in self.forms]), self.skipped))

AlchemyPopRequest

Bases: BaseAIHordeRequest, APIKeyAllowedInRequestMixin

Represents the data needed to make a request to the /v2/interrogate/pop endpoint.

v2 API Model: InterrogationPopInput

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
class AlchemyPopRequest(BaseAIHordeRequest, APIKeyAllowedInRequestMixin):
    """Represents the data needed to make a request to the `/v2/interrogate/pop` endpoint.

    v2 API Model: `InterrogationPopInput`
    """

    name: str
    """The name of the request. This is used to identify the request in the logs."""
    priority_usernames: list[str]
    """The usernames that should be prioritized for this request."""
    forms: list[KNOWN_ALCHEMY_TYPES]
    """The types of alchemy that should be generated."""

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

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

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

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

name instance-attribute

name: str

The name of the request. This is used to identify the request in the logs.

priority_usernames instance-attribute

priority_usernames: list[str]

The usernames that should be prioritized for this request.

forms instance-attribute

forms: list[KNOWN_ALCHEMY_TYPES]

The types of alchemy that should be generated.

get_api_model_name classmethod

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

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
@classmethod
def get_http_method(cls) -> HTTPMethod:
    return HTTPMethod.POST

get_api_endpoint_subpath classmethod

get_api_endpoint_subpath() -> AI_HORDE_API_ENDPOINT_SUBPATH
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/_pop.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_interrogate_pop

get_default_success_response_type classmethod

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