Find answers from the community

Updated last year

Vertex

At a glance

The community member is having trouble using Vertex AI with LLM Index. They have set the GOOGLE_APPLICATION_CREDENTIALS environment variable but are still getting a "Permission Denied" error with insufficient authentication scopes. Other community members suggest that the community member may not have completed the initial setup steps mentioned in the LLM Index documentation, and that the issue may be specific to running the code on a cloud VM rather than a local machine.

Useful resources
hey guys how to use vertex ai with llama index, i have service account json file path stored in path (mac env) as GOOGLE_APPLICATION_CREDENTIALS, what else i should configure, still i get this error

Plain Text
PermissionDenied: 403 Request had insufficient authentication scopes. [reason: "ACCESS_TOKEN_SCOPE_INSUFFICIENT"
domain: "googleapis.com"
metadata {
  key: "service"
  value: "aiplatform.googleapis.com"
}
metadata {
  key: "method"
  value: "google.cloud.aiplatform.v1.ModelGardenService.GetPublisherModel"
}


for the code
Plain Text
import vertexai
from google.cloud import aiplatform
from vertexai import preview

project_id = "project-id"
location = "us-central1"

vertexai.init(project=project_id, location=location)

aiplatform.init(
    # your Google Cloud Project ID or number
    # environment default used is not set
    project=project_id,
    # the Vertex AI region you will use
    # defaults to us-central1
    location=location,
    # Google Cloud Storage bucket in same region as location
    # used to stage artifacts
    #     staging_bucket='gs://my_staging_bucket',
    # custom google.auth.credentials.Credentials
    # environment default credentials used if not set
    #     credentials=my_credentials,
    # customer managed encryption key resource name
    # will be applied to all Vertex AI resources if set
    #     encryption_spec_key_name=my_encryption_key_name,
    # the name of the experiment to use to track
    # logged metrics and parameters
    #     experiment='my-experiment',
    # description of the experiment above
    #     experiment_description='my experiment description'
)

above code i have initialised the gcp
when i ran this code
Plain Text
from llama_index.llms.vertex import Vertex

llm = Vertex(model="text-bison", temperature=0, additional_kwargs={})
llm.complete("Hello this is a sample text").text


help me out @everyone
W
A
3 comments
Seems like the token does not have the required scopes
@WhiteFang_Jr same code works in my mac now, but when i tried cloud vm its giving this error
path is also set
Add a reply
Sign up and join the conversation on Discord