Bases: BaseAIHordeRequest, JobRequestMixin, APIKeyAllowedInRequestMixin
Used when a worker submits a generation job. Includes metadata about the generation.
Represents a POST request to the /v2/generate/submit endpoint.
v2 API Model: SubmitInputStable
Source code in horde_sdk/ai_horde_api/apimodels/generate/submit.py
| @Unhashable
@Unequatable
class ImageGenerationJobSubmitRequest(
BaseAIHordeRequest,
JobRequestMixin,
APIKeyAllowedInRequestMixin,
):
"""Used when a worker submits a generation job. Includes metadata about the generation.
Represents a POST request to the /v2/generate/submit endpoint.
v2 API Model: `SubmitInputStable`
"""
generation: str | Literal["R2"] = ""
"""R2 result was uploaded to R2, else the string of the result as base64."""
state: GENERATION_STATE
"""The state of this generation."""
seed: int = 0
"""The seed for this generation."""
censored: bool = False
"""If True, this resulting image has been censored."""
gen_metadata: list[GenMetadataEntry] | None = None
"""Extra metadata about faulted or defaulted components of the generation"""
@model_validator(mode="after")
def validate_generation(self) -> ImageGenerationJobSubmitRequest:
"""Validate the generation field is not an empty string and warn if the seed is 0."""
if self.generation == "":
logger.error("Generation cannot be an empty string.")
logger.error(self.log_safe_model_dump())
if self.seed == 0:
logger.debug(f"Seed is 0 for {self.id_}. That might not be intended.")
logger.debug(self.log_safe_model_dump())
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_generate_submit
@override
@classmethod
def get_default_success_response_type(cls) -> type[JobSubmitResponse]:
return JobSubmitResponse
|
generation
class-attribute
instance-attribute
generation: str | Literal['R2'] = ''
R2 result was uploaded to R2, else the string of the result as base64.
state
instance-attribute
The state of this generation.
seed
class-attribute
instance-attribute
The seed for this generation.
censored
class-attribute
instance-attribute
If True, this resulting image has been censored.
gen_metadata: list[GenMetadataEntry] | None = None
Extra metadata about faulted or defaulted components of the generation
validate_generation
validate_generation() -> ImageGenerationJobSubmitRequest
Validate the generation field is not an empty string and warn if the seed is 0.
Source code in horde_sdk/ai_horde_api/apimodels/generate/submit.py
| @model_validator(mode="after")
def validate_generation(self) -> ImageGenerationJobSubmitRequest:
"""Validate the generation field is not an empty string and warn if the seed is 0."""
if self.generation == "":
logger.error("Generation cannot be an empty string.")
logger.error(self.log_safe_model_dump())
if self.seed == 0:
logger.debug(f"Seed is 0 for {self.id_}. That might not be intended.")
logger.debug(self.log_safe_model_dump())
return self
|
get_api_model_name
classmethod
get_api_model_name() -> str | None
Source code in horde_sdk/ai_horde_api/apimodels/generate/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/generate/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/generate/submit.py
| @override
@classmethod
def get_api_endpoint_subpath(cls) -> AI_HORDE_API_ENDPOINT_SUBPATH:
return AI_HORDE_API_ENDPOINT_SUBPATH.v2_generate_submit
|
get_default_success_response_type
classmethod
get_default_success_response_type() -> (
type[JobSubmitResponse]
)
Source code in horde_sdk/ai_horde_api/apimodels/generate/submit.py
| @override
@classmethod
def get_default_success_response_type(cls) -> type[JobSubmitResponse]:
return JobSubmitResponse
|