Thanks for posting your question in the Microsoft Q&A forum.
I'd use the getImageFile() method of MessageImageFileDetails
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello,
I've been working with Azure Assistant OpenAI and successfully retrieved the fileId
for image files using the listMessages
method. However, I'm now trying to figure out how to download the image file using this fileId
in JavaScript.
I followed the example provided in the documentation and the SDK reference. While I can obtain the fileId
for images, I'm encountering an issue when trying to download the actual image file. It seems that I can’t download the file directly using the fileId
; instead, I need a file link.
Could someone guide me on how to obtain this file link or the correct method to download an image file using the fileId
in JavaScript? Any guidance or code examples would be greatly appreciated.
Thank you in advance!
const runMessages = await assistantsClient.listMessages(assistantThread.id);
for (const runMessageDatum of runMessages.data) {
for (const item of runMessageDatum.content) {
if (item.type === "text") {
console.log(item.text.value);
} else if (item.type === "image_file") {
console.log(item.imageFile.fileId);
}
}
}
Thanks for posting your question in the Microsoft Q&A forum.
I'd use the getImageFile() method of MessageImageFileDetails
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **
I successfully downloaded the file using the solution provided in this GitHub issue.
I successfully downloaded the file. https://github.com/Azure/azure-sdk-for-js/issues/30968