Contact Center AI Insights API . projects . locations . assistantSessions

Instance Methods

close()

Close httplib2 connections.

create(parent, assistantSessionId=None, body=None, x__xgafv=None)

Creates an assistant session.

get(name, x__xgafv=None)

Gets an assistant session.

list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)

Lists assistant sessions.

list_next()

Retrieves the next page of results.

streamChat(name, body=None, x__xgafv=None)

Streams chat messages from the assistant.

Method Details

close()
Close httplib2 connections.
create(parent, assistantSessionId=None, body=None, x__xgafv=None)
Creates an assistant session.

Args:
  parent: string, Required. The parent resource where this assistant session will be created. Format: projects/{project}/locations/{location} (required)
  body: object, The request body.
    The object takes the form of:

{ # Represents a conversation session with the Assistant Agent.
  "createTime": "A String", # Output only. The time the session was created.
  "displayName": "A String", # Optional. The display name of the session.
  "messages": [ # Optional. History of messages in the session.
    { # A message in an assistant session.
      "chunks": [ # Required. Content of the message.
        { # A chunk of data in an assistant message.
          "text": "A String", # Optional. Text data.
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation.
    },
  ],
  "name": "A String", # Identifier. Resource name of the session. Format: projects/{project}/locations/{location}/assistantSessions/{assistant_session}
  "requester": "A String", # Output only. The user who initiated the session.
  "state": "A String", # Output only. The status of the session.
  "updateTime": "A String", # Output only. The time the session was last updated.
}

  assistantSessionId: string, Optional. The ID to use for the assistant session, which will become the final component of the assistant session's resource name. If not provided, a random UUID will be generated by the server. This value should be 4-64 characters and must match the regular expression `^[a-z0-9-]{4,64}$`.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Represents a conversation session with the Assistant Agent.
  "createTime": "A String", # Output only. The time the session was created.
  "displayName": "A String", # Optional. The display name of the session.
  "messages": [ # Optional. History of messages in the session.
    { # A message in an assistant session.
      "chunks": [ # Required. Content of the message.
        { # A chunk of data in an assistant message.
          "text": "A String", # Optional. Text data.
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation.
    },
  ],
  "name": "A String", # Identifier. Resource name of the session. Format: projects/{project}/locations/{location}/assistantSessions/{assistant_session}
  "requester": "A String", # Output only. The user who initiated the session.
  "state": "A String", # Output only. The status of the session.
  "updateTime": "A String", # Output only. The time the session was last updated.
}
get(name, x__xgafv=None)
Gets an assistant session.

Args:
  name: string, Required. The name of the assistant session to retrieve. Format: `projects/{project}/locations/{location}/assistantSessions/{assistant_session}` (required)
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Represents a conversation session with the Assistant Agent.
  "createTime": "A String", # Output only. The time the session was created.
  "displayName": "A String", # Optional. The display name of the session.
  "messages": [ # Optional. History of messages in the session.
    { # A message in an assistant session.
      "chunks": [ # Required. Content of the message.
        { # A chunk of data in an assistant message.
          "text": "A String", # Optional. Text data.
        },
      ],
      "eventTime": "A String", # Required. Timestamp when the message was sent or received.
      "role": "A String", # Required. Role within the conversation.
    },
  ],
  "name": "A String", # Identifier. Resource name of the session. Format: projects/{project}/locations/{location}/assistantSessions/{assistant_session}
  "requester": "A String", # Output only. The user who initiated the session.
  "state": "A String", # Output only. The status of the session.
  "updateTime": "A String", # Output only. The time the session was last updated.
}
list(parent, filter=None, pageSize=None, pageToken=None, x__xgafv=None)
Lists assistant sessions.

Args:
  parent: string, Required. The parent resource, which owns this collection of assistant sessions. Format: `projects/{project}/locations/{location}` (required)
  filter: string, Optional. A filter to reduce results to a specific subset.
  pageSize: integer, Optional. The maximum number of assistant sessions to return in a single response. If unspecified, at most 100 assistant sessions will be returned. The maximum value is 1000; values above 1000 will be coerced to 1000.
  pageToken: string, Optional. A page token, received from a previous `ListAssistantSessions` call. Provide this to retrieve the subsequent page.
  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response to list assistant sessions.
  "assistantSessions": [ # The assistant sessions.
    { # Represents a conversation session with the Assistant Agent.
      "createTime": "A String", # Output only. The time the session was created.
      "displayName": "A String", # Optional. The display name of the session.
      "messages": [ # Optional. History of messages in the session.
        { # A message in an assistant session.
          "chunks": [ # Required. Content of the message.
            { # A chunk of data in an assistant message.
              "text": "A String", # Optional. Text data.
            },
          ],
          "eventTime": "A String", # Required. Timestamp when the message was sent or received.
          "role": "A String", # Required. Role within the conversation.
        },
      ],
      "name": "A String", # Identifier. Resource name of the session. Format: projects/{project}/locations/{location}/assistantSessions/{assistant_session}
      "requester": "A String", # Output only. The user who initiated the session.
      "state": "A String", # Output only. The status of the session.
      "updateTime": "A String", # Output only. The time the session was last updated.
    },
  ],
  "nextPageToken": "A String", # A token, which can be sent as `page_token` to retrieve the next page.
}
list_next()
Retrieves the next page of results.

        Args:
          previous_request: The request for the previous page. (required)
          previous_response: The response from the request for the previous page. (required)

        Returns:
          A request object that you can call 'execute()' on to request the next
          page. Returns None if there are no more items in the collection.
        
streamChat(name, body=None, x__xgafv=None)
Streams chat messages from the assistant.

Args:
  name: string, Required. The name of the assistant session to stream chat. Format: `projects/{project}/locations/{location}/assistantSessions/{assistant_session}` (required)
  body: object, The request body.
    The object takes the form of:

{ # Request to stream chat.
  "message": "A String", # Required. The message to send to the assistant.
}

  x__xgafv: string, V1 error format.
    Allowed values
      1 - v1 error format
      2 - v2 error format

Returns:
  An object of the form:

    { # Response from streaming chat.
  "chunk": { # A chunk of data in an assistant message. # A chunk of the assistant response message.
    "text": "A String", # Optional. Text data.
  },
  "eventId": "A String", # The unique ID of the event.
  "eventTime": "A String", # The time when the event occurred.
  "statusMessage": "A String", # A status message.
}