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
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 Agent Platform. 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 Skills.
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 right is the Lab setup and access panel with the following:
Note that the lab timer is located near the top of the page, showing the remaining time.
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 setup and access panel.
Click Next.
Copy the Password below and paste it into the Welcome dialog.
You can also find the Password in the Lab setup and access panel.
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 Agent Platform 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.
Click Done in the Welcome to BigQuery in the Cloud Console dialog.
Switch to Explorer, click + Add data, and then use the search bar for data sources to search for Agent Platform. Click on the result for Agent Platform > BigQuery Federation.
In the Connection type dropdown, select Agent Platform remote models, remote functions, Lakehouse and Spanner (Cloud Resource).
Type embedding_conn for Connection ID.
Click Create connection.
After creating the connection, return to BigQuery > Explorer. Then navigate to Connections, select embedding_conn, and copy the Service Account ID. You’ll need this ID later to grant the required permissions to the account.
To use BigQuery data and Agent Platform resources, grant the service account the necessary IAM permissions.
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.
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 May 18, 2026
Lab last tested April 29, 2026
Copyright 2026 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
Complete this quick step to start your lab.