openai-openapi icon indicating copy to clipboard operation
openai-openapi copied to clipboard

CreateFileRequest does not include "vision" purpose

Open phronmophobic opened this issue 1 year ago • 3 comments

Use "assistants" for Assistants and Message files, "vision" for Assistants image file inputs,

The purpose documentation says "vision" is a valid purpose, but the spec does not include it: https://github.com/openai/openai-openapi/blob/893ba52242dbd5387a97b96444ee1c742cfce9bd/openapi.yaml#L8603

phronmophobic avatar May 19 '24 19:05 phronmophobic

https://platform.openai.com/docs/api-reference/files/create

documentation clearly states

"vision" for Assistants image file inputs

https://platform.openai.com/docs/api-reference/files/object#files/object-purpose

documentation also states vision is an appropriate use for the 'purpose' enum.

i'm under the assumption that my code (snippet below) should be working when using the vision purpose

const isImage = file.name.match(/\.(jpeg|jpg|webp|png)$/i);
const filePurpose = isImage ? 'vision' : 'assistants';
const fileData = await openai.files.create({ file: fileObject, purpose: filePurpose });

but i get this error:

Error: 400 Files with extensions [.png] are not supported for retrieval. See https://platform.openai.com/docs/assistants/tools/file-search/supported-files.

should i be using urls rather than trying to push the file buffer like i would for any other file upload purpose?

dewmguy avatar May 22 '24 05:05 dewmguy

Any update on this issue ?

redvivi avatar Nov 13 '24 20:11 redvivi

I was having the same problem. The correct way to add an image to a thread is to add a message with a content type of image_file: https://platform.openai.com/docs/assistants/deep-dive#creating-image-input-content

furrykef avatar Nov 14 '24 21:11 furrykef