Skip to content

feat: allow inputs as dict for image/video/3d/audio inference and image upscale and Settings and Safety parameter too#246

Open
Sirsho1997 wants to merge 2 commits intomainfrom
feat/inputs-as-dict
Open

feat: allow inputs as dict for image/video/3d/audio inference and image upscale and Settings and Safety parameter too#246
Sirsho1997 wants to merge 2 commits intomainfrom
feat/inputs-as-dict

Conversation

@Sirsho1997
Copy link
Collaborator

@Sirsho1997 Sirsho1997 commented Feb 24, 2026

Created based on PR of forked repo here

Fixes #244

Usage

task_uuid = str(uuid.uuid4())
deliveryMethod = "sync"

request_params = {
    "model": "....,
    "taskUUID": task_uuid,
    "positivePrompt": "..... ",
    "width": 1024,
    "height": 1024,
    "seed": 8,
    "numberResults": 1,
    "deliveryMethod": deliveryMethod,
    "inputs": {
        "referenceImages": [
            ".....",
            ".....",
        ],
    },
}

request_image = IImageInference(**request_params)

Added

  • Added post_init to IImageInference, IImageCaption, IImageUpscale, IVideoInference, I3dInference, IAudioInference, IVideoBackgroundRemoval

@Sirsho1997 Sirsho1997 changed the title feat: allow inputs as dict for image/video/3d/audio inference and ima… feat: allow inputs as dict for image/video/3d/audio inference and image upscale Feb 24, 2026
@Sirsho1997 Sirsho1997 changed the title feat: allow inputs as dict for image/video/3d/audio inference and image upscale feat: allow inputs as dict for image/video/3d/audio inference and image upscale and Settings and Safety parameter too Feb 25, 2026
@Sirsho1997 Sirsho1997 requested a review from Copilot February 25, 2026 01:55
Copy link
Contributor

Copilot AI left a comment

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 SDK request payload types to accept dict values for nested request sections (notably inputs, settings, and safety) and coerces them into their corresponding dataclass/SerializableMixin types in __post_init__. This aligns the SDK with common “build params as dict” usage patterns and prevents runtime AttributeError during request serialization.

Changes:

  • Allow inputs/settings/safety fields to be passed as dict on several inference/upscale payloads via Union[..., Dict[str, Any]].
  • Add __post_init__ coercion for these fields to instantiate IInputs, ISettings, ISafety, etc.
  • Extend the same coercion approach to background removal payload settings.

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

@Sirsho1997 Sirsho1997 requested a review from teith February 25, 2026 19:47
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.

Flux inference fails: AttributeError: 'dict' object has no attribute 'to_request_dict'

2 participants