Skip to content

horde_sdk.ai_horde_api.apimodels.alchemy.submit

AlchemyJobSubmitResponse

Bases: HordeResponseBaseModel

Indicates that an alchemy job has been submitted successfully and the kudos gained.

Represents the data returned from the following endpoints and http status codes
  • /v2/interrogate/submit | AlchemyJobSubmitRequest [POST] -> 200

v2 API Model: GenerationSubmitted

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/submit.py
class AlchemyJobSubmitResponse(HordeResponseBaseModel):
    """Indicates that an alchemy job has been submitted successfully and the kudos gained.

    Represents the data returned from the following endpoints and http status codes:
        - /v2/interrogate/submit | AlchemyJobSubmitRequest [POST] -> 200

    v2 API Model: `GenerationSubmitted`
    """

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

    reward: float
    """The kudos reward for this job."""

reward instance-attribute

reward: float

The kudos reward for this job.

get_api_model_name classmethod

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

AlchemyJobSubmitRequest

Bases: BaseAIHordeRequest, JobRequestMixin, APIKeyAllowedInRequestMixin

Request to submit an alchemy job once a worker has completed it.

Represents a POST request to the /v2/interrogate/submit endpoint.

v2 API Model: SubmitInputStable

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/submit.py
class AlchemyJobSubmitRequest(BaseAIHordeRequest, JobRequestMixin, APIKeyAllowedInRequestMixin):
    """Request to submit an alchemy job once a worker has completed it.

    Represents a POST request to the /v2/interrogate/submit endpoint.

    v2 API Model: `SubmitInputStable`
    """

    result: dict[str, object] | str
    """The results of the alchemy job, keyed by form name. The API requires this field even for
    faulted submissions, though it is ignored server-side in that case.

    The API swagger doc declares this field as a string, but the server actually requires a
    dictionary and will reject string submissions; the `str` arm exists only for swagger
    compatibility."""
    state: GENERATION_STATE
    """The state of this generation. See `GENERATION_STATE` for more information."""

    @model_validator(mode="after")
    def warn_on_string_result(self) -> "AlchemyJobSubmitRequest":
        """Warn that the server will reject a string `result` despite the swagger doc allowing it."""
        if isinstance(self.result, str):
            logger.warning(
                "AlchemyJobSubmitRequest.result was given a string, but the server requires a dictionary "
                "keyed by form name and will reject this submission.",
            )

        return self

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

    @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_submit

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

result instance-attribute

result: dict[str, object] | str

The results of the alchemy job, keyed by form name. The API requires this field even for faulted submissions, though it is ignored server-side in that case.

The API swagger doc declares this field as a string, but the server actually requires a dictionary and will reject string submissions; the str arm exists only for swagger compatibility.

state instance-attribute

state: GENERATION_STATE

The state of this generation. See GENERATION_STATE for more information.

warn_on_string_result

warn_on_string_result() -> AlchemyJobSubmitRequest

Warn that the server will reject a string result despite the swagger doc allowing it.

Source code in horde_sdk/ai_horde_api/apimodels/alchemy/submit.py
@model_validator(mode="after")
def warn_on_string_result(self) -> "AlchemyJobSubmitRequest":
    """Warn that the server will reject a string `result` despite the swagger doc allowing it."""
    if isinstance(self.result, str):
        logger.warning(
            "AlchemyJobSubmitRequest.result was given a string, but the server requires a dictionary "
            "keyed by form name and will reject this submission.",
        )

    return self

get_api_model_name classmethod

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

get_http_method classmethod

get_http_method() -> HTTPMethod
Source code in horde_sdk/ai_horde_api/apimodels/alchemy/submit.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/submit.py
@override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
    return AI_HORDE_API_ENDPOINT_SUBPATH.v2_interrogate_submit

get_default_success_response_type classmethod

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