flutterfire icon indicating copy to clipboard operation
flutterfire copied to clipboard

🚀 [firebase_ai] Support Files API as an alternative to InlineDataPart

Open ReplayAppTeam opened this issue 4 months ago • 0 comments

Hello,

I've experienced a very strange issue:

When I ask Gemini to extract some information from a video file it takes way too long 20 - 25 seconds for videos which are 30 seconds max and take around 1-5 mb.

I was supplying the video file as bytes using InlineDataPart as described in the docs https://firebase.google.com/docs/ai-logic/analyze-video?api=dev

It was unusual to me that it takes that long especially because the Gemini Android app gives way faster response.

Then I decided to try the REST API and what I noticed there is an alternative way of supplying files to Gemini and thats via Files API.

It is described here https://ai.google.dev/gemini-api/docs/video-understanding#rest_1

Usage of the REST API resulted in 2x faster Gemini response.

I can't tell why exactly but the only noticeable difference I see is the way video file is supplied in the library and when working with REST so my guess is that's what made it faster.

ReplayAppTeam avatar Aug 10 '25 21:08 ReplayAppTeam