Skip to main content
vertexai_with_credentials.py

Run the Example

1

Set up your virtual environment

2

Install dependencies

3

Provide service account credentials

Load a google.oauth2.service_account.Credentials object and replace the placeholder project ID before running the example.
4

Run the example

Save the code above as vertexai_with_credentials.py, then run:
Full source: cookbook/90_models/google/gemini/vertexai_with_credentials.py