From 6bd4aaf30721f1340b8e31b70996f0af6b9cb8ad Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Tue, 9 Jun 2026 14:50:24 +0530 Subject: [PATCH 1/3] Added dict coercion for refImages in imageInference --- runware/types.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runware/types.py b/runware/types.py index f2cb329..54d1f5b 100644 --- a/runware/types.py +++ b/runware/types.py @@ -1319,7 +1319,7 @@ def serialize(self) -> Dict[str, Any]: @dataclass class IInputs(SerializableMixin): references: Optional[List[Union[str, File]]] = None - referenceImages: Optional[List[Union[str, File, IInputReference]]] = None + referenceImages: Optional[List[Union[str, File, IInputReference, Dict[str, Any]]]] = None fonts: Optional[List[Union[IInputFont, Dict[str, Any]]]] = None image: Optional[Union[str, File]] = None images: Optional[List[Union[str, File]]] = None @@ -1339,6 +1339,11 @@ def __post_init__(self): ) if self.referenceImages is None: self.referenceImages = self.references + if self.referenceImages is not None: + self.referenceImages = [ + IInputReference(**item) if isinstance(item, dict) else item + for item in self.referenceImages + ] if self.fonts is not None: self.fonts = [ IInputFont(**item) if isinstance(item, dict) else item From 0daa98f1547fba35f3f52c2cbe51fa338308a55f Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Tue, 9 Jun 2026 17:50:15 +0530 Subject: [PATCH 2/3] Fixed dict coercion with refType --- runware/types.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/runware/types.py b/runware/types.py index 54d1f5b..85b4411 100644 --- a/runware/types.py +++ b/runware/types.py @@ -1340,10 +1340,17 @@ def __post_init__(self): if self.referenceImages is None: self.referenceImages = self.references if self.referenceImages is not None: - self.referenceImages = [ - IInputReference(**item) if isinstance(item, dict) else item - for item in self.referenceImages - ] + coerced_reference_images: List[Union[str, File, IInputReference]] = [] + for item in self.referenceImages: + if isinstance(item, dict): + d = dict(item) + if "type" in d and "refType" not in d: + d["refType"] = d["type"] + d.pop("type", None) + coerced_reference_images.append(IInputReference(**d)) + else: + coerced_reference_images.append(item) + self.referenceImages = coerced_reference_images if self.fonts is not None: self.fonts = [ IInputFont(**item) if isinstance(item, dict) else item From 0cc429ce0a698267c9052d54de9c772ec71881b0 Mon Sep 17 00:00:00 2001 From: Sirshendu Ganguly Date: Tue, 9 Jun 2026 17:57:57 +0530 Subject: [PATCH 3/3] Removed redundant type --- runware/types.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runware/types.py b/runware/types.py index 85b4411..b67cb25 100644 --- a/runware/types.py +++ b/runware/types.py @@ -1344,8 +1344,9 @@ def __post_init__(self): for item in self.referenceImages: if isinstance(item, dict): d = dict(item) - if "type" in d and "refType" not in d: - d["refType"] = d["type"] + if "type" in d: + if "refType" not in d: + d["refType"] = d["type"] d.pop("type", None) coerced_reference_images.append(IInputReference(**d)) else: