Where your problem is seen
I take this to be understood that you are employing the Assistants API platform. Additionally, from the screenshot details, you are interacting with the platform site’s “Playground”, to have pay-per-use interactions with one of the Assistants you created.
I will add that Playground is not a substitute for learning how to code requests to the API, it is just a demonstrator. To rectify this particular thread’s issue, API-calling code will be required.
(The screenshot of OpenAI’s (Intercom, 3rd party) help chatbot is a bit distracting from your own screenshot and problem)
Creating a thread and messages
Playground
At the point where you are sending a new conversation and initial message to an assistant, a new thread is automatically created by the UI with that message placed in it.
API
In API, this thread could be created “empty”, or the thread could be created with initial messages.
Understanding images
The construction of a new message on AI models with multimodality allows you to place “text” content, or image attachments (in any sequence within one message).
Images can be used in two ways in user messages: either with files you upload (by file ID), or by web site URL (which the API will download).
Playground
You have provided an image by “pasting” it into the input box, and the form has a handler for this, which is an uploader.
The pasting or attaching method immediately results in the file being uploaded to your API account’s storage, with the files API endpoint.
The immediate presence of that file uploaded from pasting, without any thread having been created or run, nor connection to the thread or its assistant, can be seen when visiting your file storage on the website or by using the files endpoint.
Actually submitting the run to get a response places the file ID reference in the thread’s message.
NOTE: If you use a malfunctioning model or the playground forgets the file ID before submit, the forum presentation is ruined:
So a new file ID, gpt-4o, and a quick send shows the use of the new file ID, using the API :
API
You separately upload that file to storage, and then add its ID to the message of the user:
REQUIREMENT: Continued presence of the file in storage to continue to interact with the thread and past messages with file images
What happens if I delete the file that is within storage, and then try to continue to interact with the thread?
The result is predicable:
threads.runs.list
will return the error instead of having a response:
last_error=LastError(code='invalid_image', message='Invalid image.'), max_completion_tokens=None
or what you see after revisiting the UI:
“Deleting the image” in the case of receiving one error only made the thread problem worse.
Solution:
Delete message
Deletes one message from a thread by message_id
Example request:
from openai import OpenAI
client = OpenAI()
deleted_message = client.beta.threads.messages.delete(
message_id="msg_abc12",
thread_id="thread_abc123",
)
print(deleted_message)
Response:
{
"id": "msg_abc123",
"object": "thread.message.deleted",
"deleted": true
}
Easily-accessible methods?
Issue: The playground doesn’t offer the ability to delete a message.
Issue: Assistants applications may have the ability, but they generally can’t be provided a thread ID, instead, using their own database of user threads.
For the person less familiar with making API calls, an application for this single purpose is needed.