配置 Gemini for Google Cloud 管理员设置

本文档介绍了如何访问和使用 Gemini forGoogle Cloud 管理员设置来为项目中的所有用户配置更改。您可以使用 Google Cloud 控制台或 API 管理项目的管理员设置。

准备工作

  • 确保您的 Google Cloud 项目已关联结算账号。

为文件夹中的项目配置设置

当您为文件夹中的所有 API 启用 Gemini Cloud Assist 时,所有 Gemini Cloud Assist 设置默认处于关闭状态。您必须分别为文件夹中的每个项目修改设置。

(可选)将权限绑定到设置和目标

如果您在 Google Cloud 控制台中配置 Gemini for Google Cloud管理员设置,则可以跳过本部分。

如需使用 Gemini for Google Cloud API 配置 Gemini for Google Cloud 管理员设置,您必须先创建设置,然后创建绑定,以便将这些设置和目标(例如实例、主题或项目)“绑定”到特定产品(例如 Gemini Cloud Assist 或 Gemini Code Assist)。

创建和更新设置所需的所有权限,均需在项目级别授予。

配置 Gemini Cloud Assist,使其与 Google 共享提示和回答内容

以下部分介绍了配置 Gemini Cloud Assist 以与 Google 分享贵组织的提示和回答以改进产品所需的步骤。此设置会指示 Google 处理项目中所有 Gemini Cloud Assist 用户的提示和回答,以便改进产品,这有助于 Google 改进 Gemini Cloud Assist。

默认情况下,Google 无权记录或检查用户输入并发送到 Gemini Cloud Assist 的提示,也无权检查发回的回答内容。这会限制 Google 改进 Gemini Cloud Assist 的能力,因为我们无法更好地了解哪些主题对贵组织很重要,以及我们的回答效果如何。如果您为某个项目启用了提示和回答分享功能,Google 会将该项目提交的匿名提示和回答存储至多 180 天。贵组织的提示和回答绝不会被用于训练或微调任何 LLM 模型。

如果您启用与 Google 共享提示和回答,则可以随时访问 Google Cloud 控制台中的 Gemini 管理中心页面,以停用该功能

为 Gemini Cloud Assist 启用提示与回答共享功能

从下列选项中选择一项:

控制台

  1. 确保您在拥有订阅的项目中拥有以下 Identity and Access Management (IAM) 权限:

    • dataSharingWithGoogleSettings.create
    • dataSharingWithGoogleSettings.list
    • dataSharingWithGoogleSettings.get
    • dataSharingWithGoogleSettings.update
    • settingBindings.dataSharingWithGoogleSettingsCreate
    • settingBindings.dataSharingWithGoogleSettingsGet
    • settingBindings.dataSharingWithGoogleSettingsUpdate
    • settingBindings.dataSharingWithGoogleSettingsUse
  2. 在 Google Cloud 控制台中,前往 Gemini 管理中心页面。

    前往 Gemini for Google Cloud

    系统会加载 Gemini for Google Cloud 页面。

  3. 点击左侧导航菜单中的设置

    系统会加载设置页面。

  4. 点击启用数据共享,即可将项目中所有 Gemini Cloud Assist 用户的提示和回答内容与 Google 共享。

Google 对这些数据的使用受 Google Cloud 协议约束,包括Google Cloud 专用服务条款中的非正式版产品条款,如 Gemini for Google Cloud 可信测试员计划条款的增补内容所述。

API

如需为 Gemini Cloud Assist 启用数据共享,请使用 CreateDataSharingWithGoogleSetting 方法。

  1. 确保您在拥有订阅的项目中拥有以下 Identity and Access Management (IAM) 权限:

    • dataSharingWithGoogleSettings.create
    • dataSharingWithGoogleSettings.list
    • dataSharingWithGoogleSettings.get
    • dataSharingWithGoogleSettings.update
    • settingBindings.dataSharingWithGoogleSettingsCreate
    • settingBindings.dataSharingWithGoogleSettingsGet
    • settingBindings.dataSharingWithGoogleSettingsUpdate
    • settingBindings.dataSharingWithGoogleSettingsUse
  2. 设置项及其专用值:

    1. 获取令牌:

      TOKEN=$(gcloud auth print-access-token)
      
    2. 设置区域 API:

      REGIONAL_API="cloudaicompanion.googleapis.com"
      
    3. 运行以下命令以创建设置:

      curl -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{
          "enable_customer_data_sharing": true,
        } ' -X POST "https://$REGIONAL_API/v1/projects/CONTAINER_PROJECT_NAME/locations/global/dataSharingWithGoogleSettings?data_sharing_with_google_setting_id=SETTING_ID"
      

      替换以下内容:

      • CONTAINER_PROJECT_NAME:输入父项目 ID。
      • SETTING_ID:输入唯一的设置名称,例如输入 dswg1 作为 Data Sharing with Google 的名称。

      如果命令成功,则会返回一个回答正文,其中显示 enablePreviewDataSharing 已设置为 true

      {
        "name": "projects/CONTAINER_PROJECT_NAME
      /locations/global/dataSharingWithGoogleSettings/SETTING_ID",
        "createTime": "2025-01-23T15:22:49.717166932Z",
        "updateTime": "2025-01-23T15:22:49.717166932Z",
        "enablePreviewDataSharing": true
      }
      
  3. 创建设置绑定:

      curl \
      -H "Authorization: Bearer $TOKEN" \
      -H 'Content-Type: application/json' \
      -d '{
          "target": "projects/TARGET_PROJECT_NAME"
        }' \
      -X POST \ "https://$REGIONAL_API/v1/projects/CONTAINER_PROJECT_NAME/locations/global/dataSharingWithGoogleSettings/SETTING_ID/settingBindings?setting_binding_id=BINDING_ID"
    

    替换以下内容:

    • TARGET_PROJECT_NAME:输入应应用该设置的目标项目。
    • SETTING_ID:在创建设置时使用相同的 SETTING_ID,但在其后附加 b1。例如,对于 Data Sharing with Google,使用 dswg1b1

    如果命令成功,则会采用以下格式返回操作元数据:

    {
    "name": "projects/<var>CONTAINER_PROJECT_NAME</var>/locations/global/operations/operation-1737646069712-62c6140bb04bb-49261230-43701daf",
    "metadata": {
      "@type": "type.googleapis.com/google.cloud.cloudaicompanion.v1.OperationMetadata",
      "createTime": "2025-01-23T15:27:50.076075570Z",
      "target": "projects/<var>TARGET_PROJECT_NAME</var>/locations/global/dataSharingWithGoogleSettings/<var>SETTING_ID</var>/settingBindings/<var>BINDING_ID</var>",
      "verb": "create",
      "requestedCancellation": false,
      "apiVersion": "v1"
    },
    "done": false
    }
    

Google 对这些数据的使用受 Google Cloud 协议约束,包括Google Cloud 专用服务条款中的非正式版产品条款,如 Gemini for Google Cloud 可信测试员计划条款的增补内容所述。

停用 Gemini Cloud Assist 的提示与回答共享功能

从下列选项中选择一项:

控制台

  1. 确保您在要修改设置的项目中拥有以下 Identity and Access Management (IAM) 权限:

    • dataSharingWithGoogleSettings.list
    • dataSharingWithGoogleSettings.get
    • settingBindings.dataSharingWithGoogleSettingsGet
    • settingBindings.dataSharingWithGoogleSettingsDelete
    • settingBindings.dataSharingWithGoogleSettingsUse
  2. 在 Google Cloud 控制台中,前往 Gemini 管理中心页面。

    前往 Gemini for Google Cloud

    系统会加载 Gemini for Google Cloud 页面。

  3. 点击左侧导航菜单中的设置

    系统会加载设置页面。

  4. 点击关闭数据共享,以停止将项目中所有 Gemini Cloud Assist 用户的提示与回答内容共享给 Google。

API

如需停用 Gemini Cloud Assist 数据共享,请使用 DeleteDataSharingWithGoogleSetting 方法。

  1. 确保您在要修改设置的项目中拥有以下 Identity and Access Management (IAM) 权限:

    • dataSharingWithGoogleSettings.list
    • dataSharingWithGoogleSettings.delete
    • dataSharingWithGoogleSettings.get
    • settingBindings.dataSharingWithGoogleSettingsGet
    • settingBindings.dataSharingWithGoogleSettingsUpdate
    • settingBindings.dataSharingWithGoogleSettingsUse
  2. 针对指定的设置停用提示和回答分享功能:

    1. 获取令牌:

      TOKEN=$(gcloud auth print-access-token)
      
    2. 设置区域 API:

      REGIONAL_API="cloudaicompanion.googleapis.com"
      
    3. 运行以下命令以停用该设置:

      curl -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{
          "enable_customer_data_sharing": false,
        } ' -X PATCH "https://$REGIONAL_API/v1/projects/CONTAINER_PROJECT_NAME/locations/global/dataSharingWithGoogleSettings?data_sharing_with_google_setting_id=SETTING_ID"
      

      只有在您启用提示和回答共享时该设置资源就已存在的情况下,此 PATCH 命令才会成功执行。

      替换以下内容:

      • CONTAINER_PROJECT_NAME:输入父项目 ID。
      • SETTING_ID:输入现有设置名称,例如输入 dswg1 作为 Data Sharing with Google 的名称。

      如果命令成功,则会返回一个回答正文,其中显示 enablePreviewDataSharing 已设置为 false

      {
        "name": "projects/CONTAINER_PROJECT_NAME
      /locations/global/dataSharingWithGoogleSettings/SETTING_ID",
        "createTime": "2025-01-23T15:22:49.717166932Z",
        "updateTime": "2025-01-23T15:22:49.717166932Z",
        "enablePreviewDataSharing": false
      }
      

后续步骤