Context:
This is for the OpenAIKit project written in Swift, and I'm trying to implement the function to send in image edits; which requires to send the images as a Data object. So when making the field data to confirm to the file, I end up getting this error:
{
"error": {
"code": null,
"message": "The server had an error processing your request. Sorry about that! You can retry your request, or contact us through our help center at help.openai.com if you keep seeing this error. (Please include the request ID 2ef432d2a77b5e94a2d6d61c15f1d0ed in your email.)",
"param": null,
"type": "server_error"
}
}
Here is the function in question:
private func dataFormField(
named name: String,
data: Data,
mimeType: String) -> Data
{
let fieldData = NSMutableData()
fieldData.append("--\(boundary)\r\n")
fieldData.append("Content-Disposition: form-data; name=\"\(name)\"; filename=\"\(name).png\"\r\n")
fieldData.append("Content-Type: \(mimeType)\r\n")
fieldData.append("\r\n")
fieldData.append(data)
fieldData.append("\r\n")
return fieldData as Data
}
Please let me know if you guys need any other information.