Loading...
No results found.

Google Cloud Skills Boost

Apply your skills in Google Cloud console

Inspect Rich Documents with Gemini Multimodality and Multimodal RAG

Get access to 700+ labs and courses

Inspect Rich Documents with Gemini Multimodality and Multimodal RAG: 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

GSP520

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 Inspect Rich Documents with Gemini Multimodality and Multimodal RAG skill badge. Are you ready for the challenge?

Topics tested

  • Using multimodal prompts to extract information from text and visual data, generating a video description, and retrieving extra information beyond the video by using multimodality with Gemini
  • Building metadata of documents containing text and images, getting all relevant text chunks, and printing citations by using Multimodal Retrieval Augmented Generation (RAG) with Gemini

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.

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.

Set up the notebook

  1. Click on the file.

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

  3. Run through the 4 cells in the Setup and requirements section of the notebook (before you get to Task 1).

  4. Use the following information to initialize the Gen AI SDK for Python for your project:

    • For Project ID, enter
    • For Location, enter

Challenge scenario

You are a Marketing Campaign Coordinator at a media company, working closely with the Marketing Manager to plan, execute, and evaluate campaigns to meet sales targets. Recently, you secured an exciting new contract with Google. As a Marketing Campaign Coordinator, you’re eager to dive into the materials that will help you familiarize yourself with the Google brand and Google brand identity as quickly as possible. Therefore, you plan to review Google’s brand guidelines, previous campaigns, product ads, customer testimonials, and financial reports by leveraging Gemini’s innovative capabilities to gain deeper insights into Google more efficiently.

In this challenge, you begin with multimodal prompts to extract information from text and visual data, generating a video description, and retrieving extra information beyond the video by using multimodality with Gemini. You also build metadata of documents containing text and images, getting all relevant text chunks, and printing citations by using Multimodal Retrieval Augmented Generation (RAG) with Gemini.

Task 1. Generate multimodal insights with Gemini

In this task, you familiarize yourself with the Google brand and Google brand identity using Gemini, which is a multimodal model that supports multimodal prompts. You include text, image(s), and video in your prompt requests and get text or code responses.

To complete this task, follow the instructions in the specified sections of the notebook.

Note: Save the notebook script before clicking on the Check my progress button for every task.
  1. To study multiple images using a multimodal model, follow the instructions in the Image understanding across multiple images section.

To verify the objective, click Check my progress. Image understanding across multiple images.

  1. To compare images using a multimodal model, follow the instructions in the Similarities/Differences between images section.

To verify the objective, click Check my progress. Similarities/Differences between images.

  1. To generate a video description using a multimodal model, follow the instructions in the Generate a video description section.

    Use [https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4](https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4) to complete this step.
  2. To extract object tags throughout a video using a multimodal model, follow the instructions in the Extract tags of objects throughout the video section.

    Use [https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4](https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4), to complete this step.
  3. To further explore the video using a multimodal model, follow the instructions in the Ask more questions about a video section.

    Use [https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4](https://storage.googleapis.com/spls/gsp520/google-pixel-8-pro.mp4) to complete this step.
  4. To get even more information from images using a multimodal model, follow the instructions in the Retrieve extra information beyond the video section.

To verify the objective, click Check my progress. Generate a video description and retrieve extra information beyond the video.

Task 2. Retrieve and integrate knowledge with multimodal retrieval augmented generation (RAG)

To complete this task, follow the instructions in the specified sections of the notebook.

Available data and helper functions to use for Task 2:

  • The Terms of Service document for Google's services, defining the relationship between Google and its users. It covers what users can expect from Google, the rules for using the services, intellectual property rights related to content, and the procedures for resolving disputes or disagreements. This sample document contains only text.

  • A modified version of Google-10K which provides a comprehensive overview of the company's financial performance, business operations, management, and risk factors. As the original document is rather large, you use a modified version with only 14 pages, split into two parts - Part 1 and Part 2 instead. Although it's truncated, this sample document still contains text along with images such as tables, charts, and graphs.

You also select from the following helper functions to complete tasks below. For more information on these functions, refer to GitHub):

  • For the inspect the processed text metadata function:

    • text: The original text from the page.
    • text_embedding_page: The embedding of the original text from the page.
    • chunk_text: The original text divided into smaller chunks.
    • chunk_number: The index of each text chunk.
    • text_embedding_chunk: The embedding of each text chunk.
  • For the inspect the processed image metadata function:

    • img_desc: Gemini-generated textual description of the image.
    • mm_embedding_from_text_desc_and_img: Combined embedding of image and its description, capturing both visual and textual information.
    • mm_embedding_from_img_only: Image embedding without description, for comparison with description-based analysis.
    • text_embedding_from_image_description: Separate text embedding of the generated description, enabling textual analysis and comparison.
  • For the import the helper functions to implement RAG function:

    • get_similar_text_from_query(): Given a text query, finds text from the document which are relevant, using cosine similarity algorithm. It uses text embeddings from the metadata to compute. The results can be filtered by top score, page/chunk number, or embedding size.
    • print_text_to_text_citation(): Prints the source (citation) and details of the retrieved text from the get_similar_text_from_query() function.
    • get_similar_image_from_query(): Given an image path or an image, finds images from the document which are relevant. It uses image embeddings from the metadata.
    • print_text_to_image_citation(): Prints the source (citation) and the details of retrieved images from the `get_similar_image_from_query()`` function.
    • get_gemini_response(): Interacts with a Gemini model to answer questions based on a combination of text and image inputs.
    • display_images(): Displays a series of images provided as paths or PIL Image objects.
  1. To import and run helper functions, follow the instructions in the Build metadata of documents containing text and images section.

  2. To work with the provided variables, follow the instructions in the Create a user query section.

  3. To retrieve relevant chunks of text based on the query, follow the instructions in the Get all relevant text chunks section.

  4. To organize the chunks of text, follow the instructions in the Create context text.

  5. To pass the context to Gemini and generate a response, follow the instructions to Pass context to Gemini.

To verify the objective, click Check my progress. Retrieve and integrate knowledge with multimodal retrieval augmented generation (RAG).

Congratulations!

By completing this challenge lab, you demonstrated you can leverage Gemini APIs to generate text, create function calls, and describe video contents. Your work ensured that these features met the expected standards before deployment to production. Well done!

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 May 23, 2025

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

Previous Next

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.
Preview