
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
Grant IAM roles to the BigQuery service account
/ 25
Create a new BigQuery remote model
/ 25
Create an embeddings table for images listed in an object table
/ 25
Run a vector search on product images in Cloud Storage
/ 25
Imagine you want to search a catalog of product images stored in Cloud Storage to determine whether a similar product has been sold in the past. You can do this by leveraging vector search in BigQuery!
BigQuery is a fully managed, AI-ready data platform that supports seamless integration of external data sources (such as metadata from images in a Cloud Storage bucket) and connections to remote models for vector search to enhance your data analysis workflows with generative AI.
Vector search is a methodology that can be used to quickly find similar items based on their semantic meaning (rather than exact keyword matching) and can be applied to many types of data including images, videos, and text. Vector search uses embeddings which are high-dimensional numerical vectors that represent an entity, such as text or an image. These embeddings encode semantics about these entities to make it easier to compare them. This has many applications such as enhanced ability to search historical sales of similar items in an inventory dataset or product image catalog.
Given a product name or description, you can use vector search on a BigQuery object table containing metadata for the product images and identify the most closely related products to your search terms. This workflow integrates the power of Vertex AI into BigQuery for vector search, which enables you to analyze multimodal data (including images and text) in BigQuery to extract actionable insights, thereby enhancing decision-making capabilities.
In this lab, you get a quick introduction to how multimodal vector search works in BigQuery. You start by granting some permissions and creating a connection to an embeddings model in BigQuery. Then, you call the model to generate an embeddings table to store vector representations of product images in a Cloud Storage bucket. Last, you run a vector search on product images stored in Cloud Storage to identify the most similar products to your search terms based on image features and metadata.
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 lab environment, several resources have been pre-created including a BigQuery external connection named remote-models-connection and a BigQuery object table named image_object_table. These resources allow you to access and query unstructured data in Cloud Storage such as images. When the external connection was created, a BigQuery service account was also auto-generated, which can be used to control access to resources.
In this task, you grant specific IAM roles to the auto-generated BigQuery service account to access the image files in Cloud Storage and the Vertex AI resources needed for vector search.
In the Google Cloud console, on the Navigation menu (), select BigQuery > Studio.
Expand the arrow next to the project id (
Click on the connection named
On the Connection info page, copy the Service account ID for use in the next step.
For example: bqcx-1054723899402-whbp@gcp-sa-bigquery-condel.iam.gserviceaccount.com
In the Google Cloud console, on the Navigation menu (), select IAM & Admin > IAM.
Click Grant access.
For New principals, enter the service account ID you copied in the previous section (such as bqcx-1054723899402-whbp@gcp-sa-bigquery-condel.iam.gserviceaccount.com
).
For Select a role, filter for Vertex AI User, and select it from the results.
Click Add another role.
For Select a role, filter for Storage Object Viewer, and select it from the results.
Click Save.
Click Check my progress to verify the objective.
Now that you have granted the necessary roles to the BigQuery service account, you can create a remote model in BigQuery to access Vertex AI functionality such as generative AI features.
In this task, you use the BigQuery external connection named remote-models-connection to create a remote model named embeddings_model that connects to an embeddings model available in Vertex AI. Because your image data is stored in a Cloud Storage bucket in an unstructured format, you want to designate a multimodal model as the endpoint to handle this type of data effectively.
In the Google Cloud console, on the Navigation menu (), select BigQuery > Studio.
In the SQL query window, paste the following SQL query to create the BigQuery remote model in the existing BigQuery dataset named products, and click Run:
Click Check my progress to verify the objective.
After creating a remote model in BigQuery, the next step is to call the model to generate the embeddings based on the image files stored in Cloud Storage. As mentioned in Task 1, an object table named image_object_table has been pre-created for this lab environment and can be used to query the image files.
In this task, you call the embeddings model to run on product_image_object_table and store the results in a new table named product_embeddings. When executing the query, BigQuery submits the data in the object table to the multimodal embeddings model, which returns the embeddings that can be used for vector searches to find semantically similar entities.
Click Check my progress to verify the objective.
Recall from the overview of this lab that vector search in BigQuery allows you to use calculated embeddings (which are numerical vectors) to find semantically similar objects. Specifically, vector search uses distance metrics that represent the distance between vectors in an embeddings space to compare and rank them by similarity. In BigQuery, the vector search function supports three distance types including Euclidean (which is the default), cosine, and dot product.
In this task, you use cosine similarity (which is the cosine of the angle between two vectors) to identify the top 3 most similar product images in Google Cloud Storage to a specific search phrase: colorful sweaters for women.
VECTOR_SEARCH
function to search the product embeddings table and find the most similar images to the provided search term:[Optional] To see the specific images that have been returned as the highest matches, you can go to the Cloud Storage bucket, and open each image.
In the Google Cloud console, on the Navigation menu (), select Cloud Storage > Buckets.
Click on the bucket named Onesie.jpg
).
Click on the Authenticated URL to see the image (such as https://storage.cloud.google.com/qwiklabs-gcp-04-dc2812426125/Onesie.jpg
).
Click Check my progress to verify the objective.
In this lab, you received a quick introduction to vector search in BigQuery and used it to find images in Cloud Storage that are most related to a desired search term.
For more information about object tables in BigQuery, review the documentation titled Create object tables.
For a deeper dive into vector embeddings, review the course titled Vector Search and Embeddings.
For more hands-on experience with embeddings and vector search in BigQuery, explore the labs in the course titled Implement Multimodal Vector Search with BigQuery.
...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 July 7, 2025
Lab Last Tested July 7, 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