-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Google Vertex API support #950
Conversation
Google Application credentials can be set via GOOGLE_APPLICATION_CREDENTIALS = clientid.json
Fixed minor issues
Hi! Thanks for the contribution, I'll take a look soon 😄 |
No problem - you guys are doing a fantastic job. Let me know if this requires any improvements. |
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.
First of all thanks for the PR! It looks great 🤗
Two small things I noticed:
- Could you run
npm run format
so the linter checks pass? 😁 - Can you install
@google-cloud/vertexai
as an optional dependency like for the other endpoints?
And I was wondering, would it be bad practice to put the content of the JSON credentials into an env variable secret rather than specifying the file path and reading the file? Trying to read the file could cause quite some headaches with different infra & docker setups I imagine, but not sure if it's safe to just pass the JSON content directly.
Yea, of course. I just pushed both.
I agree and I am not a fan either. But I checked against the google docs and it was my impression that the json file was the standard way of doing it with google. Personally I would have preferred an apiToken (which funnily enough you can generate, but isn't supported by the node api of theirs): googleapis/nodejs-vertexai#197 This is the doc in question:
I should mention: there are still a few things untested from my part - though connecting to Gemini-Pro works, I couldn't test it with any other model, nor could I set up a custom endpoint, as I was lacking an account with the proper privileges and or available resources. So i did the apiUrl implementation blindly. It could also use a more thorough test of the parameters. In principle it should work, but I only tested it as far as it was required from our end. |
Awesome, +1 to check if merge is approved |
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.
Thanks for the explanation! 😄 I think we can merge this now, looks good to me
lol you got double approved apparently 😆 thanks for the contribution! |
Haha, I'll start using that in my resume from now on My contributions were "double approved" |
* Added Google Vertex API support Google Application credentials can be set via GOOGLE_APPLICATION_CREDENTIALS = clientid.json * Updated the readme file * Updated the package-lock file * Updated the package-lock file Fixed minor issues * Moved "@google-cloud/vertexai" to optional dependencies * Updated for lint checker
This commit adds support for the google cloud vertex API. It relies on https://github.com/googleapis/nodejs-vertexai to connect.
To enable:
so you can access the API from your local workstation.
The service account credentials file can be imported as an environmental variable:
Make sure docker has access to the file. Afterwards Google Vertex endpoints can be configured as following:
Tested locally, but I had to merge it over to a new branch, to make the reviewing process easier - so please evaluate. Setting up the google permissions can be a bit tricky and model availability can differ for location & your own access level. So beware of this if a connection fails.