How can I analyze an image for availability if it is in open ai storage for the purpose of vision?
I’m trying to do this in java using the com library.theokanning.openai
The only endpoint that can perform vision analysis on files uploaded to OpenAI storage, needing purpose:vision set on them, is assistants. A user file attachment within the message contents can be an image ID.
Chat completions, on the other hand, furnishes either base64 upload when sending a user message as a block of content, or you can specify an internet URL to be retrieved for image.
You can see if the tedious use of assistants, more for maintaining a conversation server-side than for specific vision features, would meet your need, or you can rethink why you need the additional step of uploading and waiting on a file ID to be returned when you could have already sent the image in an API language request to chat completions.
Right now it works like this that I first upload the image to the open ai storage, and then I need to analyze it at the user’s request.
Will this solution from other similar topics help?
thread_message = client.beta.threads.messages.create(
"thread_abc123",
role="user",
content=[
{
"type": "text",
"text": "Here's an image example using an uploaded file."
},
{
"type": "image file",
"file_id": "file_abc123",
"detail": "auto" # optional, can be 'low', 'high', or 'auto'
}
]
)
Yes, that is how, in Assistants, that you add a message to a thread that provides images for any vision analysis task the user may request.
Also a reminder that as long as you want that thread to still work, you must keep the image file in storage.