Unable to upload .pdf files via SDK or API

I have setup an assistant to process .pdf files and have successfully tested it up until the recently (3 days ago), when the uploading of the same files started returning 400 error Invalid file format. Supported formats: \"c\", \"cpp\", \"css\", \"csv\", \"docx\", \"gif\", \"html\", \"java\", \"jpeg\", \"jpg\", \"js\", \"json\", \"md\", \"pdf\", \"php\", \"png\", \"pptx\", \"py\", \"rb\", \"tar\", \"tex\", \"ts\", \"txt\", \"xlsx\", \"xml\", \"zip\" for any pdf sent.

I have tried uploading via the SDK with latest version (1.23.1), and previous ones (1.16.2), as well as with via latest API, the result is the same - 400 error.

I’ve also tried using the new vector_stores.batches.upload_and_poll without any luck.

I have used the recommended snippets from the documentation in all my attempts, but am at a loss:

from openai import OpenAI
client = OpenAI()

client.files.create(
  file=open("mypdf.pdf", "rb"),
  purpose="assistants"
)

and

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -F purpose="assistants" \
  -F file="@mypdf.pdf"

The only functional approach seems to be manually uploading a file in the playground and attaching it to a message.

Can you help assist me in this matter?

Thanks

2 Likes