arrow_back

Get Started with Generative AI Studio

Join Sign in

Get Started with Generative AI Studio

1 hour 1 Credit

GSP1154

Google Cloud self-paced labs logo

Overview

Vertex AI is an end-to-end machine learning platform that helps you build, deploy, and scale machine learning models faster and easier. It provides a unified experience for managing all aspects of the machine learning lifecycle, from data preparation to model deployment.

Vertex AI Generative AI Studio is a cloud-based platform that allows users to create and experiment with generative AI models. The platform provides a variety of tools and resources that make it easy to get started with generative AI, even if you don't have a background in machine learning.

In this lab, you use Generative AI Studio with Vertex AI to create prompts and conversations on Google Cloud console, without using the API or Python SDKs.

Objectives

In this lab, you learn how to perform the following tasks:

  • Create prompts with free-form and structured mode.
  • Create conversations.
  • Explore the prompt gallery.

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

Enable the Vertex AI API

  1. In the Google Cloud Console, enter Vertex AI API in the top search bar.

  2. Click on the result for Vertex AI API under Marketplace & APIs.

  3. Click Enable.

Click Check my progress to verify the objectives.

Enable the Vertex AI API

Task 1. Create prompts

  1. In the Google Cloud Console, in the Navigation menu (Navigation menu), navigate to Artificial Intelligence > Vertex AI.
Note: If you cannot see the Vertex AI in the Navigation menu clcik on More Products dropdown.
  1. In the Vertex AI menu, under Generative AI Studio , click Language.

Create prompt

Create Prompt lets you designs prompts for tasks relevant to your business use case including code generation.

Click on the TEXT PROMPT button as shown in the image below. Please note the UI may change slightly when you are practicing with this lab.

click-text-prompt

Upon clicking, you will be redirected to the following page. You can hover or click on ? buttons on the right side of the page to learn more about each field and parameter such as Temperature and Token limit. Also, the following image has been annotated to provide a quick overview of the interface.

new-prompt-annotated

Prompt design

You can feed your desired input text, e.g. a question, to the model. The model will then provide a response based on how you structured your prompt. The process of figuring out and designing the best input text (prompt) to get the desired response back from the model is called Prompt Design.

There is no best way to design the prompts yet. Generally, there are 3 methods that you can use to shape the model's response in a way that you desired.

  • Zero-shot prompting - This is a method where the LLM is given no additional data on the specific task that it is being asked to perform. Instead, it is only given a prompt that describes the task. For example, if you want the LLM to answer a question, you just prompt "what is prompt design?".
  • One-shot prompting - This is a method where the LLM is given a single example of the task that it is being asked to perform. For example, if you want the LLM to write a poem, you might give it a single example poem.
  • Few-shot prompting - This is a method where the LLM is given a small number of examples of the task that it is being asked to perform. For example, if you want the LLM to write a news article, you might give it a few news articles to read.

You may also notice the FREE-FORM and STRUCTURED tabs in the image above. Those are the two modes that you can use when designing your prompt.

  • FREE-FORM - This mode provides a free and easy approach to design your prompt. It is suitable for small and experimental prompts with no additional examples. You will be using this to explore zero-shot prompting.
  • STRUCTURED - This mode provides an easy-to-use template approach to prompt design. Context and multiple examples can be added to the prompt in this mode. This is especially useful for one-shot and few-shot prompting methods which you will be exploring later.

FREE-FORM mode

You will try zero-shot prompting in FREE-FORM mode.

  1. Copy the following over to the prompt input field.
What is a prompt gallery?
  1. Click on the SUBMIT button on the right side of the page.

The model will respond to a comprehensive definition of the term prompt gallery.

new-prompt-freeform

Here are some exploratory exercises to explore.

  • adjust the Max responses parameter to 3 and click the SUBMIT button
  • adjust the Token limit parameter to 1 and click the SUBMIT button
  • adjust the Token limit parameter to 1024 and click the SUBMIT button
  • adjust the Temperature parameter to 0.5 and click the SUBMIT button
  • adjust the Temperature parameter to 1.0 and click the SUBMIT button

Inspect if how the responses change as to change the parameters?


STRUCTURED mode

With STRUCTURED mode, you can design prompts in more organized ways. You can also provide Context and Examples in their respective input fields. This is a good opportunity to learn one-shot and few-shot prompting.

In this section, you will ask the model to complete a sentence.

  1. Return to the Text Prompt window.
  2. Click on the STRUCTURED tab if you have not.
  3. Remove any text from the Context
  4. Under Test field, copy the following in INPUT field.
the color of the sky is
  1. Click on the SUBMIT button on the right side of the page.

You would see similar results as shown in the image below.

new-prompt-structured-zero-shot

Instead of completing the sentence, the model gave a full sentence as a response which is not what we wanted. You can try to influence the model's response with one-shot prompting. This time around you will add an example for the model to base its output from.

Under Examples field,

  1. Copy the following to the INPUT field.
the color of the grass is
  1. Copy the following to the OUTPUT field.
the color of the grass is green
  1. Click on the SUBMIT button on the right side of the page.

Now the model will respond to complete the sentence instead. The response should be something like this.

new-prompt-structured-one-shot

You have successfully influenced the way the model produces response.


For the next practice, you will use the model to perform sentiment analysis on a sentence, such as determining whether a movie review is positive or negative.

  1. Return to the Text Prompt window.
  2. Under Examples field, delete the previous text for INPUT and OUTPUT for green grass.
  3. Under Test field, copy the following prompt over to the INPUT field.
It was a time well spent!
  1. Click on the SUBMIT button on the right side of the page.

new-prompt-structured-sentiment-zero-shot

As you can see, the model did not have enough information to know whether you were asking it to do sentiment analysis. This can be improved by providing the model with a few examples of what you are looking for.

Try adding these examples as shown in the image below:

INPUT OUTPUT
A well-made and entertaining film positive
I fell asleep after 10 minutes negative
The movie was ok neutral

new-prompt-structured-sentiment-few-shot

and click on the SUBMIT button on the right side of the page.

The model now provides a sentiment for the input text. For the text It was a time well spent!, the sentiment is labeled as positive.

You can also save the newly designed prompt. To save the prompt, click on SAVE button and name it anyway you like, such as sentiment analysis test. Click SAVE.

(If you encounter an error while saving, please click Retry )

new-prompt-save-prompt

The saved prompt will appear at the MY PROMPTS tab.

my-prompts-saved


Click Check my progress to verify the objectives.

Create prompts with text

Task 2. Create conversations

Create Chat Prompt lets you have a freeform chat with the model, which tracks what was previously said and responds based on context.

  1. Return to the Language page.
  2. Click on the TEXT CHAT button to create a new chat prompt.

create-chat-prompt

You will see the new chat prompt page.

new-chat-prompt

For this section, you will add context to the chat and let the model respond based on the context provided.

Add these contexts to the Context field.

  1. Copy these context to Context field.
Your name is Roy. You are a support technician of an IT department. You only respond with "Have you tried turning it off and on again?" to any queries.
  1. Copy the following text to the chatbox under Responses.
My computer is so slow
  1. Press Enter key or click Send message (right arrow-head button)

new-chat-prompt

The model would consider the provided additional context and answer the questions within the constraints.

Save the newly designed prompt. To save the prompt, click on SAVE button and name it anyway you like. Click SAVE

Click Check my progress to verify the objectives.

Create conversations with chat prompt

Task 3. Explore prompt gallery

Prompt Gallery lets you explore how generative AI models can work for a variety of use cases.

In the Generative AI Studio menu, click on Language to find Prompt Gallery on the Get Started page.

Pick any two use cases from Summarization, Classification, Extraction, Writing, and Ideation, and explore them at your own pace.

landing

Congratulations!

You learned how to create and test a prompt, create a conversation, and explore the prompt gallery. You have taken the first step to start your journey using Generative AI Studio and other Generative AI development tools!

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 October 31, 2023

Lab Last Tested October 31, 2023

Copyright 2023 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.