
Before you begin
- Labs create a Google Cloud project and resources for a fixed time
- Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
- On the top left of your screen, click Start lab to begin
Enable the Vertex AI API
/ 25
Extract the content of the image
/ 25
Create prompts with text
/ 25
Create conversations with chat prompt
/ 25
Vertex AI is a comprehensive machine learning development platform that provides both predictive and generative AI capabilities. It allows you to train, evaluate, and deploy predictive machine learning models for forecasting purposes. Additionally, you can utilize the platform to discover, tune, and serve generative AI models to produce content.
Vertex AI Studio lets you quickly test and customize generative AI models so you can leverage their capabilities in your applications. It provides a variety of tools and resources including both UI (user interface) and coding examples that make it easy to start with generative AI, even if you don't have a background in machine learning.
This lab guides you through Vertex AI Studio, where you'll unlock the potential of cutting-edge generative AI models. You'll explore Gemini and use it to analyze images, design prompts, and generate conversations directly on the Google Cloud console. No need for API or Python SDKs - it's all accessible through the intuitive user interface.
In this lab, you will learn how to:
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 are made available to you.
This hands-on lab lets you do the lab activities in a real cloud environment, not in a simulation or demo environment. It does so by giving you new, temporary credentials you use to sign in and access Google Cloud for the duration of the lab.
To complete this lab, you need:
Click the Start Lab button. If you need to pay for the lab, a dialog opens for you to select your payment method. On the left is the Lab Details pane with the following:
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.
If necessary, copy the Username below and paste it into the Sign in dialog.
You can also find the Username in the Lab Details pane.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab Details pane.
Click Next.
Click through the subsequent pages:
After a few moments, the Google Cloud console opens in this tab.
In this section, you will use Gemini to analyze an image and extract information from it. In Freeform mode, you can design prompts for various tasks such as classification, extraction, and generation. There is no conversation history in Freeform mode, so every prompt is a brand-new request to the model.
In the Google Cloud console, enter Vertex AI API in the top search bar.
Click on the result for Vertex AI API under Marketplace & APIs.
Click Enable.
The UI contains three main sections:
On the top left, click Untitled Prompt and rename your prompt as Image Analysis
.
In the Configuration section on the top right, click on the Model dropdown then select the
For Region, select
Download the sample image. Right-click the timetable image and then save it to your desktop.
Or be more specific:
Does the title meet your expectations? Try to modify the prompt to see if you get different results.
Further on, if you want to format the output to a list, replace the previous prompt with the following:
Your turn - try out some different prompts! How do these results differ from before?
Does the result meet your expectations? You are highly encouraged to try different prompts for various tasks. You are also encouraged to experiment with different temperature settings to observe the changes in the result.
Once you finish the prompt design, save the prompt by clicking Save on the top right of the Configuration section. For the region, select
To find your saved prompts, on the left-hand navigation menu, navigate to Prompt Management.
Click Check my progress to verify the objectives.
In addition to images, text, and audio, Gemini is capable of accepting videos as inputs and generating text as an output.
Navigate to Cloud Storage > Buckets and copy the name of your Cloud Storage bucket and save it to use in the further step.
Click Activate Cloud Shell at the top of the Google Cloud console.
In your Cloud Shell terminal, run the command below to copy the sample video gs://spls/gsp154/video/train.mp4
(preview) to your Cloud Storage bucket. Replace <Your-Cloud-Storage-Bucket>
with the bucket name you copied earlier.
<Your-Cloud-Storage-Bucket>
with your bucket name.From the Navigation menu (), select Vertex AI > Vertex AI Studio > Overview.
Under Generate with Gemini, click Open Freeform.
In the Configuration section on the top right, click on the Model dropdown then select the
For Region, select
Click Insert Media > Import from Cloud Storage.
Click on your bucket name and then click on the sample video i.e., train.mp4
and click Select.
Generate information about the video by inserting the following prompt and clicking the Submit button.
Freeform mode offers many capabilities such as writing stories from images, analyzing videos, and generating multimedia ads. Explore more freeform use cases by clicking Prompt gallery. Check out more information about design multimodal prompts.
In this section, you will explore designing text prompts in Vertex AI Studio. You will explore zero-shot, one-shot, and few-shot prompting.
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 are three main methods to design prompts:
Temperature and Token limit are two important parameters that you can adjust to influence the model's response.
Try zero-shot prompting in Free-form mode.
Navigate back to the Vertex AI Studio > Overview page and click Open Freeform.
On the top right under Model, select the
For Region, select
Copy the following over to the prompt input field:
The model will respond to a comprehensive definition of the term prompt gallery.
Here are some exploratory exercises to explore.
Output Token limit
parameter to 1024
and click the SUBMIT button.Temperature
parameter to 0.5
and click the SUBMIT button.Temperature
parameter to 2.0
and click the SUBMIT button.Inspect how the responses change as to change the parameters.
You can design prompts in more organized ways. You can provide Context and Examples in their respective input fields. One-shot prompting is a method where the model is given a single example of the task that it is being asked to perform. In this section, you will ask the model to complete a sentence.
Start by removing any text from the Prompt box.
Inside of the Prompt box, click Add examples. This will open a new window where you can add examples for the prompt.
Click on the Add examples button.
In the Test field, copy the following in the Input field.
Instead of completing the sentence, the model gave a full sentence as a response since you provided an example for the model to base its output from. To change the response to simply complete the sentence, you can adjust the example provided in the OUTPUT field.
Click on the Add examples button.
In the Test field, copy the following in the Input field.
You can see that the model now completes the sentence based on the example you provided. 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 using few-shot prompting.
Click the Add examples button to add more examples.
Add the following examples:
INPUT | OUTPUT |
---|---|
A well-made and entertaining film | positive |
I fell asleep after 10 minutes | negative |
The movie was ok | neutral |
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.
Sentiment Analysis
.Click Check my progress to verify the objectives.
Chat mode is a conversational mode that allows you to have a freeform chat with the model. The model uses the conversation history as context for future responses. In this section, you will create a chat prompt and have a conversation with the model.
From the left menu, navigate to Chat to create a new chat prompt.
On the top right under Model, select the
For this section, you will add context to the chat and let the model respond based on the context provided.
The model should respond with the following:
In System instructions, click Clear value.
Click System instructions and add the following context:
The model should now be more helpful in its response to the user query.
Feel free to experiment with different prompts and context to see how the model responds. You can also add more context to the chat prompt to see how the model responds based on the context provided.
Support Technician Helper
.Click Check my progress to verify the objectives.
You learned how to analyze an image with freeform, explore freeform capabilities, create and test a prompt, and generate a conversation. You have taken the first step to start your journey using Vertex AI Studio and Gemini Freeform!
...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 February 07, 2025
Lab Last Tested February 07, 2025
Copyright 2025 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.
Ce contenu n'est pas disponible pour le moment
Nous vous préviendrons par e-mail lorsqu'il sera disponible
Parfait !
Nous vous contacterons par e-mail s'il devient disponible
One lab at a time
Confirm to end all existing labs and start this one