File upload forbidding valid files

I’m trying to upload some example code for an assistant to use to answer. I prototyped this by creating a custom GPT, and it works well. The file is a concatenation of a bunch of code in a txt file.

Both in the UI for assistants and using the command line, I cannot upload the file as I get an error that my file.txt is not valid:

{
  "error": {
    "message": "Invalid file format. Supported formats: ['c', 'cpp', 'csv', 'docx', 'html', 'java', 'json', 'md', 'pdf', 'php', 'pptx', 'py', 'rb', 'tex', 'txt', 'css', 'jpeg', 'jpg', 'js', 'gif', 'png', 'tar', 'ts', 'xlsx', 'xml', 'zip']",
    "type": "invalid_request_error",
    "param": null,
    "code": null
  }
}

I guess the problem is it’s automatically trying to work out what kind of file it is, which is very frustrating as I know what format it is.

I’ve tried specifying what type it is in the curl command

curl https://api.openai.com/v1/files -H "Authorization: Bearer $OPENAI_API_KEY" -F purpose="assistants" -F file="@/tmp/file.txt;type=text/plain"

2 Likes

It looks like the API is sending the same error message for every 400 error, even if it’s unrelated. In my case, it sent this error when I tried to upload several files in parallel.

1 Like