-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Description
Is there an existing issue for this?
- I have searched the existing issues.
Which plugins are affected?
Storage
Which platforms are affected?
Web
Description
The following code generates the above error:
import 'package:firebase_vertexai/firebase_vertexai.dart';
final _model = FirebaseVertexAI.instance.generativeModel(model: 'gemini-2.0-flash');
final content = Content.multi([
TextPart('Hva er minste lovlige oppsigelsestid i arbeidsforhold?'),
FileData('application/pdf', 'gs://tenor-y.appspot.com/arbeidsliv/arbeidsmiljoloven.pdf'),
]);
final response = await _model.generateContent([content]);
Plugin version:
firebase_vertexai: ^1.4.0
So it means that Vertex AI cannot read PDFs from Firebase Storage. There is a similar issue thread, but with other file types. If I replace the pdf with a plain txt file, everything works. So the problem is related to PDFs.
Comments are appreciated.
Reproducing the issue
import 'package:firebase_vertexai/firebase_vertexai.dart';
final _model = FirebaseVertexAI.instance.generativeModel(model: 'gemini-2.0-flash');
final content = Content.multi([
TextPart('Hva er minste lovlige oppsigelsestid i arbeidsforhold?'),
FileData('application/pdf', 'gs://tenor-y.appspot.com/arbeidsliv/arbeidsmiljoloven.pdf'),
]);
final response = await _model.generateContent([content]);
Firebase Core version
3.12.1
Flutter Version
3.6.0
Relevant Log Output
DartError: FormatException: Unhandled ContentModality format
DOCUMENT
Flutter dependencies
Expand Flutter dependencies
snippet
Replace this line with the contents of your `flutter pub deps -- --style=compact`.
Additional context and comments
No response