Create Agent Platform Notebooks instance

Check my progress

/ 50

Clone a course repo within your Agent Platform Workbench instance

Check my progress

/ 50

This lab may incorporate AI tools to support your learning.

總覽

本實驗室說明如何檢查 Agent Platform Gemini API 回傳的安全評分,以及如何設定安全門檻來篩選回覆。

學習目標

  1. 呼叫 Agent Platform Gemini API,並檢查回覆的安全評分
  2. 依據需求定義安全評分篩選門檻

設定和需求

每個實驗室都會提供新的 Google Cloud 專案和一組資源,讓您在時限內免費使用。

  1. 請以無痕視窗登入 Google Skills。

  2. 請記下實驗室時間限制 (例如 1:15:00),務必在時限內完成作業。
    研究室不提供暫停功能。如有需要,您可以重新開始,但原先的進度恕無法保留。

  3. 準備就緒後,請按一下「Start lab」

  4. 請記下研究室憑證 (使用者名稱密碼),這組資訊將用於登入 Google Cloud 控制台。

  5. 按一下「Open Google Console」

  6. 按一下「Use another account」,然後複製這個研究室的憑證,並貼入提示訊息。
    如果使用其他憑證,系統會顯示錯誤或向您收取費用

  7. 接受條款,然後略過資源復原頁面。

工作 1:啟動 Agent Platform Workbench 執行個體

  1. 前往 Google Cloud 控制台,依序選取「導覽選單」圖示 導覽選單 >「Vertex AI」>「資訊主頁」。

  2. 點選「啟用所有建議的 API」

  3. 從「導覽選單」點選「Workbench」

    在「Workbench」頁面頂端,確認您位於「執行個體」檢視頁面。

  4. 點選「建立新項目」新增方塊

  5. 設定執行個體

    • 名稱:lab-workbench
    • 區域:設為
    • 可用區:設為
    • 進階選項 (選用):需要時點選「進階選項」,進一步自訂機型和磁碟大小等。

建立 Vertex AI Workbench 執行個體

  1. 點選「建立」

建立執行個體需要幾分鐘。完成後,名稱旁會出現綠色勾號。

  1. 點選執行個體名稱旁的「Open JupyterLab」,開啟 JupyterLab 介面,接著瀏覽器就會開啟新分頁。

已部署 Workbench 執行個體

點按「Check my progress」,確認目標已達成。 建立 Agent Platform Workbench 執行個體

工作 2:複製 Agent Platform Workbench 執行個體中的課程存放區

請按照下列步驟操作,複製 JupyterLab 執行個體中的筆記本:

  1. 在 JupyterLab 開啟新的終端機視窗。

  2. 在指令列提示詞中執行下列指令:

git clone https://github.com/GoogleCloudPlatform/asl-ml-immersion.git cd asl-ml-immersion export PATH=$PATH:~/.local/bin make install
  1. 如要確認是否已複製存放區,請按兩下 asl-ml-immersion 目錄,確認可以查看內容。 此課程會用到的所有 Jupyter 筆記本實驗室檔案,都放在這個目錄。

點按「Check my progress」,確認目標已達成。 複製 Agent Platform Notebooks 執行個體中的課程存放區

工作 3:透過 Gemini API 採取保護措施

  1. 在筆記本介面中,依序前往「asl-ml-immersion」>「asl_core」>「notebooks」>「responsible_ai」>「safety」>「solutions」,然後開啟「gemini_safety_ratings.ipynb」

  2. 如果出現「Select Kernel」對話方塊,請選取「Python 3 (Local)」

  3. 在筆記本介面中,依序點按「Edit」>「Clear Outputs of All Cells」

  4. 詳閱筆記本的操作說明,然後執行當中所有內容。

提示:如要執行目前的儲存格,請點按儲存格,然後按下 Shift + Enter 鍵。如需其他儲存格指令,請查看筆記本 UI 中的「Run」部分。

關閉研究室

完成實驗室後,請按一下「End Lab」。Google Skills 會移除您使用的資源,並清除所用帳戶。

您可以為實驗室的使用體驗評分。請選取合適的星級評等並提供意見,然後按一下「Submit」

星級評等代表您的滿意程度:

  • 1 星 = 非常不滿意
  • 2 星 = 不滿意
  • 3 星 = 普通
  • 4 星 = 滿意
  • 5 星 = 非常滿意

如果不想提供意見回饋,您可以直接關閉對話方塊。

如有任何想法、建議或指教,請透過「Support」分頁提交。

Copyright 2026 Google LLC 保留所有權利。Google 和 Google 標誌是 Google LLC 的商標,其他公司和產品名稱則有可能是其關聯公司的商標。

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

Use private browsing

  1. Copy the provided Username and Password for the lab
  2. Click Open console in private mode

Sign in to the Console

  1. Sign in using your lab credentials. Using other credentials might cause errors or incur charges.
  2. Accept the terms, and skip the recovery resource page
  3. Don't click End lab unless you've finished the lab or want to restart it, as it will clear your work and remove the project

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

Using an Incognito or private browser window is the best way 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.

Complete this quick step to start your lab.