Vertex AI adapter #1617
Replies: 4 comments 6 replies
-
I think this might be merged into codecompanion as pr? |
Beta Was this translation helpful? Give feedback.
-
Love this @JPFrancoia and thanks for sharing! |
Beta Was this translation helpful? Give feedback.
-
Hi, I have a stupid question. I followed the exact instruction above, saved the adapter code to
I am assuming the |
Beta Was this translation helpful? Give feedback.
-
The example in the original post works for me, but I get this error after a couple of minutes idle time in codecompanion, when using vertex: Error: [{
"error": {
"code": 401,
"message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
"status": "UNAUTHENTICATED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "CREDENTIALS_MISSING",
"domain": "googleapis.com",
"metadata": {
"method": "google.cloud.aiplatform.v1.PredictionService.ChatCompletions",
"service": "aiplatform.googleapis.com"
}
}
]
}
}
] Is this something you have also encountered, and any idea to mitigate? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi all, I would like to give this adapter to the community. Here is some context:
Google provides the Gemini developer API, which I believe most people are familiar with. This API requires an API key. There is an official adapter for this API (the
gemini
one). However people might not be able to use it in an enterprise setting, because of licensing, compliance, security, etc. For example, if a team works with a GCP project, you can't really create an API key per person (well you could, but then you must ensure that person A can't see person B's API key). You also can't create just one common API key, because then you can't track usage per person.Google's answer to these problems is to use Vertex AI. They have a page explaining the difference between Gemini Developer API and Vertex AI. With Vertex AI, users can login with their user credentials, no need for an API key.
The two APIs are actually very similar, so the vertex AI adapter is largely inspired from the gemini one.
Configuration example:
I also found out a few things:
The global endpoint is formatted like this:
The regional endpoints are formatted like this:
I hope this saves someone else's time, cheers!
Beta Was this translation helpful? Give feedback.
All reactions