
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
Generate examples of text with personally identifiable information (PII).
/ 20
Define a Python function to deidentify Gemini 1.5 Pro model responses using built-in global infotypes
/ 10
Generate and de-identify example text with more personally identifiable information.
/ 20
Generate example text with credit card information using Gemini 1.5 Pro model.
/ 10
Test your skills using the built-in global infoType for credit card number.
/ 10
Revise the Python function to block Gemini 1.5 Pro model responses.
/ 10
Generate an example with source code using Gemini 1.5 Pro model.
/ 10
Test your skills using the built-in document infoType for patents.
/ 10
Sensitive Data Protection is a fully managed service designed to help you discover, classify, and protect sensitive information. Key options include Sensitive Data Discovery for continuously profiling your sensitive data, de-identification of sensitive data including redaction, and Cloud Data Loss Prevention (DLP) API to let you build in discovery, inspection, and de-identification into custom workloads and applications.
In addition to identifying and protecting sensitive data in data storage options such as Cloud Storage and BigQuery, you can also identify and protect sensitive data that is returned from Generative AI models. Very useful for mitigating sensitive data concerns across your whole ecosystem!
In this lab, you leverage this ability through a Jupyter notebook that employs the Cloud Data Loss Prevention (DLP) API to classify and redact sensitive data in Gemini 2.0 Flash model responses.
In this lab, you learn how to:
While not required, it is helpful to have some previous knowledge about how Vertex AI and Cloud Data Loss Prevention (DLP (API) are commonly used within Google Cloud workflows. For an introduction to these tools before you begin this lab, you can complete the following labs:
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 the Google Cloud console, on the Navigation menu (), click Vertex AI > Workbench.
Find the
The JupyterLab interface for your Workbench instance opens in a new browser tab.
Note: You can run any cell in a Python notebook by clicking Run the selected cells (play arrow icon) at the top of the notebook.
Review more information about using Jupyter notebooks in Vertex AI Workbench instances in the documentation.Click on the
Run each cell in the Getting started with this notebook section of the notebook.
Be sure to provide the Project ID and Location as follows:
The sections identified in this task follow the sections outlined in the notebook. Complete the steps in the notebook as instructed below and return to this lab page to check your progress after completing each notebook section.
Click Check my progress to verify the objective.
Click Check my progress to verify the objective.
Click Check my progress to verify the objective.
Click Check my progress to verify the objective.
Expand the hints below for some helpful steps!
Option 1: Review the docs
Full solution (Expand to see the full code!)
Click Check my progress to verify the objective.
The sections identified in this task follow the sections outlined in the notebook. Complete the steps in the notebook as instructed below and return to this lab page to check your progress after completing each notebook section.
Click Check my progress to verify the objective.
Click Check my progress to verify the objective.
Expand the hints below for some helpful steps!
Option 1: Review the previous section in the notebook
Full solution (Expand to see the full code!)
Click Check my progress to verify the objective.
In this lab, you used the Vertex AI and Cloud Data Loss Prevention (DLP) APIs in a Jupyter notebook to generate and redact example sensitive data in Gemini 2.0 Flash model responses using the DLP API.
Check out the following resources to learn more about the Cloud Data Loss Prevention (DLP) API:
...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 31, 2025
Lab Last Tested March 31, 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.
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