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

Lists metadata for all files in the current session.

HTTP request

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

The URL uses gRPC Transcoding syntax.

Path parameters

Parameters
name

string

Required. The resource name of the Session. Format: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}

Request body

The request body must be empty.

Response body

Response message for AssistantService.ListSessionFileMetadata method.

If successful, the response body contains data with the following structure:

JSON representation
{
  "fileMetadata": [
    {
      object (FileMetadata)
    }
  ],
  "totalQuotaPercentage": number
}
Fields
fileMetadata[]

object (FileMetadata)

The FileMetadatas.

totalQuotaPercentage

number

The total quota percentage used by all the files.

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.listSessionFileMetadata

For more information, see the IAM documentation.

FileMetadata

The metadata of the file.

JSON representation
{
  "fileId": string,
  "name": string,
  "mimeType": string,
  "byteSize": string,
  "tokenCount": string,
  "quotaPercentage": number,
  "selected": boolean,
  "usedInConversation": boolean,
  "originalUri": string,
  "originalSourceType": enum (FileSource),
  "uploadTime": string,
  "metadata": {
    string: string,
    ...
  }
}
Fields
fileId

string

The ID of the file.

name

string

The name of the file uploaded.

mimeType

string

The content type of the file, see https://www.iana.org/assignments/media-types/media-types.xhtml.

byteSize

string (int64 format)

The size of the context file in bytes.

tokenCount

string (int64 format)

The length of the file measured in tokens.

quotaPercentage

number

The percentage of the quota used by the file.

selected

boolean

If the file is selected to be used.

usedInConversation

boolean

Whether the file was used in the session previously (i.e. was used in a query) and is part of the conversation history, or is only uploaded and not used yet.

originalUri

string

Optional. The original location of the file. It may be a local file path, or any other URI that allows accessing the file in an external system. There are two scenarios in which this url may be empty: 1. If the file was sent as inline data (e.g. pasted from the clipboard). 2. If the original location is not available.

Note that there's no guarantee that the URI will be pointing to a valid or actually existing file. For example, a file might have been uploaded to the session, and then deleted from the original source.

originalSourceType

enum (FileSource)

Optional. The type of the original source of the file.

uploadTime

string (Timestamp format)

Output only. The time the file was uploaded (If this is a file generated by an internal process and then made available to the session, this indicates the moment it happened).

Uses RFC 3339, where generated output will always be Z-normalized and uses 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: "2014-10-02T15:01:23Z", "2014-10-02T15:01:23.045123456Z" or "2014-10-02T15:01:23+05:30".

metadata

map (key: string, value: string)

Optional. Represents metadata related to the file that can suit particular use cases. The prefix "google." is reserved for the key for use by Google, but other prefixes can be freely used.

FileSource

Original source of the file.

Enums
FILE_SOURCE_UNSPECIFIED Default value. Unknown source.
FILE_SOURCE_INLINE The data of the file was provided inline (e.g. pasted from the clipboard).
FILE_SOURCE_LOCAL The file was uploaded from a local file.
FILE_SOURCE_CLOUD_STORAGE The file was uploaded from Cloud Storage.
FILE_SOURCE_CLOUD_DRIVE The file was uploaded from Drive.
FILE_SOURCE_URL The file was retrieved from a URL (e.g. public web).