diff --git a/horde_sdk/ai_horde_api/ai_horde_clients.py b/horde_sdk/ai_horde_api/ai_horde_clients.py index b832794..b549cf8 100644 --- a/horde_sdk/ai_horde_api/ai_horde_clients.py +++ b/horde_sdk/ai_horde_api/ai_horde_clients.py @@ -1025,6 +1025,7 @@ async def image_generate_request( image_gen_request: ImageGenerateAsyncRequest, timeout: int = GENERATION_MAX_LIFE, check_callback: Callable[[ImageGenerateCheckResponse], None] | None = None, + delay: float = 0.0, ) -> tuple[ImageGenerateStatusResponse, JobID]: """Submit an image generation request to the AI-Horde API, and wait for it to complete. @@ -1044,6 +1045,8 @@ async def image_generate_request( AIHordeRequestError: If the request failed. The error response is included in the exception. """ + await asyncio.sleep(delay) + timeout = self.validate_timeout(timeout, log_message=True) n = image_gen_request.params.n if image_gen_request.params and image_gen_request.params.n else 1 diff --git a/horde_sdk/ai_horde_api/apimodels/alchemy/_async.py b/horde_sdk/ai_horde_api/apimodels/alchemy/_async.py index 96cec3c..86d3c67 100644 --- a/horde_sdk/ai_horde_api/apimodels/alchemy/_async.py +++ b/horde_sdk/ai_horde_api/apimodels/alchemy/_async.py @@ -71,7 +71,7 @@ class AlchemyAsyncRequestFormItem(HordeAPIDataObject): def check_name(cls, v: KNOWN_ALCHEMY_TYPES | str) -> KNOWN_ALCHEMY_TYPES | str: if isinstance(v, KNOWN_ALCHEMY_TYPES): return v - if isinstance(v, str) and v not in KNOWN_ALCHEMY_TYPES.__members__: + if str(v) not in KNOWN_ALCHEMY_TYPES.__members__: logger.warning(f"Unknown alchemy form name {v}. Is your SDK out of date or did the API change?") return v @@ -83,8 +83,8 @@ class AlchemyAsyncRequest( forms: list[AlchemyAsyncRequestFormItem] source_image: str """The public URL of the source image or a base64 string to use.""" - slow_workers: bool = False - """Whether to use the slower workers. Costs additional kudos if `True`.""" + slow_workers: bool = True + """Whether to use the slower workers. Costs additional kudos if `False`.""" @field_validator("forms") def check_at_least_one_form(cls, v: list[AlchemyAsyncRequestFormItem]) -> list[AlchemyAsyncRequestFormItem]: diff --git a/horde_sdk/ai_horde_api/apimodels/alchemy/_status.py b/horde_sdk/ai_horde_api/apimodels/alchemy/_status.py index d31d385..71d433c 100644 --- a/horde_sdk/ai_horde_api/apimodels/alchemy/_status.py +++ b/horde_sdk/ai_horde_api/apimodels/alchemy/_status.py @@ -71,9 +71,7 @@ class AlchemyFormStatus(HordeAPIDataObject): 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__) or ( - not isinstance(v, KNOWN_ALCHEMY_TYPES) - ): + if str(v) not in KNOWN_ALCHEMY_TYPES.__members__: logger.warning(f"Unknown form type {v}. Is your SDK out of date or did the API change?") return v diff --git a/horde_sdk/generic_api/apimodels.py b/horde_sdk/generic_api/apimodels.py index 61c6889..770acaf 100644 --- a/horde_sdk/generic_api/apimodels.py +++ b/horde_sdk/generic_api/apimodels.py @@ -375,7 +375,7 @@ class RequestUsesImageWorkerMixin(BaseModel): """Mix-in class to describe an endpoint for which you can specify workers.""" trusted_workers: bool = False - slow_workers: bool = False + slow_workers: bool = True workers: list[str] = Field(default_factory=list) worker_blacklist: list[str] = Field(default_factory=list)