I have an essue with google generative ai package

Hello guy pls can someone help me when I use Google generative AI package with gemini-1.5-flash model with text only the app work normally but when I try to add an image as an entry I get this error

An internal error has occurred. Please retry or report in Tipps zur Fehlerbehebung  |  Gemini API  |  Google for Developers

error

sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 296:3 throw packages/google_generative_ai/src/api.dart 583:54 parseGenerateContentResponse

here is the code :

List parts = [TextPart(message)];

try {

if (image != null) {

parts.add(DataPart(image.extension!, image.bytes!));

}

} catch (e) {

log(e.toString());

}

var content = Content.multi(parts);

var response = myChat.sendMessageStream(content);

Welcome to the forums!
(As an aside - can you edit your message to use better formatting? As it stands now, it makes it somewhat difficult to read. You can click on the pencil at the bottom of your post to edit it. )

How large is the image you’re trying to send?

1 Like