Open
Description
Describe the bug
When trying to use the gpt-image-1 model with the imageEdit feature to edit a local png, I always get the error:
missing_file_mimetype
. I tried streaming, fetching as http and passing the body, but I always get the same error.
To Reproduce
file, _ := os.Open("./example.png")
defer file.Close()
resp, err = openai.NewClient(key).CreateEditImage(
context.Background(),
openai.ImageEditRequest{
Image: file,
Model: openai.CreateImageModelGptImage1,
Prompt: prompt,
Quality: openai.CreateImageQualityLow,
N: 1,
Size: openai.CreateImageSize1024x1024,
ResponseFormat: openai.CreateImageOutputFormatPNG,
},
)
Expected behavior
I expect an image to be created based on the provided example image.
Screenshots/Logs
Error code: missing_file_mimetype
Error message: Invalid file 'image': failed to determine mimetype. Ensure you are providing the file's mimetype as part of the 'Content-Type' header.
Environment:
- go-openai version: 1.40.1
- Go version: 1.22.4
- OpenAI API version: v1
- OS: Mac Sequoia