I am the infrastructure engineer at my company and our ML team is exploring the possibility of using the PaLM models through Vertex AI but whenever we try to interact with the API via Python, we get the following error message:
google.api_core.exceptions.PermissionDenied: 403 Generative Language API has not been used in project xxxxxxxxxxxxx before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/generativelanguage.googleapis.com/overview?project=xx... then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.
(I obfuscated our project ID, I'm not sure if that is considered sensitive or not)
I have already enabled the Vertex API and verified that billing is enabled for the project we are working with. I followed the provided link and I get an error in the console saying "Failed to load". I have attached the code that was provided by my ML team that is giving the error:
import google.generativeai as palm
palm.configure()
palm.list_models()
I have tried this with an API key, with a service account I created in which I granted "Vertex AI Admin" role, and with my own credentials (with owner level access) configured using "gcloud auth application-default login" and I receive the same error regardless. I tested using the Generative AI studio and I was able to interact with it OK, so I am at a total loss as to why we can't access via API.
Apologies if this is a stupid question, I've had no luck searching Google and the forums here, and my knowledge with GCP specifically is very limited. Any suggestions would be greatly appreciated.
Thanks,
Steve
This will probably solve your problem. As you previously activated the Generativeai API and probably activated Vertex AI API also:
import os
import google.generativeai as palm
os.environ['GOOGLE_APPLICATION_CREDENTIALS'] = '/home/user/service_account_key.json'
palm.configure()
list(palm.list_models())
But my question is: why don't you use Generative AI Studio or Model Garden? They also have text-bison, gecko and chat-bison in a more friendly interface.
User | Count |
---|---|
2 | |
2 | |
1 | |
1 | |
1 |