Skip to content

Editing multiple images is brokenΒ #201

@dylanplayer

Description

@dylanplayer

When using client.images.edit(image:) if you pass multiple files for the image: keyword argument you get a 400 error from the OpenAI API that says you must provide image in the request. The issue is that the multipart form formatting for arrays does not match the format that the OpenAI API expects.

Code to reproduce

client = OpenAI::Client.new


file_1 = OpenAI::FilePart.new(File.read("file1.png"), content_type: "image/png", filename: "file1.png")
file_2 = OpenAI::FilePart.new(File.read("file2.png"), content_type: "image/png", filename: "file2.png")

client.images.edit({ prompt: "do something", image: [file_1, file_2] })

How to fix

There is a naive fix in this commit 851-labs@9bba734.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions