langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Gemini Pro Issues

Open raulchedrese opened this issue 1 year ago • 4 comments

It looks like the current implementation of ChatGoogleAI doesn't work with the latest version of the Google Gemini API defined here.

This was enough to get it working for my immediate needs but there may be other issues.

So far the main differences I've come across are:

  • The Gemini API doesn't require a version in the URI path.
  • Response messages no longer contain an index field.
  • The API will not accept messages with an empty text field.

Not sure you'd want a new module for the newest Gemini API or to modify the existing ChatGoogleAI. Either way I'd be happy to put together a PR if it would help.

raulchedrese avatar Mar 23 '24 21:03 raulchedrese

@jadengis, are you seeing this too? Are you able to weigh in?

brainlid avatar Mar 23 '24 23:03 brainlid

@brainlid So the current implementation of the Google AI is designed to work with the Google AI Studio APIs documented here: https://ai.google.dev/tutorials/rest_quickstart.

This still works I've been using it regularly for the past few months. The documentation you linked @raulchedrese is pointing to the documentation for using Gemini with Google Cloud Vertex AI, which looks slightly different. I haven't tried using Vertex AI so I'm not sure what the difference is.

From the looks of it, we'd either need a different chat model implementation or the existing ChatGoogleAI module would need to be updated to handle both the Google AI Studio and Google Cloud Vertex AI sets of paths since both APIs actively supported at the moment. The change above as written will break existing use cases.

jadengis avatar Mar 24 '24 00:03 jadengis

Thanks @jadengis! I appreciate your perspective and expertise here.

brainlid avatar Mar 24 '24 13:03 brainlid

@jadengis thanks for clarifying! It seems like supporting both in the same module would get pretty messy. @brainlid what are your thoughts on having a separate module? Something like VertexAI?

raulchedrese avatar Mar 24 '24 18:03 raulchedrese