Unable to check thoughts with gemini-3-pro-image-preview when response_modalities=['Image']

Unable to check thoughts with gemini-3-pro-image-preview when response_modalities=[‘Image’]

Using example in the cookbook:

prompt = "Create an unusual but realistic image that might go viral"  # @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=['Image'],
        image_config=types.ImageConfig(
            aspect_ratio=aspect_ratio,
        ),
        thinking_config=types.ThinkingConfig(
            include_thoughts=True # Don't forget this part if you want to check the thoughts later
        )
    )
)

display_response(response)
save_image(response, 'viral.png')

for part in response.parts:
  if part.thought:
    if part.text:
      display(Markdown(part.text))
    elif image:= part.as_image():
      #image.show() # Skipping it since in most case it should be the same image as in the output
      print("IMAGE")