创建在线存储区实例

如需设置在线传送,您需要先为 Bigtable 在线传送或优化的在线传送(预览版)创建在线存储区实例。

使用优化的在线传送时,您可以将在线存储区配置为从公共端点或专用 Private Service Connect 端点传送特征。如果您希望以低于公共端点的延迟在 VPC 网络中传送特征,请使用 Private Service Connect 端点。

请注意,创建在线存储区时,选择 Bigtable 在线传送或优化的在线传送后,您便无法更改在线传送的类型。但是,您可以更改为优化的在线传送创建的在线存储区实例的服务端点配置。

创建在线存储区后,您可以添加特征视图,并将这些特征视图与 BigQuery 中的特征数据源关联。

为在线存储区配置嵌入管理

借助 Vertex AI Feature Store,您可以使用在线存储区内特征视图中的嵌入来执行向量相似度搜索。如需执行向量相似度搜索,您需要使用 FeatureOnlineStore.embedding_management 参数将在线存储区实例配置为支持嵌入管理,然后为在线存储区中的至少一个特征视图配置向量检索。

如需详细了解如何在 Vertex AI Feature Store 中使用嵌入搜索近似最近邻,请参阅使用嵌入进行搜索

为 Bigtable 在线传送创建在线存储区

使用以下示例创建在线存储区实例,用于通过自动扩缩进行 Bigtable 在线传送。

控制台

请按照以下说明使用 Google Cloud 控制台创建在线存储区,用于 Bigtable 在线传送。

  1. 在 Google Cloud 控制台的“Vertex AI”部分,转到 Feature Store 页面。

    转到 Feature Store 页面

  2. 点击在线存储区以转到在线存储区部分。

  3. 点击创建,打开创建在线存储区页面。

  4. 指定在线存储区的名称。

  5. 可选:若要添加标签,请点击添加标签,然后指定标签名称和值。您可以为在线存储区添加多个标签。

  6. 为您的在线存储区选择存储解决方案字段中,点击 Bigtable

  7. 根据需要修改节点数下限节点数上限CPU 利用率目标

  8. 点击创建

REST

如需创建 FeatureOnlineStore 资源,请使用 featureOnlineStores.create 方法发送 POST 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:要在其中创建在线存储区的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。
  • FEATUREONLINESTORE_NAME:新的在线存储区实例的名称。

HTTP 方法和网址:

POST https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME

请求 JSON 正文:

{
  "bigtable": {
    "auto_scaling": {
      "min_node_count": 1,
      "max_node_count": 3,
      "cpu_utilization_target": 50
    }
  }
}

如需发送请求,请选择以下方式之一:

curl

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME"

PowerShell

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1.CreateFeatureOnlineStoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-18T17:49:23.847496Z",
      "updateTime": "2023-09-18T17:49:23.847496Z"
    }
  }
}

为通过嵌入管理进行 Bigtable 在线传送创建在线存储区

使用以下示例为通过嵌入管理进行 Bigtable 在线传送创建在线存储区实例。

REST

如需创建 FeatureOnlineStore 资源,请使用 featureOnlineStores.create 方法发送 POST 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:要在其中创建在线存储区的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。
  • FEATUREONLINESTORE_NAME:新的在线存储区实例的名称。
  • BOOLEAN(可选):如需创建支持嵌入管理的在线存储区,请输入 true。默认值为 false

HTTP 方法和网址:

POST https://LOCATION_ID-aiplatform.googleapis.com/v11/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME

请求 JSON 正文:

{
  "bigtable": {
    "auto_scaling": {
      "min_node_count": 1,
      "max_node_count": 3,
      "cpu_utilization_target": 50
    }
  }
  "embedding_management": {
    "enabled": BOOLEAN
  }
}

如需发送请求,请选择以下方式之一:

curl

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v11/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME"

PowerShell

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v11/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateFeatureOnlineStoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-18T17:49:23.847496Z",
      "updateTime": "2023-09-18T17:49:23.847496Z"
    }
  }
}

为通过公共端点进行优化的在线传送创建在线存储区

使用以下示例创建在线存储区,用于通过公共端点进行优化的在线传送。

网页界面

请按照以下说明使用 Google Cloud 控制台创建在线存储区,用于优化的在线传送。

  1. 在 Google Cloud 控制台的“Vertex AI”部分,转到 Feature Store 页面。

    转到 Feature Store 页面

  2. 点击在线存储区以转到在线存储区部分。

  3. 点击创建,打开创建在线存储区页面。

  4. 指定在线存储区的名称。

  5. 可选:若要添加标签,请点击添加标签,然后指定标签名称和值。您可以为在线存储区添加多个标签。

  6. 为您的在线存储区选择存储解决方案字段中,点击优化

  7. 点击创建

REST

如需创建在线存储区实例,请使用 featureOnlineStores.create 方法发送 POST 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:要在其中创建 FeatureOnlineStore 实例的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。
  • FEATUREONLINESTORE_NAME:新 FeatureOnlineStore 实例的名称。

HTTP 方法和网址:

POST https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME

请求 JSON 正文:

{
  "optimized": {}
}

如需发送请求,请选择以下方式之一:

curl

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME"

PowerShell

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateFeatureOnlineStoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-18T17:49:23.847496Z",
      "updateTime": "2023-09-18T17:49:23.847496Z"
    }
  }
}

为通过 Private Service Connect 端点进行优化的在线传送创建在线存储区

使用以下示例为通过 Private Service Connect 进行优化的在线传送创建在线存储区。

REST

如需创建在线存储区实例,请使用 featureOnlineStores.create 方法发送 POST 请求。

在使用任何请求数据之前,请先进行以下替换:

  • LOCATION_ID:要在其中创建 FeatureOnlineStore 实例的区域,例如 us-central1
  • PROJECT_ID:您的项目 ID。
  • FEATUREONLINESTORE_NAME:新 FeatureOnlineStore 实例的名称。

HTTP 方法和网址:

POST https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME

请求 JSON 正文:

{
  "optimized": {},
  "dedicated_serving_endpoint": {
    "private_service_connect_config": {
      "enable_private_service_connect": true,
      "project_allowlist": ["PROJECT_NAME"]
    }
  }
}

如需发送请求,请选择以下方式之一:

curl

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME"

PowerShell

将请求正文保存在名为 request.json 的文件中,然后执行以下命令:

$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }

Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION_ID-aiplatform.googleapis.com/v1beta1/projects/PROJECT_ID/locations/LOCATION_ID/featureOnlineStores?feature_online_store_id=FEATUREONLINESTORE_NAME" | Select-Object -Expand Content

您应该收到类似以下内容的 JSON 响应:

{
  "name": "projects/PROJECT_NUMBER/locations/LOCATION_ID/featureOnlineStores/FEATUREONLINESTORE_NAME/operations/OPERATION_ID",
  "metadata": {
    "@type": "type.googleapis.com/google.cloud.aiplatform.v1beta1.CreateFeatureOnlineStoreOperationMetadata",
    "genericMetadata": {
      "createTime": "2023-09-18T17:49:23.847496Z",
      "updateTime": "2023-09-18T17:49:23.847496Z"
    }
  }
}

后续步骤