Generative AI with Vertex AI: Getting Started

Sign in Join
Test and share your knowledge with our community!
Get access to over 700 hands-on labs, skill badges, and courses

Generative AI with Vertex AI: Getting Started

Lab 1 hour 30 minutes universal_currency_alt 1 Credit show_chart Introductory
Test and share your knowledge with our community!
Get access to over 700 hands-on labs, skill badges, and courses


Google Cloud self-paced labs logo


This lab will provide an introductory, hands-on experience with Generative AI on Google Cloud.

PaLM 2 is Google's next generation Large Language Model (LLM) that builds on Google's legacy of breakthrough research in machine learning and responsible AI. PaLM 2 excels at tasks like advanced reasoning, translation, and code generation because of how it was built.

Vertex AI Studio and the Vertex AI PaLM API is powered by PaLM 2.

In this lab, you will learn how to get started with AI Studio and the Vertex AI PaLM API.

What you will learn:

How to use the Generative AI:

  • Creating different types of prompts and getting responses in a jupyter notebook

How to use the Vertex AI PaLM API & Python SDK:

  • Background on LLMs and the PaLM API
  • Text generation examples
  • Exploring various model parameters involved in text generation
  • Chat model examples
  • Code completion model examples
  • Embedding model examples

Setup and requirements

Before you click the Start Lab button

Read these instructions. Labs are timed and you cannot pause them. The timer, which starts when you click Start Lab, shows how long Google Cloud resources will be made available to you.

This hands-on lab lets you do the lab activities yourself in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials that you use to sign in and access Google Cloud for the duration of the lab.

To complete this lab, you need:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito or private browser window to run this lab. This prevents any conflicts between your personal account and the Student account, which may cause extra charges incurred to your personal account.
  • Time to complete the lab---remember, once you start, you cannot pause a lab.
Note: If you already have your own personal Google Cloud account or project, do not use it for this lab to avoid extra charges to your account.

How to start your lab and sign in to the Google Cloud console

  1. Click the Start Lab button. If you need to pay for the lab, a pop-up opens for you to select your payment method. On the left is the Lab Details panel with the following:

    • The Open Google Cloud console button
    • Time remaining
    • The temporary credentials that you must use for this lab
    • Other information, if needed, to step through this lab
  2. Click Open Google Cloud console (or right-click and select Open Link in Incognito Window if you are running the Chrome browser).

    The lab spins up resources, and then opens another tab that shows the Sign in page.

    Tip: Arrange the tabs in separate windows, side-by-side.

    Note: If you see the Choose an account dialog, click Use Another Account.
  3. If necessary, copy the Username below and paste it into the Sign in dialog.

    {{{user_0.username | "Username"}}}

    You can also find the Username in the Lab Details panel.

  4. Click Next.

  5. Copy the Password below and paste it into the Welcome dialog.

    {{{user_0.password | "Password"}}}

    You can also find the Password in the Lab Details panel.

  6. Click Next.

    Important: You must use the credentials the lab provides you. Do not use your Google Cloud account credentials. Note: Using your own Google Cloud account for this lab may incur extra charges.
  7. Click through the subsequent pages:

    • Accept the terms and conditions.
    • Do not add recovery options or two-factor authentication (because this is a temporary account).
    • Do not sign up for free trials.

After a few moments, the Google Cloud console opens in this tab.

Note: To view a menu with a list of Google Cloud products and services, click the Navigation menu at the top-left. Navigation menu icon

File Organization

This lab is organized across two different files:

File Description
language/getting-started/ UI-based tutorial on getting started with AI Studio
language/getting-started/intro_palm_api.ipynb Notebook on getting started with the Vertex AI PaLM API & Python SDK

Task 1. Vertex AI Workbench

In your Google Cloud project, navigate to Vertex AI Workbench. In the top search bar, enter Vertex AI Workbench of the Google Cloud console.

Use search to locate Vertex AI workbench
  1. Go to User-managed-notebooks.
  2. Click Open JupyterLab for generative-ai-jupyterlab.
  3. The JupyterLab will run in a new tab.
Open Notebook action

Task 2. Open the generative-ai folder

  1. Navigate to the generative-ai folder on the left hand side of the notebook.
  2. Navigate to the /language/getting-started folder.
  3. Click on the intro_palm_api.ipynb file
  4. Follow the steps in the notebook and run each cell one at a time.
Loading information from the generative-ai folder

Click Check my progress to verify the objectives.

Hello PaLM Prompt templates Model parameters for text-bison@001 Advanced Chat model with the SDK Embedding model with textembedding-gecko@001 Code generation with code-bison@001 Code completion with code-gecko@001 Code chat with codechat-bison@001


You have now completed the lab! In this lab, you worked with the PaLM API in a Jupyter notebook using the Python SDK for Generative AI.

Next steps

Google Cloud training and certification

...helps you make the most of Google Cloud technologies. Our classes include technical skills and best practices to help you get up to speed quickly and continue your learning journey. We offer fundamental to advanced level training, with on-demand, live, and virtual options to suit your busy schedule. Certifications help you validate and prove your skill and expertise in Google Cloud technologies.

Manual Last Updated November 2nd, 2023

Lab Last Tested November 2nd, 2023

Copyright 2024 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.