Jaa


Memory scopes and properties

APPLIES TO: Composer v1.x and v2.x

This article lists the properties that Composer sets by default, grouped by memory scope.

See Conversation flow and memory to find out how memory is used in Bot Framework Composer,

Memory properties are managed within the following scopes:

The scopes

Scope Description
Settings Read-only information from the bot configuration file.
User Properties associated with the current user. Properties in the user scope don't expire. These properties are in scope while the bot is processing an activity associated with the user.
Conversation Properties associated with the current conversation. Properties in the conversation scope have a lifetime of the conversation itself. These properties are in scope while the bot is processing an activity associated with the conversation.
Dialog Properties associated with the active dialog. Properties in the dialog scope are kept until the dialog ends.
This Properties associated with the current action.
Turn Properties associated with the current turn.
Dialog context Properties associated with the dialog stack.
Dialog class Information about the active dialog.
Class Information about the current action.

Tip

  • A turn consists of the user's incoming activity to the bot and any activities the bot sends back to the user as an immediate response. You can think of a turn as the processing associated with the bot receiving a given activity.
  • Both user and conversation state are scoped by channel. The same person using different channels to access your bot appears as different users, one for each channel, and each with a distinct user state.

The next sections describe the properties that Composer automatically makes available to you. You can also define and access your own properties. See Conversation flow and memory for more about how memory scopes and properties are used in bot.

Settings scope

The settings scope lets you reference your bot's configuration settings.

To see your bot's current settings in Composer, go to the Configure page and turn on the Advanced Settings View (json). To access settings properties and subproperties from within adaptive expressions, use JSON notation. Alternatively, use the jPath adaptive expression prebuilt function to retrieve information from a settings property.

For example, default QnA Maker properties are:

  "qna": {
    "hostname": "",
    "knowledgebaseid": "",
    "qnaRegion": "westus",
    "endpointKey": "",
    "subscriptionKey": ""
  },

To reference your knowledge base ID, use the adaptive expression, settings.qna.knowledgebaseid.

Dialog scope

Variable Description
dialog.eventCounter Counter of emitted events.
dialog.expectedProperties Currently expected properties.
dialog.lastEvent Last surfaced entity ambiguity event.
dialog.lastIntent The last top scoring intent for this dialog.
dialog.lastTriggerEvent Inside a forms dialog, the forms event which triggered an Ask action. Note, the forms feature is in preview.
dialog.requiredProperties Currently required properties.
dialog.retries Number of retries for the current Ask.

This scope

Variable Description
this.options The options passed into the active dialog via the options argument of the BeginDialog action.
this.turnCount The number of previous times the user was prompted for this information. Applies to input actions.
this.value The value to use as the default value. Applies to input actions. Can be an adaptive expression.

Turn scope

Variable Description
turn.activity The current activity for the turn. For detailed information about the structure of an activity, see the Bot Framework Activity schema.
turn.activity.action
turn.activity.attachments A list of objects to be displayed as part of this activity.
turn.activity.entities A list of metadata objects pertaining to this activity. Unlike attachments, entities don't necessarily manifest as user-interactable content elements, and are intended to be ignored if not understood.
turn.activity.from Indicates which client, bot, or channel generated an activity.
turn.activity.importance For message activities: contains an enumerated set of values to signal to the recipient the relative importance of the activity. It's up to the receiver to map these importance hints to the user experience.
turn.activity.locale For message activities: the language code of the text field.
turn.activity.localTimestamp The datetime and timezone offset where the activity was generated. This may be different from the UTC timestamp where the activity was recorded.
turn.activity.localTimezone The timezone where the activity was generated.
turn.activity.name The name of the activity, if any.
turn.activity.recipient Indicates which client or bot is receiving this activity.
turn.activity.semanticAction For message activities: contains an optional programmatic action accompanying the user request. The semantic action field is populated by the channel and bot based on some understanding of what the user is trying to accomplish.
turn.activity.speak For message activities: indicates how the activity should be spoken via a text-to-speech system.
turn.activity.suggestedActions For message activities: contains a payload of interactive actions that may be displayed to the user. Support for suggestedActions and their manifestation depends heavily on the channel.
turn.activity.summary For message activities: contains text used to replace attachments on channels that don't support them.
turn.activity.text For message activities: the text content, either in the Markdown format, XML, or as plain text.
turn.activity.timestamp The exact UTC time when the activity occurred, as recorded by the channel.
turn.activity.topicName
turn.activity.type The activity's type, such as "message", "event", or "conversationUpdate", and so on.
turn.activity.value For message activities, contains a programmatic payload specific to the activity being sent.
turn.activityProcessed Indicates whether the original turn activity was consumed.
turn.dialogEvent The current dialog event for this turn.
turn.interrupted Indicates whether an interruption occurred.
turn.lastresult The result from the last dialog that was called.
turn.recognized The recognized result for the current turn.
turn.recognized.alteredText The input text as modified by the recognizer, for example for spelling correction.
turn.recognized.entities All recognized top-level entities.
turn.recognized.intent The top scoring intent.
turn.recognized.intents All recognized intents, with the intent as key and the confidence as value.
turn.recognized.score The score for the top intent.
turn.recognized.text The input text to the recognizer.
turn.recognizedEntities Entities recognized from the text.
turn.repeatedIds For internal use only.
turn.unrecognizedText The original text, split into unrecognized strings.

Tip

The turn.activity property represents the activity your bot received from the user or the user's channel this turn. For detailed information about the activity object's properties, see the Bot Framework Activity schema.