generative-ai-js
generative-ai-js copied to clipboard
File URL option for the GenAI File API
At the moment a file path has to be utilised: mimeType: mime.lookup(filePath),
. However it would be helpful if a file URL could also be used instead of a local file path: mimeType: mime.lookup(rawfileURL),
So the use of mime.lookup
here was a little confusing as it refers to another library I wasn't familiar with.
I think what you're trying to request is that our method GoogleAIFileManager.uploadFile(filePath, fileMetadata)
should also accept a fileURL as the first argument, is that correct? That seems like a reasonable feature request.
That is correct, sorry about saying mime.lookup
, what you mentioned about using the GoogleAIFileManager.uploadFile
method with a fileURL is what I meant to say. 😅
Hey @TecEash1 just to clarify, by file URL
do you mean a url that starts with the file://
protocol?
sorry, thats not what I initially meant. I meant a raw file starting with the https
/http
protocol. Such as:
https://www.google.com/images/branding/googlelogo/2x/googlelogo_light_color_272x92dp.png
+1. We, at Zapier, would love the ability to pass in a file via the https/http protocol. Especially with the new ability to upload Videos. If we could just pass a URL to a video instead of having to download it ourselves, just to re-package it up and upload it to you, if we could just pass along the same URL that we have access too, that would be amazing.
+1 to be able to send image/video urls instead of fetching them to resend them to you would be brilliant!
+1 here as well—thank you!
Unfortunately this would be beyond a simple SDK fix and would require a change to the Gemini API.
If we provided this functionality in the SDK, we'd be doing the same thing as you would - downloading the image and uploading it somewhere, but doing it invisibly, under the hood, which I don't think provides that much value and introduces more room for error.
I will pass along to the Gemini team that users are interested in this feature, or you may get more visibility posting in the Gemini API discussion forum: https://discuss.ai.google.dev/
Also, can everyone use the "thumbs up" emote on the first post to indicate "+1" on interest? It will be a handy way for us to see the total interest in this feature request and avoid making this issue thread too long.