Skip to content

images.edit not working when submitting image files (mime type and other issues) #147

Closed
@wdewind

Description

@wdewind

Hi,

I've been trying to use the images.edit api and having issues. When I submit a single file like this:

    response = openai.images.edit(
        prompt: prompt,
        model: MODEL,
        size: "1024x1024",
        image: open("test_image.jpeg"),
      )

I get the error:

Invalid file 'image': unsupported mimetype ('application/octet-stream'). Supported file formats are 'image/jpeg', 'image/png', and 'image/webp',

If I wrap it in an array:

response = openai.images.edit(
        prompt: prompt,
        model: MODEL,
        size: "1024x1024",
        image: [open("test_image.jpeg")],
      )

I get

Invalid type for 'image': expected one of an array of files or file, but got a string instead.

What am I doing incorrectly here?

I've searched around and it seems others are having similar issues with different libraries, so this may be an open ai api issue not a ruby library issue. Ex: openai/openai-python#2341

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