Method: projects.locations.collections.engines.sessions.addContextFile

上傳內容檔案,做為工作階段內輔助通話的來源。

HTTP 要求

POST https://discoveryengine.googleapis.com/v1beta/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}:addContextFile

這個網址使用 gRPC 轉碼語法。

路徑參數

參數
name

string

這是必要旗標,工作階段的資源名稱。格式:projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

如果將 - 指定為工作階段 ID,系統會建立新工作階段,並自動產生 ID。

要求主體

要求主體包含下列結構的資料:

JSON 表示法
{
  "fileName": string,
  "mimeType": string,

  // Union field file can be only one of the following:
  "fileContents": string
  // End of list of possible types for union field file.
}
欄位
fileName

string

這是必要旗標,檔案名稱。

mimeType

string

(選用步驟) 檔案的內容類型,請參閱 https://www.iana.org/assignments/media-types/media-types.xhtml

如果資料來源未提供內容類型,則此為必填欄位。

聯集欄位 file。檔案內容。file 只能是下列其中一項:
fileContents

string (bytes format)

檔案內容以內嵌方式提供。

Base64 編碼字串。

回應主體

AssistantService.AddContextFile 方法的回應。

如果成功,回應主體會含有以下結構的資料:

JSON 表示法
{
  "session": string,
  "fileId": string,
  "tokenCount": string
}
欄位
session

string

工作階段名稱 (提供的名稱或新建立的名稱)。

格式:projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

fileId

string

上傳檔案的 ID。

tokenCount
(deprecated)

string (int64 format)

已淘汰:這個欄位不會針對所有檔案類型設定,且最終會移除。

檔案長度 (以權杖為單位)。

授權範圍

需要下列其中一種 OAuth 範圍:

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

詳情請參閱Authentication Overview

IAM 權限

需要 name 資源的下列 IAM 權限:

  • discoveryengine.sessions.addContextFile

詳情請參閱 IAM 說明文件