arrow_back

Enhance Gemini Model Capabilities: Challenge Lab

Sign in Join
Get access to 700+ labs and courses

Enhance Gemini Model Capabilities: Challenge Lab

Lab 1 hour 30 minutes universal_currency_alt 5 Credits show_chart Intermediate
info This lab may incorporate AI tools to support your learning.
Get access to 700+ labs and courses

GSP525

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 Enhance Gemini Model Capabilities course. Are you ready for the challenge?

Prerequisites

Before starting this lab, you should be familiar with:

  • Basic Python programming.
  • General API concepts.
  • Running Python code in a Jupyter notebook on Vertex AI Workbench.

Topics tested

  • Utilizing the code execution feature of Gemini 2.0 Flash.
  • Implementing grounding with Google Search to enhance Gemini 2.0 Flash responses.
  • Extracting and structuring information from Gemini 2.0 Flash results via a defined JSON schema.

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 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:

  • Access to a standard internet browser (Chrome browser recommended).
Note: Use an Incognito (recommended) or private browser window to run this lab. This prevents 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: Use only the student account for this lab. If you use a different Google Cloud account, you may incur charges to that account.

Challenge Scenario

Cymbal Direct: Boosting Cymbal Direct's Retail Strategy with Gemini

Cymbal Direct, the retail arm of Cymbal, wants to leverage the power of Gemini 2.0 Flash to gain a competitive edge in the basketball sneaker market. They aim to analyze competitor pricing, understand customer preferences, and generate synthetic data for testing new ecommerce features. You, as a data analyst, are tasked with using Gemini's capabilities to help Cymbal Direct achieve these goals. This will involve:

  • Code Execution: Demonstrate the ability to execute Python code within Gemini 2.0 Flash
  • Grounding: Use grounding to enhance the accuracy and relevance of Gemini's responses to questions about retail products.
  • Controlled Generation: Retrieve information about basketball sneakers and their pricing from competitors using Google Search.

Task 1. Open the notebook in Vertex AI Workbench

  1. In the Google Cloud console, on the Navigation menu (), click Vertex AI > Workbench.

  2. Find the instance and click on the Open JupyterLab button.

The JupyterLab interface for your Workbench instance opens in a new browser tab.

  1. Click on the file.

  2. In the Select Kernel dialog, choose Python 3 from the list of available kernels.

  3. Complete Task 1 in the notebook to import the libraries and install the Gen AI SDK.

Once you have completed Task 1 and have set up your environment, you are ready to move onto the next sections. For the following tasks, you will need to complete the missing parts of each cell to progress to the next section. These will be denoted with TODO and an instruction to complete.

Click Check my progress to verify the objective. Import the necessary libraries and set up the Gen AI SDK.

Task 2. Code Execution with Gemini 2.0 Flash

In this task, you'll use Gemini 2.0 Flash to generate and execute Python code. You are tasked with completing the Python code in cells of a Jupyter notebook which leverage Gemini to perform code execution.

Note: Your tasks will be labeled with a #TODO section in the cell. Read each cell carefully and ensure you are filling them out correctly! You will check your progress on this page to ensure you have completed the cells correctly.

Generate and Execute Code

  1. In the notebook cell under "1. Define the code execution tool", fill in the TODOs to define the tool used to generate and execute the code using Gemini.

  2. In the notebook cell under "2. Define the prompt with the code to be executed", fill in the TODOs to configure content generation using Gemini code execution.

Click Check my progress to verify the objective. Generate and execute the code using Gemini 2.0 Flash.

Task 3. Implement Grounding with Google Search

In this task, you'll use Gemini 2.0 Flash with grounding to enhance the accuracy and relevance of Gemini's responses to questions about retail products.

Note: Your tasks will be labeled with a #TODO section in the cell. Read each cell carefully and ensure you are filling them out correctly! You will check your progress on this page to ensure you have completed the cells correctly.
  1. In the notebook cell under "1. Define the Google Search tool", fill in the TODOs to define the tool used to ground results with Google Search.

  2. In the notebook cell under "2. Define the prompt with grounding", fill in the TODOs to define the prompt to send to Gemini. Use Nike Air Jordan XXXVI as the product to search for.

  3. In the notebook cell under "3. Generate a response with grounding", fill in the TODOs to configure Gemini.

Click Check my progress to verify the objective. Implement grounding with Google Search to enhance Gemini 2.0 Flash responses.

Task 4. Extract Competitor Pricing and Structure Response with JSON Schema

In this task, you'll use Gemini 2.0 Flash to retrieve information about a basketball sneaker and its pricing sold by a competitor, returning the data in a structured format using a provided JSON schema.

Note: Your tasks will be labeled with a #TODO section in the cell. Read each cell carefully and ensure you are filling them out correctly! You will check your progress on this page to ensure you have completed the cells correctly.
  1. In the notebook cell under "5. Construct the search query", fill in the TODOs to configure the prompt used to query competitor product pricing.

  2. In the notebook cell under "6. Use Response Schema to extract the data", fill in the TODOs to generate a response after configuring Gemini.

Click Check my progress to verify the objective. Extract pricing by a competitor in a structured JSON schema format.

Congratulations!

Congratulations! In this challenge, you created and executed code using Gemini, enhanced Gemini responses using grounding from Google Search and structured responses to a specific output format and schema for better ecommerce outcomes.

Next steps / learn more

Check out the following resources to learn more about Gemini:

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 March 06, 2025

Lab Last Tested May 27, 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.

Before you begin

  1. Labs create a Google Cloud project and resources for a fixed time
  2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from the beginning.
  3. On the top left of your screen, click Start lab to begin

This content is not currently available

We will notify you via email when it becomes available

Great!

We will contact you via email if it becomes available

One lab at a time

Confirm to end all existing labs and start this one

Use private browsing to run the lab

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.