Worker and Google Ai FileManager Problem
Hi everyone! I'm trying to use the File API with Gemini in a Cloudflare Worker environment, but I'm running into an issue.
According to the documentation, we can use the File API to handle files up to 2GB (instead of the 20MB limit with inline data). However, the
Is there any way to use the File API with an ArrayBuffer or a URL directly? My use case is:
According to the documentation, we can use the File API to handle files up to 2GB (instead of the 20MB limit with inline data). However, the
GoogleAIFileManager.uploadFile() method seems to only accept a file path string and uses fs.readFileSync internally, which isn't available in Cloudflare Workers.Is there any way to use the File API with an ArrayBuffer or a URL directly? My use case is:
- User uploads file to our R2 storage
- I get the file as ArrayBuffer in our Worker
- I want to send this to Gemini for analysis without the 20MB limit
fs in Workers. Any suggestions for handling larger files in serverless environments?