Skip to main content

sessions

Creates, updates, deletes, gets or lists a sessions resource.

Overview

Namesessions
TypeResource
Idgoogle.aiplatform.sessions

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
namestringIdentifier. The resource name of the session. Format: 'projects/{project}/locations/{location}/reasoningEngines/{reasoning_engine}/sessions/{session}'.
createTimestring (google-datetime)Output only. Timestamp when the session was created.
displayNamestringOptional. The display name of the session.
expireTimestring (google-datetime)Optional. Timestamp of when this session is considered expired. This is always provided on output, regardless of what was sent on input. The minimum value is 24 hours from the time of creation.
labelsobjectThe labels with user-defined metadata to organize your Sessions. Label keys and values can be no longer than 64 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. See https://goo.gl/xmQnxf for more information and examples of labels.
sessionStateobjectOptional. Session specific memory which stores key conversation points.
ttlstring (google-duration)Optional. Input only. The TTL for this session. The minimum value is 24 hours.
updateTimestring (google-datetime)Output only. Timestamp when the session was updated.
userIdstringRequired. Immutable. String id provided by the user

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, reasoningEnginesId, sessionsIdGets details of the specific Session.
listselectprojectsId, locationsId, reasoningEnginesIdpageSize, filter, orderBy, pageTokenLists Sessions in a given reasoning engine.
createinsertprojectsId, locationsId, reasoningEnginesIdCreates a new Session.
patchupdateprojectsId, locationsId, reasoningEnginesId, sessionsIdupdateMaskUpdates the specific Session.
deletedeleteprojectsId, locationsId, reasoningEnginesId, sessionsIdDeletes details of the specific Session.
append_eventexecprojectsId, locationsId, reasoningEnginesId, sessionsIdAppends an event to a given session.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
reasoningEnginesIdstring
sessionsIdstring
filterstring
orderBystring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets details of the specific Session.

SELECT
name,
createTime,
displayName,
expireTime,
labels,
sessionState,
ttl,
updateTime,
userId
FROM google.aiplatform.sessions
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' -- required
AND sessionsId = '{{ sessionsId }}' -- required
;

INSERT examples

Creates a new Session.

INSERT INTO google.aiplatform.sessions (
data__userId,
data__expireTime,
data__sessionState,
data__name,
data__displayName,
data__labels,
data__ttl,
projectsId,
locationsId,
reasoningEnginesId
)
SELECT
'{{ userId }}',
'{{ expireTime }}',
'{{ sessionState }}',
'{{ name }}',
'{{ displayName }}',
'{{ labels }}',
'{{ ttl }}',
'{{ projectsId }}',
'{{ locationsId }}',
'{{ reasoningEnginesId }}'
RETURNING
name,
done,
error,
metadata,
response
;

UPDATE examples

Updates the specific Session.

UPDATE google.aiplatform.sessions
SET
data__userId = '{{ userId }}',
data__expireTime = '{{ expireTime }}',
data__sessionState = '{{ sessionState }}',
data__name = '{{ name }}',
data__displayName = '{{ displayName }}',
data__labels = '{{ labels }}',
data__ttl = '{{ ttl }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
createTime,
displayName,
expireTime,
labels,
sessionState,
ttl,
updateTime,
userId;

DELETE examples

Deletes details of the specific Session.

DELETE FROM google.aiplatform.sessions
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND reasoningEnginesId = '{{ reasoningEnginesId }}' --required
AND sessionsId = '{{ sessionsId }}' --required
;

Lifecycle Methods

Appends an event to a given session.

EXEC google.aiplatform.sessions.append_event 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@reasoningEnginesId='{{ reasoningEnginesId }}' --required,
@sessionsId='{{ sessionsId }}' --required
@@json=
'{
"author": "{{ author }}",
"content": "{{ content }}",
"invocationId": "{{ invocationId }}",
"timestamp": "{{ timestamp }}",
"actions": "{{ actions }}",
"errorCode": "{{ errorCode }}",
"errorMessage": "{{ errorMessage }}",
"eventMetadata": "{{ eventMetadata }}",
"name": "{{ name }}"
}'
;