Skip to content

Added dict coercion for refImages in imageInference#310

Open
Sirsho1997 wants to merge 3 commits into
mainfrom
feature-dict-coercion-refImages
Open

Added dict coercion for refImages in imageInference#310
Sirsho1997 wants to merge 3 commits into
mainfrom
feature-dict-coercion-refImages

Conversation

@Sirsho1997

Copy link
Copy Markdown
Collaborator

Changed

  • IInputs.referenceImages now accepts Dict[str, Any] entries and coerces them to IInputReference in IInputs.__post_init__

@coderabbitai

coderabbitai Bot commented Jun 9, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. To trigger a review, include review in the PR description. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0ac1b4c4-f291-4d48-af3a-5df79a58cc19

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code
  • Commit simplified code in branch feature-dict-coercion-refImages

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the IInputs dataclass in runware/types.py to allow inputs.referenceImages to be provided as plain dictionaries (in addition to str, File, and IInputReference) and coerces those dict entries into IInputReference instances during __post_init__. This aligns IInputs with existing patterns in the codebase where dict payloads are normalized into dataclass instances for downstream processing (e.g., media normalization).

Changes:

  • Expanded the IInputs.referenceImages type to accept Dict[str, Any].
  • Added __post_init__ coercion that converts dict entries in referenceImages into IInputReference.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread runware/types.py Outdated
Comment thread runware/types.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.

Comment thread runware/types.py
Comment thread runware/types.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.

Comment thread runware/types.py
Comment on lines +1342 to +1354
if self.referenceImages is not None:
coerced_reference_images: List[Union[str, File, IInputReference]] = []
for item in self.referenceImages:
if isinstance(item, dict):
d = dict(item)
if "type" in d:
if "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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants