Method: projects.locations.collections.dataStores.trainCustomModel

训练自定义模型。

HTTP 请求

POST https://discoveryengine.googleapis.com/v1beta/{dataStore=projects/*/locations/*/collections/*/dataStores/*}:trainCustomModel

网址采用 gRPC 转码语法。

路径参数

参数
dataStore

string

必需。数据存储区的资源名称,例如 projects/*/locations/global/collections/default_collection/dataStores/default_data_store。此字段用于标识要训练模型的数据存储区。

请求正文

请求正文中包含结构如下的数据:

JSON 表示法
{
  "modelType": string,
  "errorConfig": {
    object (ImportErrorConfig)
  },
  "modelId": string,

  // Union field training_input can be only one of the following:
  "gcsTrainingInput": {
    object (GcsTrainingInput)
  }
  // End of list of possible types for union field training_input.
}
字段
modelType

string

要训练的模型。支持的值包括:

  • search-tuning:根据提供的数据对搜索系统进行微调。
errorConfig

object (ImportErrorConfig)

数据注入和训练期间发生的错误的预期位置。

modelId

string

如果未提供,系统会生成一个 UUID。

联合字段 training_input。模型训练输入。training_input 只能是下列其中一项:
gcsTrainingInput

object (GcsTrainingInput)

Cloud Storage 训练输入。

响应正文

如果成功,则响应正文包含一个 Operation 实例。

授权范围

需要以下 OAuth 范围之一:

  • https://www.googleapis.com/auth/cloud-platform
  • https://www.googleapis.com/auth/discoveryengine.readwrite

如需了解详情,请参阅 Authentication Overview

IAM 权限

需要拥有 dataStore 资源的以下 IAM 权限:

  • discoveryengine.dataStores.trainCustomModel

如需了解详情,请参阅 IAM 文档

GcsTrainingInput

Cloud Storage 训练数据输入。

JSON 表示法
{
  "corpusDataPath": string,
  "queryDataPath": string,
  "trainDataPath": string,
  "testDataPath": string
}
字段
corpusDataPath

string

可与训练数据相关联的 Cloud Storage 语料库数据。数据路径格式为 gs://<bucket_to_data>/<jsonl_file_name>。以换行符分隔的 JSONL/NDJSON 文件。

对于搜索调优模型,每行应包含 ID、标题和文本。示例:{"Id": "doc1", title: "relevant doc", "text": "relevant text"}

queryDataPath

string

可能与训练数据相关联的 GCS 查询数据。数据路径格式为 gs://<bucket_to_data>/<jsonl_file_name>。以换行符分隔的 JSONL/NDJSON 文件。

对于搜索调优模型,每行应包含 ID 和文本。示例:{"Id": "query1", "text": "example query"}

trainDataPath

string

Cloud Storage 训练数据路径,其格式应为 gs://<bucket_to_data>/<tsv_file_name>。文件应为 TSV 格式。每行应包含 docId、queryId 和得分(数字)。

对于搜索调优模型,它应具有查询 ID、语料库 ID、得分作为 TSV 文件头。得分应为 [0, inf+) 中的数字。数字越大,相应配对的相关性就越强。示例:

  • query-id\tcorpus-id\tscore
  • query1\tdoc1\t1
testDataPath

string

Cloud Storage 测试数据。与 trainDataPath 格式相同。如果未提供,系统将对 trainDataPath 执行随机 80/20 训练/测试拆分。