Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Problems with calling Gemini API from Vertex training job

I am trying to run Vertex training job which contains calls to Gemini API (GenerativeModel -> generate_content()), however it fails on error "PermissionDenied: 403 Request had insufficient authentication scopes". I tried to generate service account key in container using "gcloud iam service-accounts keys create", but this fails on error "Your current active account [] does not have any valid credentials" -> I only found mention from 2014 that setting CLOUDSDK_PYTHON_SITEPACKAGES=1 might fix this, but it didn't.

So how this should be done. In project which is used in vertexai.init() service account attached to training jobs has following rights: Vertex AI Custom Code Service Agent, Vertex AI Extension Custom Code Service Agent, Vertex AI User

3 1 524
1 REPLY 1