Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 26 additions & 6 deletions decart/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,29 @@ class ModelDefinition(DecartBaseModel):


class TextToVideoInput(BaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(..., min_length=1, max_length=1000)
seed: Optional[int] = None
resolution: Optional[str] = None
orientation: Optional[str] = None


class ImageToVideoInput(DecartBaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(
...,
min_length=1,
max_length=1000,
)
data: FileInput
seed: Optional[int] = None
resolution: Optional[str] = None


class VideoToVideoInput(DecartBaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(
...,
min_length=1,
max_length=1000,
)
data: FileInput
seed: Optional[int] = None
resolution: Optional[str] = None
Expand All @@ -55,7 +63,11 @@ class VideoToVideoInput(DecartBaseModel):


class FirstLastFrameInput(DecartBaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(
...,
min_length=1,
max_length=1000,
)
start: FileInput
end: FileInput
seed: Optional[int] = None
Expand All @@ -70,14 +82,22 @@ class ImageToMotionVideoInput(DecartBaseModel):


class TextToImageInput(BaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(
...,
min_length=1,
max_length=1000,
)
seed: Optional[int] = None
resolution: Optional[str] = None
orientation: Optional[str] = None


class ImageToImageInput(DecartBaseModel):
prompt: str = Field(..., min_length=1)
prompt: str = Field(
...,
min_length=1,
max_length=1000,
)
data: FileInput
seed: Optional[int] = None
resolution: Optional[str] = None
Expand Down
16 changes: 16 additions & 0 deletions tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,22 @@ async def test_process_video_to_video() -> None:
assert result == b"fake video data"


@pytest.mark.asyncio
async def test_process_max_prompt_length() -> None:
client = DecartClient(api_key="test-key")
prompt = "a" * 1001
with pytest.raises(DecartSDKError) as exception:
await client.process(
{
"model": models.image("lucy-pro-t2i"),
"prompt": prompt,
}
)
assert "Invalid inputs for lucy-pro-t2i: 1 validation error for TextToImageInput" in str(
exception
)


@pytest.mark.asyncio
async def test_process_image_to_motion_video() -> None:
client = DecartClient(api_key="test-key")
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading