與 Gemini 討論筆記本內容

本文說明如何使用 Gemini in Colab Enterprise (Gemini for Google Cloud 系列產品之一),與筆記本進行對話。

瞭解 Gemini for Google Cloud 如何使用您的資料,以及使用時機

本文件適用於使用 Colab Enterprise 的資料分析師、數據資料學家和資料開發人員。本文假設您已瞭解如何在筆記本環境中編寫程式碼。

總覽

你可以與 Gemini 討論可能的程式碼解決方案,或瞭解如何在筆記本中執行特定工作。您也可以在筆記本中取得程式碼說明。

舉例來說,您可以從下列類似的提示開始:

  • 如何篩選 Pandas DataFrame?
  • 如何在 Colab Enterprise 中建立繪圖?
  • 顯示公開資料集清單。
  • 總結這個筆記本的用途。

Gemini 會將筆記本內容做為脈絡資訊,你可以討論相關細節、取得程式碼改善建議,或獲得下一步的嘗試方向。

事前準備

  1. 確認您已為 Google Cloud 使用者帳戶和專案設定 Gemini 版 Colab Enterprise。
  2. Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
  3. Enable the Vertex AI, Cloud AI Companion, Dataform, and Compute Engine APIs.

    Enable the APIs

  4. Enable the Vertex AI, Cloud AI Companion, Dataform, and Compute Engine APIs.

    Enable the APIs

  5. 必要的角色

    如要取得使用 Gemini in Colab Enterprise 所需的權限,請要求管理員將專案的下列 IAM 角色授予您:

    如要進一步瞭解如何授予角色,請參閱「管理專案、資料夾和機構的存取權」。

    您或許還可透過自訂角色或其他預先定義的角色取得必要權限。

    使用即時通訊

    如要與 Gemini 討論筆記本內容,請按照下列步驟操作:

    1. 在 Google Cloud 控制台中,前往 Colab Enterprise 的「My notebooks」(我的筆記本) 頁面。

      前往「我的筆記本」

    2. 在「Region」(區域) 選單中,選取包含筆記本的區域。

    3. 按一下要開啟的筆記本。

    4. 在工具列中,按一下「顯示 Gemini」按鈕 開啟對話方塊。

    5. Gemini 對話方塊中輸入提示,開始對話。

    6. Gemini 會根據提示回覆。回覆內容可能包括程式碼片段、筆記本的一般建議,或有助於解答問題的一般資訊。

      評估內容後,您可以採取下列動作:

      • 如要複製建議的程式碼片段,請按一下「複製」按鈕。然後將程式碼貼到筆記本的程式碼儲存格。
      • 如要將建議的程式碼片段新增為筆記本中的新程式碼儲存格,請按一下「新增程式碼儲存格」按鈕。
      • 視需要提出後續問題,繼續討論。
    7. 如要關閉「Gemini」對話方塊,請按一下「關閉」圖示

    停用 Gemini in Colab Enterprise

    如要為專案停用 Gemini in Colab Enterprise,管理員必須停用 Gemini for Google Cloud API。 Google Cloud 請參閱「停用服務」。

    如要為特定使用者停用 Gemini in Colab Enterprise,管理員必須撤銷該使用者的「Gemini for Google Cloud 使用者」 (roles/cloudaicompanion.user) 角色。請參閱撤銷單一身分與存取權管理角色

    後續步驟