
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 the BigQuery dataset
/ 25
Create the external connection
/ 25
Create a remote ML model
/ 25
Generate text using the ML model
/ 25
In this lab, you take steps to perform summarization of source code from GitHub, a popular open-source, source code repository, and identify the primary programming language using Vertex AI's Large Language Model (LLM) for text generation and hosted remote functions in BigQuery. The source data is from the GitHub Archive Project, which contains a full snapshot of over 2.8 million open source GitHub repositories in Google BigQuery Public Datasets.
In this lab, you learn how to create:
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.
You will be using the source code content from the github_repos
dataset in the Google BigQuery Public Datasets. To do so, do the following:
From the Navigation menu choose BigQuery. If prompted click Done.
In the BigQuery console, search for github_repos
and press ENTER.
github_repos
dataset after performing a search you may need to select SEARCH ALL PROJECTS to add the dataset.github_repos
dataset and select the sample_contents
table. This table contains sample data containing 10% of the full data in the contents table. Click PREVIEW.A BigQuery dataset is a collection of tables. All tables in a dataset are stored in the same data location.
The dataset is going to be used to house the model that you create in the next tasks of this lab.
Typically, data that is used by an ML application is stored in a table in the dataset as well. Since the data is in a BigQuery public dataset, you reference that data directly from the public data using an external connection. You create the external connection in the next task of this lab.
Click Check my progress to verify the objective.
Now, create an external connection and save the Service Account ID from the connection configuration details.
Click the + ADD button on the BigQuery Explorer pane, then click Connections to external data sources in the popular sources listed.
Select Connection type as Vertex AI remote models, remote functions and BigLake (Cloud Resource)
and set Connection ID to llm-connection
.
Click CREATE CONNECTION.
Select us.llm-connection
under the External connections section of the project's datasets. Copy the Service Account ID generated from the external connection configuration details to your clipboard. You use it in the next step.
You need to grant the Service Account generated by the external connection access to the Vertex AI service. To do so:
From the Navigation menu select IAM & Admin.
Click + GRANT ACCESS on the IAM page.
Paste the Service Account ID generated by the external connection in the New principals form input.
Set the Role to Vertex AI User
then click SAVE.
Click Check my progress to verify the objective.
In this task, you create a remote model that represents a hosted Vertex AI large language model (LLM).
From the Navigation menu select BigQuery. Click on + Compose new query.
Run the following SQL query in a new tab in BigQuery Explorer:
This creates a model named llm_model
in the dataset bq_llm
created earlier in the lab. The model leverages the gemini-1.5-pro
of Vertex AI as a remote endpoint. Once completed you see the model appear in the BigQuery console.
Click Check my progress to verify the objective.
Use the ML model created to generate, summarize, or categorize text.
ml_generate_text_result
is the response from the text generation model in JSON format that contains both content and safety_ratings attributes:
ML.GENERATE_TEXT is the construct used in BigQuery to access the Vertex AI LLM to perform text generation tasks.
CONCAT appends the supplied PROMPT statement to a database record.
github_repos
is the public dataset name and sample_contents
is the name of the table that holds the data you use in the prompt design.
Temperature is the prompt parameter to control the randomness of the response - the lesser, the better the relevance.
Max_output_tokens is the number of words you want in response.
The query response should look similar to the following:
Click Check my progress to verify the objective.
Congratulations! You have successfully used a Vertex AI Text Generation LLM programmatically to perform text analytics on your data using only SQL-queries. Check out Vertex AI LLM product documentation to learn more about available models.
...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: August 23, 2024
Lab Last Tested: August 23, 2024
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.
このコンテンツは現在ご利用いただけません
利用可能になりましたら、メールでお知らせいたします
ありがとうございます。
利用可能になりましたら、メールでご連絡いたします
One lab at a time
Confirm to end all existing labs and start this one