gemini_video_generation.py
Run the Example
1
Set up your virtual environment
2
Install dependencies
3
Export environment variables
4
Authenticate with Google Cloud
Sign in with Application Default Credentials:
5
Use Veo 3.1
Replace
GeminiTools(vertexai=True) with GeminiTools(vertexai=True, video_generation_model="veo-3.1-generate-001", enable_generate_image=False) in the saved file.6
Decode the returned content
Replace
base64_data=str(video.content) with base64_data=video.content.decode("utf-8") so save_base64_data() receives the base64 string instead of a bytes representation.7
Run the example
Save the code above as
gemini_video_generation.py, then run: