-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed google ai default endpoint #118
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also encountered the same problem and solved it according to this modification.
Thanks @ljgago! I'm not a Google AI user so I rely on others to help support and understand the issues. Is this related to #85? If so, I think the problem is there are two separate Google APIs that use the same structure/format for their messages and communication, but connections are made differently. |
Hi @brainlid! I checked and Google has two platforms:
I think that Thanks! |
Thanks @ljgago for digging into that. What is needed to work well for both systems? Is it just a URL change? Or is there more? |
Here some comparatives:
The two are very similar with the request model and response model, the main difference is with the url and the auth method. |
@brainlid, @ljgago I had a bunch of trouble getting the existing ChatGoogleAI to work with Vertex AI. There are subtle differences in the request formats. For example Vertex seems to have stricter validation on which properties are included in the request and what their values are. I ended up writing a separate module that is working quite well for Gemini through Vertex AI. I'm happy to contribute some of that code if you think it's helpful but thus far I'm not convinced it is feasible to have a single module handle both APIs. |
Leave it to Google to create two competing and incompatible tools to do the same thing. 🙄 From what you say @raulchedrese, it sounds like two separate versions may work out best. Can we base the new one on your implementation? |
@brainlid yep. I can clean it up and open a PR if you like or feel free to grab the code yourself. Whatever is easiest. |
@raulchedrese I'd really appreciate it as a PR. Also, if you can write some tests around it that would be fantastic. |
@ljgago @raulchedrese contributed a specific VertextAI chat module to handle both the URL difference and other peculiarities between the two implementations. The PR has been merged. Would you please try it out and see if it meets your needs as well? |
Hello! I don't have Google Cloud access credentials to try VertexAI, I'm sorry. 😦 |
No worries! My mistake. I thought that what you were asking about. |
The ChatGoogleAI URL issues have been fixed in PR #152 and merged to main. |
Hello!
In the ChatGoogleAI is wrong the default endpoint.
langchain/lib/chat_models/chat_google_ai.ex
Lines 24 to 26 in 48add20
langchain/lib/chat_models/chat_google_ai.ex
Lines 32 to 36 in 48add20
Then, when the final url is geneated, the
version
is added again:langchain/lib/chat_models/chat_google_ai.ex
Lines 338 to 342 in 48add20
This PR only define
@default_endpoint
with the base url without the api version.Thanks!