Uploads a context file to use as source for the assist calls within the session.
HTTP request
POST https://discoveryengine.googleapis.com/v1alpha/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}:addContextFile
The URL uses gRPC Transcoding syntax.
Path parameters
Parameters | |
---|---|
name |
Required. The resource name of the Session. Format: If |
Request body
The request body contains data with the following structure:
JSON representation |
---|
{ "fileName": string, "mimeType": string, // Union field |
Fields | |
---|---|
fileName |
Required. The name of the file. |
mimeType |
Required. The content type of the file, see https://www.iana.org/assignments/media-types/media-types.xhtml. |
Union field file . The contents of the file. file can be only one of the following: |
|
fileContents |
File contents provided inline. A base64-encoded string. |
document |
Resource name of the Format: |
Response body
Response for the AssistantService.AddContextFile
method.
If successful, the response body contains data with the following structure:
JSON representation |
---|
{ "session": string, "fileId": string, "tokenCount": string } |
Fields | |
---|---|
session |
The name of the session, either the provided one, or the newly created one. Format: |
fileId |
The ID of the uploaded file. |
tokenCount |
The length of the file measured in tokens. |
Authorization scopes
Requires the following OAuth scope:
https://www.googleapis.com/auth/cloud-platform
For more information, see the Authentication Overview.
IAM Permissions
Requires the following IAM permission on the name
resource:
discoveryengine.sessions.addContextFile
For more information, see the IAM documentation.