#Invalid Image API Response

1 messages · Page 1 of 1 (latest)

rough skiff
#

I created a Discord bot that uses a custom assistant and vision.
When I first released the update, I know for a fact that I and 1 other user tested it, and currently neither of us can interact with the bot.

The response is failed, but I do have a theory, since I know me and this user both tested the bot with the vision update, and neither of us can interact with the bot, my theory is that the thread contains an image URL that is no longer valid.

I logged let retrieve = await openai.beta.threads.runs.retrieve(thread.id, createRun.id); to see what the response was actually saying, and it was: https://paste.valhalladev.org/cekiqemure.yaml

So you can see the last error was invalid_image, but the thing is, the query does not include an image.

The bot strictly only accepts Discord attachments, and I include checking to ensure the file IS an image file. This means that all images uploaded to vision, is hosted on Discord CDN... Which means if those links expire, they still exist in the thread, but the bot can not access it, hence the error.

I know a temporary fix is to simply create a new thread (which I did and can confirm the error no longer occured)

This is not a good fix, what are my options here?
Bonus, if there is a method to maybe retreive the thread and see which file is invalid?

rough skiff
#

Confirmed this. I logged the thread history, the first image link I see, leads to "This content is no longer available."

not sure the best way to proceed on this tbh

#
Content 1: {
  "type": "image_url",
  "image_url": {
    "url": "https://cdn.discordapp.com/attachments/1109969182377918557/1281981766663667815/Screenshot_2024-09-07_at_15.17.48.png",
    "detail": "auto"
  }

An example of what is in the thread, this image url is no longer valid (This content is no longer available.)

rough skiff
#

Added a method the delete the users thread as an admin as a temporary fix

I am guessing the permanent fix would be base64 but to my knowledge, it is not possible to include base64 within an assistant atm

rough skiff
#

#

Is this by design? It seems like something should exist to prevent this or circumvent it because:

  • I can’t add a none valid image url to a thread because it will throw an error
  • I CAN add a valid image to a thread, delete the image from the image host and the thread is instantly and permanently broken
#

obviously it could be fixed by editing the thread to remove the message from the thread, but this still feels like a messy fix

shy lantern
rough skiff
#

It is included, I edited it from that so it was easier to read here

shy lantern
#

okay, so yeah I think you should either send base64 images, or track deleted/expired images and remove them from the messages sent to API. you can't skip errors and I don't believe there will be a way in the future to do that.