Problem with Vertex AI's prediction endpoint

I am currently utilizing LangChain to query and parse outputs from VertexAI models. Recently, upon transitioning from the test project to the production project in Google Cloud Platform (GCP) and updating the credentials locally via gcloud init, my requests are being refused. The error message I encounter is as follows:

{
    "detail": "403 Permission 'aiplatform.endpoints.predict' denied on resource '//aiplatform.googleapis.com/projects/my-project/locations/us-central1/publishers/google/models/textembedding-gecko@003' (or it may not exist). [reason: \"IAM_PERMISSION_DENIED\"\ndomain: \"aiplatform.googleapis.com\"\nmetadata {\n  key: \"resource\"\n  value: \"projects/my-project/locations/us-central1/publishers/google/models/textembedding-gecko@003\"\n}\nmetadata {\n  key: \"permission\"\n  value: \"aiplatform.endpoints.predict\"\n}\n]"
}

My region is configured to us-central1, and I have assigned the "owner" role to the account I am using, which is the same permission level I possessed in my test project, where it functioned without issues.

I tried making different service accounts with various permissions, from just AIplatform to AIplatform and VertexAI owners, but none of them fixed the issue. I also played around with changing the region to match other services I use on GCP, but that didn't work either.

Just to be clear, here's how I'm setting up the model objects in my code:

from langchain_google_vertexai import VertexAIEmbeddings
from langchain_google_vertexai import VertexAI

model = VertexAI(project=config["gcpProjectID"], model_name="text-bison@002", temperature=0.0)
embeddings = VertexAIEmbeddings(project=config["gcpProjectID"], model_name="textembedding-gecko")

I am at a loss as to the cause of this issue and would greatly appreciate any suggestions on how to proceed.

Thanks in advance.

Upvotes: 1

Views: 1101

Answers (1)

Mike
Mike

Reputation: 1

Make sure your machine has authenticated through the gcloud using both gcloud auth login or gcloud auth application-default login

Upvotes: 0

Related Questions