I am trying to run the example notebook “Google Colab On my computer locally.
While the gemini-2 example works fines I can’t get the google gemini-3-pro working:
PRO_MODEL_ID = “gemini-3-pro-image-preview”
prompt = “Visualize the current weather forecast for the next 5 days in Tokyo as a clean, modern weather chart. add a visual on what i should wear each day” # @param {type:“string”}
aspect_ratio = “16:9” # @param [“1:1”,“2:3”,“3:2”,“3:4”,“4:3”,“4:5”,“5:4”,“9:16”,“16:9”,“21:9”]
response = client.models.generate_content(
model=PRO_MODEL_ID,
contents=prompt,
config=types.GenerateContentConfig(
response_modalities=[‘Text’, ‘Image’], # Image only currently doesn’t wortk with grounding
image_config=types.ImageConfig(
aspect_ratio=aspect_ratio,
),
tools=[{“google_search”: {}}]
)
)
I tried running the same code with the gemini-3-pro-image-preview model on my end, and it worked perfectly with no errors. I have attempted to create it multiple times, but no errors have occurred.
Code:
from google import genai
from google.genai import types
from google.colab import userdata
from google.colab import userdata
API_KEY = userdata.get('API_KEY')
client = genai.Client(api_key=API_KEY)
chat = client.chats.create(
model="gemini-3-pro-image-preview",
config=types.GenerateContentConfig(
response_modalities=['TEXT', 'IMAGE'],
tools=[{"google_search": {}}],
image_config=types.ImageConfig(
aspect_ratio="16:9"
),
)
)
message = "Visualize the current weather forecast for the next 5 days in Tokyo as a clean, modern weather chart. add a visual on what i should wear each day"
response = chat.send_message(message)
for part in response.parts:
if part.text is not None:
print(part.text)
elif image:= part.as_image():
image.save("Generated.png")
Hello, it’s seems it is related to google server issue so I just retry and it works. The error message was unclear and there is not way to check if the server were down.