Vertex AI Python SDK

Simple example below from Google Documents throws an error  - Internal Server Error

 

import vertexai
 
from vertexai.generative_models import GenerativeModel, Part

 
# TODO(developer): Update and un-comment below lines
 
# project_id = "PROJECT_ID"

  vertexai
.init(project=project_id, location="us-central1")

  model
= GenerativeModel(model_name="gemini-1.5-pro-preview-0409")

  prompt
= """
  Provide a description of the video.
  The description should also contain anything important which people say in the video.
"""


  video_file_uri
= "gs://cloud-samples-data/generative-ai/video/pixel8.mp4"
  video_file
= Part.from_uri(video_file_uri, mime_type="video/mp4")

  contents
= [video_file, prompt]

  response
= model.generate_content(contents)
 
print(response.text)

 

4 0 79
0 REPLIES 0