babakcode / flutter_gemini

Flutter Google Gemini SDK
https://pub.dev/packages/flutter_gemini
BSD 3-Clause "New" or "Revised" License
166 stars 53 forks source link

Remove the depricated gemini 1.0 vision model for image and text generation #33

Open AdvaitKale01 opened 1 month ago

AdvaitKale01 commented 1 month ago

Error details- Error sending text and image: GeminiException => This exception was thrown because the response has a status code of 404 and RequestOptions.validateStatus was configured to throw for this status code.

The status code of 404 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"

Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status

In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.

Status Code: -1

vincentkims49 commented 1 month ago

@AdvaitKale01 Did you find a solution for this?

AdvaitKale01 commented 1 month ago

@AdvaitKale01 Did you find a solution for this?

Sadly no. I am trying to troubleshoot by my side as well. @babakcode this seems to be a critical issue with text with images section.

vincentkims49 commented 1 month ago

@AdvaitKale01 Did you find a solution for this?

Sadly no. I am trying to troubleshoot by my side as well. @babakcode this seems to be a critical issue with text with images section.

kindly tag me when you find one. @AdvaitKale01

toandk commented 1 month ago

i got the same issue, still stuck here :(

AdvaitKale01 commented 1 month ago

@vincentkims49 So it turns out the package needs to be updated as the gemini 1.0 pro model is marked depricated by Google

image

And hence its API request has been removed.

Available models

Models List by Google

Solution

Simple solution is to add a parameter to include the newer model of your choice.

await gemini.textAndImage(
            modelName: "models/gemini-1.5-flash",
            ....
jasonofua commented 1 month ago

Like @AdvaitKale01 said it is to fork the library and change to modelName: "models/gemini-1.5-flash",, i was stuck on it for long until i finally changed it

jasonofua commented 1 month ago

@babakcode PR for this fix https://github.com/babakcode/flutter_gemini/pull/35

ChunhThanhDe commented 1 month ago

Hi everyone, @jasonofua @AdvaitKale01 👋,

I also have the same problem with the error when using image and text generation 🖼️📝.

After debugging and finding the cause, I have the same opinion about needing to replace "gemini-pro-vision" with "gemini-1.5-flash" 🔄.

Regarding patch #35, I applied it and it works very well 👍.

I leave this comment to summarize and confirm for all other developers experiencing the same error and to provide the solution here 🔍💡.

Thanks, everyone 🙏.