Skip to content

Commit

Permalink
fix: use API visible field name for steps/n_iter
Browse files Browse the repository at this point in the history
  • Loading branch information
tazlin committed Sep 15, 2023
1 parent e7136c1 commit a257227
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
8 changes: 7 additions & 1 deletion horde_sdk/ai_horde_api/apimodels/generate/_async.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from pydantic import model_validator
from pydantic import AliasChoices, Field, model_validator
from typing_extensions import override

from horde_sdk.ai_horde_api.apimodels.base import (
Expand Down Expand Up @@ -77,6 +77,12 @@ class ImageGenerationInputPayload(HordeAPIObject, ImageGenerateParamMixin):
v2 API Model: `ModelGenerationInputStable`
"""

steps: int = Field(default=25, ge=1, validation_alias=AliasChoices("steps", "ddim_steps"))
"""The number of image generation steps to perform."""

n: int = Field(default=1, ge=1, le=20, validation_alias=AliasChoices("n", "n_iter"))
"""The number of images to generate. Defaults to 1, maximum is 20."""

@override
@classmethod
def get_api_model_name(cls) -> str | None:
Expand Down
7 changes: 6 additions & 1 deletion horde_sdk/ai_horde_api/apimodels/generate/_pop.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pydantic
from pydantic import Field, field_validator
from pydantic import AliasChoices, Field, field_validator
from typing_extensions import override

from horde_sdk.ai_horde_api.apimodels.base import (
Expand Down Expand Up @@ -63,6 +63,11 @@ class ImageGenerateJobPopSkippedStatus(pydantic.BaseModel):

class ImageGenerateJobPopPayload(ImageGenerateParamMixin):
prompt: str
ddim_steps: int = Field(default=25, ge=1, validation_alias=AliasChoices("steps", "ddim_steps"))
"""The number of image generation steps to perform."""

n_iter: int = Field(default=1, ge=1, le=20, validation_alias=AliasChoices("n", "n_iter"))
"""The number of images to generate. Defaults to 1, maximum is 20."""


class ImageGenerateJobResponse(HordeResponseBaseModel, JobResponseMixin, ResponseRequiringFollowUpMixin):
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "horde_sdk"
version = "0.7.3"
version = "0.7.4"
description = "A python toolkit for interacting with the horde APIs, services, and ecosystem."
authors = [
{name = "tazlin", email = "[email protected]"},
Expand All @@ -18,7 +18,7 @@ classifiers = [
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU Affero General Public License v3",
"Development Status :: 2 - Pre-Alpha",
"Development Status :: 4 - Beta",
]

[tool.setuptools.package-dir]
Expand Down

0 comments on commit a257227

Please sign in to comment.