Cannot delete created files

I can neither delete these files via the web interface ( OpenAI Platform) or the API with

client.files.delete(file.id)

In both cases I get a response that the file with the id does not exist.

Welcome to the community @rahkilsdonk!

In order to delete a file, it has to exist on the API.

I’d recommend calling List Files then choosing a the file_id from there to delete.

Thank you for the welcome.

The files to exist on the api. If I list the files and delete with the id it returns, the api returns that the file id does not exist. I should note that the files are created with the ‘assistants’ purpose.

Thanks for the info.

According to my understanding, files uploaded with the purpose assistants cannot be deleted as long as the assistant associated with them is deployed because the files are being used for retrieval and code-interpreter.

+1 to this issue.

Specifically, I run this:

curl https://api.openai.com/v1/files \
  -H "Authorization: Bearer MY-OPENAI-KEY"

and I get this:

{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "object": "file",
      "id": "file-THLcwZXdlYLVvq6nwD6HhXmu",
      "purpose": "assistants",
      "filename": "entropy.pdf",
      "bytes": 366296,
      "created_at": 1699364941,
      "status": "processed",
      "status_details": null
    },
    {
      "object": "file",
      "id": "file-C1a2U8UInTAJx2mmKOrm7xk4",
      "purpose": "assistants",
      "filename": "entropy.pdf",
      "bytes": 366296,
      "created_at": 1699364512,
      "status": "processed",
      "status_details": null
    },
    {
      "object": "file",
      "id": "file-PcdTaTSIMSnT1VUfmEDozvSL",
      "purpose": "assistants",
      "filename": "shannon1948.dvi - entropy.pdf",
      "bytes": 4198616,
      "created_at": 1699359143,
      "status": "processed",
      "status_details": null
    }
  ]
}

Then I do this:

curl https://api.openai.com/v1/files/file-THLcwZXdlYLVvq6nwD6HhXmu \
  -X DELETE \
  -H "Authorization: Bearer MY-OPENAI-KEY"

and I get this:

{
  "error": {
    "message": "No such File object: file-THLcwZXdlYLVvq6nwD6HhXmu",
    "type": "invalid_request_error",
    "param": "id",
    "code": null
  }
}

The same happens for all of the other files.
I also have no assistants, for the record. I do this:

curl "https://api.openai.com/v1/assistants?order=desc&limit=20" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer MY-OPENAI-KEY" \
  -H "OpenAI-Beta: assistants=v1"

and I get this:

{
  "object": "list",
  "data": [],
  "first_id": null,
  "last_id": null,
  "has_more": false
}

So the upshot of all of this is that I don’t believe this is a misunderstanding about how the API works. I think this is actually an honest-to-god bug.

I should also add additional context that the main reason that I have no assistants is that I went to create an RAG assistant with each of those files and when I hit Save, it simply spun for 2 or 3 minutes (however long the timeout is set to) before spitting out a network error. I think it’s the same or similar error as the “new-assistants-api-bug-when-uploading-files” thread. The whole “RAG-as-a-service” idea seems really cool and useful but it seems like the Files API is in a fairly broken state at the moment.