I am integrating vertex AI Gemini with big query, i have enabled vertex AI API from console, but first i am trying a python script to check But I am getting below error:An error occurred: 404 Publisher Model `projects/pm-data-lake-400215/locations/us-central/publishers/google/models/Gemini-1.0-pro` was not found or your project does not have access to it. Please ensure you are using a valid model version.
Pythonscript:
Import the Vertex AI library
import vertexai
from vertexai.generative_models import GenerativeModel
# --- Configuration ---
PROJECT_ID = "prm-data-lake-400215"
LOCATION = "us-central1"
MODEL_ID = "gemini-1.0-pro" # Also tried gemini-1.5-flash-001
# --- Initialize Vertex AI ---
vertexai.init(project=PROJECT_ID, location=LOCATION)
# --- Load the Gemini Model ---
model = GenerativeModel(MODEL_ID)
# --- Send a Prompt ---
prompt = "In simple terms, what is a large language model?"
print(f"Sending prompt: '{prompt}'")
try:
response = model.generate_content(prompt)
# --- Print the Response ---
print("\n--- Model Response ---")
if response.candidates and response.candidates[0].content.parts:
print(response.candidates[0].content.parts[0].text)
else:
print("No text content found in the response.")
# print(response) # Uncomment to see full response structure if needed
except Exception as e:
print(f"\nAn error occurred: {e}")
print("\n--- Script Finished ---")
I have tried all model versions but nothing is working for me, i have checked all the permissions and my user has owner access
Can you please assist on this
Hi @dheerajp,
Welcome to Google Cloud Community!
The 404 error you encountered usually suggests that your configured Gemini model does not have access or cannot be found within your project or designated locations.
While you mentioned that you've tried all model versions, it’s still worth checking the model versions and lifecycles, such as the latest stable models for Gemini, which are the recommended, publicly released, and supported versions. Additionally, make sure to note any retired models that have been permanently deactivated, as well as legacy stable models for which access is already restricted for new projects.
Ensure that there are no typographical errors, particularly in your Project ID and location. When specifying a location, confirm that it supports the Gemini model you have selected. Additionally, ensure that the billing account linked to your Google Cloud Project is active.
Was this helpful? If so, please accept this answer as “Solution”. If you need additional assistance, reply here within 2 business days and I’ll be happy to help.