Checkpoints
Build a Gemini image analysis tool.
/ 25
Build a Gemini tagline generator.
/ 25
Experiment with image analysis code.
/ 25
Experiment with tagline generation code.
/ 25
Prompt Design in Vertex AI: Challenge Lab
GSP519
Overview
In a challenge lab you’re given a scenario and a set of tasks. Instead of following step-by-step instructions, you will use the skills learned from the labs in the course to figure out how to complete the tasks on your own! An automated scoring system (shown on this page) will provide feedback on whether you have completed your tasks correctly.
When you take a challenge lab, you will not be taught new Google Cloud concepts. You are expected to extend your learned skills, like changing default values and reading and researching error messages to fix your own mistakes.
To score 100% you must successfully complete all tasks within the time period!
This lab is recommended for students who have enrolled in the Prompt Design in Vertex AI and Gemini course. Are you ready for the challenge?
Topics tested
- Craft effective prompts and use parameters to guide generative AI output in Vertex AI Studio.
- Apply Gemini models to create product descriptions and taglines in a real-world marketing scenario.
- Examine and run Python code exported from Vertex AI Studio to gain a basic understanding of generative AI implementation.
- Use Jupyter Notebooks to test and modify generative AI code.
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).
- Time to complete the lab---remember, once you start, you cannot pause a lab.
Challenge Scenario
You're a member of an educational content startup specializing in engaging learners with the natural world. You've formed a partnership with Cymbal Direct, an online retailer launching a new line of outdoor gear and apparel designed to encourage young people to explore and connect with nature.
Cymbal Direct wants to create a marketing campaign for its new product line that leverages the power of generative AI. Your task is to help them develop a set of tools within Google Cloud's Vertex AI platform that will streamline the generation of the following:
- Evocative Product Descriptions: using image analysis to inspire short, descriptive text that captures the essence of their products and the feeling of being in nature.
- Catchy Taglines: focused on highlighting product features, the target audience, and the desired emotional response.
Task 1. Build a Gemini image analysis tool
In this section, you will create a template for analyzing images of Cymbal Direct products using the Gemini 1.5 Pro model in Vertex AI Studio. The goal is to generate descriptive text options inspired by the image, from simple details to more evocative, mood-setting phrases.
Tasks:
- Before you begin, download the image provided for this task. The following image is a product from Cymbal Direct. Right-click and select Save image as to save the image to your local machine.
-
Use Vertex AI Studio's Freeform interface with the gemini-1.5-pro model to analyze Cymbal Direct's product image (provided) and generate multiple descriptive text options inspired by the image.
-
Experiment with different prompts to generate the following:
- Short, descriptive text inspired by the image.
- Catchy phrases suitable for advertisements.
- A poetic description for a nature-focused campaign.
-
Evaluate and Iterate: adjust your prompt and parameters as needed to refine the results.
-
Name your prompt
Cymbal Product Analysis
. -
Save Prompt: Once you're happy with the results, click Save, and select the
region.
Task 2. Build a Gemini tagline generator
In this task, you will create a freeform prompt for generating diverse tagline possibilities using the Gemini 1.5 Pro model in Vertex AI Studio. The goal is to develop a prompt that allows for customization of the tagline style, based on product attributes, target audience, and emotional resonance.
Tasks:
-
Create a new Freeform prompt with the gemini-1.5-pro model to create a customizable tagline generator for Cymbal Direct's new product line.
-
In the System instructions box, enter the following:
- Include 2 Examples in your prompt to guide the output style. An example input and output are provided below for reference:
Input | Output |
---|---|
Write a tagline for a durable backpack designed for hikers that makes them feel prepared. Consider styles like minimalist. | Built for the Journey: Your Adventure Essentials. |
-
Design a Freeform Prompt with parameters to customize taglines based on:
- Product attributes (e.g., durable, lightweight)
- Target audience (e.g., young adventurers, families)
- Emotional resonance (e.g., empowered, connected)
-
In the Test box, add one input and click the submit button to have Gemini generate a tagline option based on your prompt.
-
Evaluate and Iterate:
- Experiment with different parameter combinations to see the variety of taglines produced.
- Based on the results, fine-tune the wording of your prompt, add more parameter options, or adjust the style choices to achieve your desired outcome.
-
Name your prompt
Cymbal Tagline Generator Template
. -
Save Prompt: Once you're happy with the results, click Save, and select the
region.
Task 3. Experiment with image analysis code
In this task, you will explore the Python code for the image analysis prompt you created. You will then modify the prompt to be more specific and test the new prompt in a notebook.
-
In the Google Cloud Console, on the Navigation menu, click Vertex AI > Workbench.
-
On the Instances page, find the
generative-ai-jupyterlab
notebook and click on the Open JupyterLab button. -
Create a new notebook file named
image-analysis.ipynb
.
Explore the image analysis code
-
From the Vertex AI Studio page, navigate to the Saved Prompts page. Select the Cymbal Product Analysis prompt you created.
-
On the right side of the prompt, click Get Code. Use Python as the language.
!
character at the beginning of each command.
In this scenario, run the first code block in the terminal by navigating to the File > New > Terminal. - Run the second code cells in the notebook. Verify that the code executes successfully and produces the expected output.
Modify the image analysis prompt
- Within the code, there will be a line of text between triple quotes (
"""
). This is your current image analysis prompt. For example, it might be:
-
Now you will modify the prompt to be more specific. Change the wording of the prompt in the code cell to make the output less than 10 words.
-
Next, modify the prompt code to encourage the model to produce the most creative, unusual, and unexpected descriptions of the image it can think of.
-
Save the changes to your code. Then, rerun the code cell in your notebook to test Gemini with the new prompt.
-
Verify that the new descriptions are shorter and more creative than the previous ones.
Task 4. Experiment with tagline generation code
In this task, you will explore the Python code for the tagline prompt you created. You will then modify the prompt to include a specific keyword and test the new prompt in a notebook.
-
Create a new notebook file named
tagline-generator.ipynb
. -
Add the following code to the notebook:
- Update the placeholders
<your example input>
with the example inputs from your tagline prompt and<your example output>
with the example outputs from your tagline prompt. Also, update<your test input>
with your test input.
The examples and test inputs should be be copied from your Cymbal Tagline Generator Template prompt, which you can find in the Saved Prompts page in Vertex AI Studio.
- Run the code cell in the notebook. Verify that the code executes successfully and produces the expected output.
Modify the tagline generation prompt
-
Within the code, there will be multiple lines of text between triple quotes (
"""
). This is your current tagline generation prompt. -
Now you will modify the prompt to include a specific keyword. Modify the last input to specifically request that the tagline includes the keyword
nature
. -
Save the changes to your code. Then, rerun the code cell in your notebook to test the language model with the new prompt.
-
Verify that the new tagline includes the keyword
nature
.
Congratulations!
Congratulations, you've successfully completed the lab! You've helped Cymbal Direct create a set of tools within Google Cloud's Vertex AI platform that will streamline the generation of evocative product descriptions and catchy taglines for their new product line. You've also explored and modified the image analysis and tagline generation code in a notebook. Great job!
Next steps / Learn more
- Check out the Generative AI on Vertex AI documentation.
- Learn more about generative AI on the Google Cloud Tech YouTube channel.
- Google Cloud Generative AI official repo
- Example Gemini notebooks
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 August 30, 2024
Lab Last Tested August 30, 2024
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.