Uploads a context file to use as source for the assist calls within the session.
HTTP request
POST https://discoveryengine.googleapis.com/v1beta/{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 | 
 Optional. The content type of the file, see https://www.iana.org/assignments/media-types/media-types.xhtml. This field is required when the data source does not provide the content type. | 
| Union field file. The contents of the file.filecan be only one of the following: | |
| fileContents | 
 File contents provided inline. A base64-encoded string. | 
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 | 
 Deprecated: This field will not be set for all file types, and will eventually be removed. The length of the file measured in tokens. | 
Authorization scopes
Requires one of the following OAuth scopes:
- https://www.googleapis.com/auth/cloud-platform
- https://www.googleapis.com/auth/discoveryengine.readwrite
- https://www.googleapis.com/auth/discoveryengine.assist.readwrite
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.