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

セッション内のアシスト呼び出しのソースとして使用するコンテキスト ファイルをアップロードします。

HTTP リクエスト

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

この URL では gRPC Transcoding 構文を使用します。

パスパラメータ

パラメータ
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,
  "document": 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 でエンコードされた文字列。

document

string

Document のリソース名。呼び出し元は Document にアクセスする権限を持っている必要があります。そうでない場合は、PERMISSION_DENIED エラーが返されます。

形式: projects/{project}/locations/{location}/collections/{collection}/dataStores/{dataStore}/branches/{branch}/documents/{document}

レスポンスの本文

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 のドキュメントをご覧ください。