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.
When using
client.images.edit(image:)if you pass multiple files for theimage: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
How to fix
There is a naive fix in this commit 851-labs@9bba734.