Possible Bug with Agent Creation & PHP File Upload

Just tried testing out the new ages and file upload for Retrieval in the playground, it states that you can upload PHP files and ZIPs, but when uploading them I seem to get
There was an error uploading the file social_media.php: 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']

When uploading a zip with PHP files in
Failed to update assistant: UserError: Failed to index file: Unsupported file file-UgZtUlXOSERe1qW7fKjJmwvT type: application/zip

3 Likes

Currently getting this with any file type - tried txt and docx. Currently trying to run in GPT4-Turbo with Retrieval on.

Note - this was occurring when I was uploading an empty file. If I put anything in there at all it stopped happening.

Still the same for me as I try to upload PHP files. might be a bug that needs to be solved.

I have the same experience with json or php files all day. If it helps, I tried the html and txt suffix - passes.

I use PHP package - GitHub - openai-php/client: ⚡️ OpenAI PHP is a supercharged community-maintained PHP API client that allows you to interact with OpenAI API.

With roughly this setup:

$fileResponse = $this->gptClient->files()
    ->upload([
        'purpose' => 'assistants',
        'file' => fopen($filePath, 'r'),
    ]);

Same bug for me, cant upload some files even though theyre the correct extension, even tried changing the file extension, didn’t help at all

I have the same issue when I upload a .txt file, I’m still confused.

Hi, did anyone find a solution for this, I am facing the same issue with JSON files.

Found the solution, it’s related to encoding type. I created the same json using an online tool it worked.

Thanks for sharing!

Could you drop the encoding type before and after? I tried to put specific encoding type, but probably got wrong one.

Add MIME TYPE
fs.writeFileSync(filePath, ‘application/json\n’, ‘utf8’)