User Context Persistence (UCP)

User context persistence (UCP in short) allows conversational designer and cognitive SMEs to save user related context across sessions and channels for re-use in subsequent chat sessions to provide seamless user experience and eliminating the need for prompting for user information which is consistent, such as location, application preferences, operating systems etc.

  1. To use UCP, ensure it the user context persistence connector is enabled for your tenant. Follow the steps in the one-click connector section to enable it.
  1. If the connector is enabled, user context can be persisted using the persist_context_keys context variable with relevant values in the welcome node of the skill.
  2. Context variables changed during a conversation would be available for future actions.
  3. Context variables changes managed through Openwhisk actions are not saved immediately but would be available in the subsequent conversation.
Figure 1. Figure 216 – Use Case Persistence in Use Case Design Console
Graphical user interface, application, email, Teams Description automatically generated
  1. All context variable to be tracked can be added as comma separated values. E.g., fallback_min_confidence, fallback_option_count etc. $ should not be added as a prefix for context names.
Figure 2. Figure 217 – Comma Separated Context Variables for UCP
  1. Based on the available user information, the requisite variables can be added in subsequent dialog nodes. Let’s take an example of getting user’s outlook version and how UCP can help us to save that information, so it’s not asked from the user every time.
  1. We added a context variable named version_outlook to the persist_context_keys array in the welcome node.
  1. Since this information is not present when the session starts or when a use case is triggered for the first time, the use case should be designed in such a way, that value of version_outlook is checked before acquiring user input.
Figure 3. Figure 218 – Validate if Context Variable is Empty
  1. An empty context can be checked using the NOT operation - !(version_outlook) to check if this value has been provided by the user. Once this node is triggered, a child node can be added to obtain and store the value from an MCR input.
Figure 4. Figure 219 – MCR Input for User
Graphical user interface, text, application, email, Teams Description automatically generated
  1. The following node shows the user input saved into the user context persistence using the version_outlook variable which can be re-used.
Figure 5. Figure 220 – MCR Input from User to save in UCP Array
Graphical user interface, application, Teams Description automatically generated
  1. UCP values can only be overwritten using persist_context_keys as NULL to remove past values.
  2. A simple example of using UCP in the chat dialogue is shown below:
Figure 6. Figure 221 – UCP Array saving user’s outlook version
C:\Users\saloni.malik\AppData\Local\Microsoft\Windows\INetCache\Content.MSO\58135D2A.tmp

This feature should not be used to store large data