Fix: Nested AnyUrl in request model cannot be serialized (Kling, Runway) (#129)

This commit is contained in:
Christian Byrne 2025-05-04 21:04:21 -07:00 committed by GitHub
parent 7ead535d46
commit 337e707103
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -684,7 +684,7 @@ class KlingLipSyncInputObject(BaseModel):
None,
description='The ID of the video generated by Kling AI. Only supports 5-second and 10-second videos generated within the last 30 days.',
)
video_url: Optional[AnyUrl] = Field(
video_url: Optional[str] = Field(
None,
description='Get link for uploaded video. Video files support .mp4/.mov, file size does not exceed 100MB, video length between 2-10s.',
)
@ -709,7 +709,7 @@ class KlingLipSyncInputObject(BaseModel):
None,
description='Local Path of Audio File. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB. Base64 code.',
)
audio_url: Optional[AnyUrl] = Field(
audio_url: Optional[str] = Field(
None,
description='Audio File Download URL. Supported formats: .mp3/.wav/.m4a/.aac, maximum file size of 5MB.',
)
@ -1933,7 +1933,7 @@ class Position(str, Enum):
class RunwayPromptImageDetailedObject(BaseModel):
uri: AnyUrl = Field(
uri: str = Field(
..., description='A HTTPS URL or data URI containing an encoded image.'
)
position: Position = Field(
@ -1959,9 +1959,9 @@ class RunwayAspectRatioEnum(str, Enum):
class RunwayPromptImageObject(
RootModel[Union[AnyUrl, List[RunwayPromptImageDetailedObject]]]
RootModel[Union[str, List[RunwayPromptImageDetailedObject]]]
):
root: Union[AnyUrl, List[RunwayPromptImageDetailedObject]] = Field(
root: Union[str, List[RunwayPromptImageDetailedObject]] = Field(
...,
description='Image(s) to use for the video generation. Can be a single URI or an array of image objects with positions.',
)
@ -3211,7 +3211,7 @@ class KlingImage2VideoRequest(BaseModel):
default_factory=lambda: KlingVideoGenCfgScale.model_validate(0.5)
)
mode: Optional[KlingVideoGenMode] = 'std'
static_mask: Optional[AnyUrl] = Field(
static_mask: Optional[str] = Field(
None,
description='Static Brush Application Area (Mask image created by users using the motion brush). The aspect ratio must match the input image.',
)