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
Create a source connection and grant IAM permissions
/ 30
Generate embeddings
/ 40
Search the vector space and retrieve the similar items
/ 10
Generate the enhanced response with data retrieved from the vector search
/ 20
Concerned about AI hallucinations? While AI can be a valuable resource, it sometimes generates inaccurate, outdated, or overly general responses - a phenomenon known as "hallucination." This lab teaches you how to implement a Retrieval Augmented Generation (RAG) pipeline to address this issue. RAG improves large language models (LLMs) like Gemini by grounding their output in contextually relevant information from a specific dataset.
Assume you are helping Coffee-on-Wheels, a pioneering mobile coffee vendor, analyze customer feedback on its services. Without access to the latest data, Gemini's responses might be inaccurate. To solve this problem, you decide to build a RAG pipeline that includes three steps:
BigQuery allows seamless connection to remote generative AI models on Vertex AI. It also provides various functions for embeddings, vector search, and text generation directly through SQL queries or Python notebooks.
For a deeper dive, check out the course Create Embeddings, Vector Search, and RAG with BigQuery on Google Cloud Skills Boost.
To complete this lab, you should be familiar with BigQuery and SQL coding.
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.
To use remote generative AI models on Vertex AI in BigQuery, like Gemini and an embedding model, create a new external source connection.
In the Google Cloud console, on the Navigation menu (), click BigQuery.
Switch to Explorer, click + Add data, and then use the search bar for data sources to search for Vertex AI. Click on the result for Vertex AI > BigQuery Federation.
In the Connection type dropdown, select Vertex AI remote models, remote functions, BigLake and Spanner (Cloud Resource).
In the Connection ID field, enter embedding_conn.
Click Create connection.
Once the connection is created, click on Go to connection in the pop-up confirmation to navigate to the connection and copy the Service account id value. You need it later to assign permissions to this account.
To use BigQuery data and Vertex AI resources, grant the service account the necessary IAM permissions.
Vertex AI API, click the Enable button.Click Check my progress to verify the objective.
In the Google Cloud console, on the Navigation menu (), navigate to BigQuery.
In Explorer, navigate to the three dots besides the project, click Create dataset. For Dataset ID, enter CustomerReview. Keep the other option by default, and click Create dataset.
To connect to the embedding model, run the following SQL query in the query editor:
(optional) To check the uploaded data in the table, click Go to table. Find the schema of the table and preview the data.
To generate embeddings from recent customer feedback and store them in a table, run the following SQL query in the query editor:
Click Check my progress to verify the objective.
Click Check my progress to verify the objective.
To connect to the Gemini model, run the following SQL query:
To enhance Gemini's responses, provide it with relevant and recent data retrieved from the vector search by running the following query:
Click Check my progress to verify the objective.
To help Coffee-on-Wheels gain insights from customer feedback on its services, you successfully implemented a RAG pipeline in BigQuery, providing Gemini with relevant and up-to-date information. You connected to remote generative AI models, including an embedding model and Gemini, and followed three steps: creating embeddings, searching a vector space, and generating an improved answer. The goal is to enable you to apply this same approach to address your own AI hallucination challenges.
...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 November 20, 2025
Lab last tested November 20, 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