-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Add vertex ai support #846
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
Conversation
Fantastic addition @averath! Could we possibly get some more details describing the changes, how it was implemented, whether it will impact any existing functionality or connections? Screenshots would be great too. Thanks for the PR! 🙏 |
Figured it out. We should probably make sure we have instructions for getting an auth token from Google Cloud:
|
I noticed also that this new module does not check a |
Yes especially with the Google naming switches haha |
Thank you guys for your feedback! I'm happy to see it
I was thinking about it, however it's not that easy like it should be. They indeed expose API to receive models, but only models created by you. In this list there's no Gemini, because it's created by Google. Reference: https://cloud.google.com/vertex-ai/docs/reference/rest/v1/projects.locations.models/list . We can add instructions how to obtain key. What I was thinking is to let user choose whether the external connection for OpenAI and the external connection for VertexAI shall be enabled or not, because I'm using just the second one and see errors related to OpenAI. |
Hmm I've perhaps not setup my API credentials correctly, but if I use the method I posted above, the key only last for so long before it expires: And indeed, running the |
Setting up a service account should do the thing, because personal tokens last a couple of minutes/hours depends on settings |
That's fair enough, if there's no straight-forward way to get their public models then I guess hard-code is the only other option. Any way it can be hidden unless the Vertex API connection is actually setup? Right now whether you use it or not you end up with Gemini Pro in your models list. |
I'm working on it to enable/disable other providers as well, so you could configure whether you want to use Ollama, OpenAI, VertexAI |
@averath I've been butting my head against a wall for an hour now trying to sort out the API key... unless you've got access to MakerSuite there is no straightforward way to get a permanent key, Google really wants you to do things the OAuth2 way. I think this feature is going to be a lot easier to use if authentication is refactored so that it will exchange OAuth2 credentials for short-lived access tokens and then handle refresh automatically afterwards. |
Oh really? So service account won't work? Do you think we can leave it like it is as a first stage and align it later? We could mark it as experimental feature. |
@averath based on the various documention I've reviewed, you'll need to refactor this by incorporating Google Cloud modules. This is to utilize a credentials JSON file linked to a service account, which is necessary for generating the access and refresh tokens required by the API. I have a project that implements this for accessing a GCS bucket but it works similarly for other Google APIs, including VertexAI. Here's how I've done it before: utils/gcs.py Here are a few methods for managing the JSON credentials file downloaded from the console:
However, it's important to note that these methods may not be highly secure. Mishandling Google Cloud Platform credentials can lead to significant security risks. Instead of relying on an Endpoint URL, we could streamline the process by accepting two specific parameters: |
refac: styling
refac: styling
Signed-off-by: Steven Kreitzer <[email protected]>
fix: continue generation
fix: default model load issue
fix: add semver to container builds
# Conflicts: # src/lib/components/chat/Settings/Connections.svelte # src/lib/components/chat/SettingsModal.svelte # src/routes/(app)/+layout.svelte # src/routes/(app)/+page.svelte
It's great to see you're still engaged with this project, @averath. Since your pull request was initiated, there have been significant updates to the codebase. I recommend reviewing the Ollama modules that inspired your enhancements for VertexAI to ensure consistency with current coding standards and conventions. Additionally, integrating support for both MakerSuite API key and GCP OAuth2 authentication could enhance functionality. Incorporating the google-generativeai package would facilitate the use of the MakerSuite API key. Implementing a switch to select between these authentication methods is essential, given the differences in endpoints and authentication mechanisms. |
Thanks for the PR! I believe Vertex AI support is a nice addition but providing options to enable/disable providers seem irrelevant to this PR and it makes it hard for us to review the code. I'll close this PR for now but feel free to create new atomic level PRs, Thanks! |
Added
Vertex AI support (similar to OpenAI)
Enable/Disable provider option