Skip to main content

co-context

warning

This documentation page is still being written.

Global Context

The global context includes the following variables:

Current Date and Time

VariableTypeDescription
$system_timeAn ISO 8601 string for the current UTC time.e.g. "14:37:23.000000"
$system_dateAn ISO 8601 string for the current UTC date.e.g. "2022-07-14"
$system_datetimeAn ISO 8601 string for the current UTC date and time.e.g. "2022-07-14T14:37:23.000000"
note

Every time the content of the variables is read, it will reflect the date and time at that particular point in time.

Number of Bot Messages

The system will keep track of the number of messages sent to the user. This could be useful in some situations, for example when resuming a flow and deciding what to do based on how long the conversation history was.

VariableTypeDescription
$system_bot_messages_totalThe total number of bot messagese.g. 5

Current Event and Intent

The information about the latest event and intent is included in the following variables:

VariableTypeDescription
$eventEvent object.
$intentIntent object with the properties name and entities.
$entitiesDirect access to $intent.entities.
$intent_nameDeprecated.
$intent_paramsDeprecated.
$utteranceUtterance object with the last message from the bot.

Flow State

The information about the current state of the flows is included in the following variables:

VariableTypeDescription
$active_flowsList of the names of all active flows. If there are multiple instances, the name of a flow will appear only once.e.g. ["ask_name", "hello", ...]
$active_labelsList of the label names in all active flows. The labels are prefixed with the name of the flow i.e. "FLOW_NAME.LABEL_NAME"e.g. ["ask_name.wait_name", ...]
$expected_nextList of the names of all intents expected next.

Local Flow Variables

These context variables are set per flow:

VariableTypeDescription
$latest_intent_matchEvent object representing the latest intent that was matched.

Objects

The global context will keep track of all the recent objects that have been assigned in the context.

VariableTypeDescription
$TypeList of the recent objects of type Type

Custom Global Variables

caution

Not implemented yet.

Custom global variables can be defined as follows:

define global context 
# The name of the user
$name as string