Introduction to How to Manage Context for IVAs
So you want to build contextual awareness in your intelligent virtual assistant (IVA), but you don’t know where to begin. If you need a refresher on contextual awareness and why it’s critical to your IVA, check out this blog before moving forward.
Now that we have a good understanding of contextual awareness, it’s time to implement it. In order to build contextual awareness into an IVA, we must understand how to manage context. Kore.ai provides the ability to manage context in multiple ways:
- Output Context to define tags that indicate the current intent is executed.
- Intent Preconditions to extract the output context tags for scoping the subsequent intent detection.
- Contextual Intent Detection using context tags to identify the terms/nodes from the FAQs.
- Conversation Flows to customize the flows.
In this blog, we will walk through these different methods for managing context to show how you can implement contextual awareness in your IVA in the Kore.ai Experience Optimization (XO) Platform.
Getting Started with Context Management in the XO Platform
In order to implement context management with the above methods, we must decide which dialog task needs to understand context and navigate to it. To do this, click on “Dialog Tasks” under “Conversational Skills” on the “Build” tab of the XO Platform.
Next, select the dialog task that needs to be able to manage context and go to the dialog builder that has the conversational flow built out. Click on the node that represents a point in the conversational flow where the IVA needs to manage context and click on the NLP properties tab.
From here, we can define how the IVA manages context with context output and intent preconditions.
Context Output
Context Tags are generated and stored in the context object to be used for managing the IVA’s behavior and user experience. The Platform creates a context object for every user intent, like dialog tasks and FAQs (refer here for more on Context Object).
Default Context Tags
Intent names, Entity names, and FAQ Term/Node names are emitted by default.
Custom Context Tags
Additionally, the following can be defined to be included in the Context Object:
- Context Tags – You can add context tags from the NLP settings for Dialog, Action, Alert, Info Tasks, and Entities.
- Entity Value – You set an option to indicate whether entity values captured should be emitted or not for each entity node.
- Use context tags for finding FAQ – You can indicate whether KG paths to be shortlisted using context tags.
Dialog Tasks
The Platform supports emitting details of a dialog task when executed by the user:
- The intent name is emitted as a contextual tag for all dialog tasks when the task execution is initiated.
- You can add any additional tags from the NLP Properties tab of the dialog task (you may have to scroll down).
- You can emit output context tags from any place where JavaScript is written (script node, advanced prompts, run a script option, etc.) using the contextTags.add(string value).
Alert Tasks
The Platform supports emitting details of the alert tasks when executed by the user:
- The task name is emitted as a contextual tag for all alert tasks when the task execution is initiated.
- You can add any additional tags at the time of task creation under More Options or from the General Settings.
- You can also emit output context tags from pre-processors or post-processors using contextTags.add(string value).
Entity
Entity values captured from end-users are emitted based on the:
- Auto emit the entity values captured switch. Entity Value Tags will be emitted as shown in the following section.
- You have the option to add any additional tags.
Knowledge Graph
- The node/term name is emitted as a contextual tag for all mandatory and optional terms present in the path qualified when a question is answered.
- You can add any additional tags per term from the Settings page for the node/term.
- You can also emit output context tags from advanced prompts using the contextTags.add(string value).
Intent Preconditions
Intent pre-conditions are used to define the intent detection scope for intents and FAQs. These are a set of conditions that must be fulfilled for the intent/FAQ to be detected and executed.
Dialog Tasks
Intent pre-conditions for dialog intents are set to define when a dialog is detected i.e. making a dialog available for detection only when specific tags are available in the context.
- You can add one or more intent pre-conditions for making a dialog intent available.
- Dialog intents with pre-conditions are detected only if the defined pre-conditions are met.
- The intent with a precondition set is treated as a sub-intent and will be part of the Linked Task Exception behavior from the Dialog level Hold and Resume settings.
Alert Tasks
Intent pre-conditions for alert tasks are set to define when a task is detected i.e. making a task available for detection only when specific tags are available in the context.
- You can add one or more intent pre-conditions for making a task intent available.
- Task intents with pre-conditions must be detected only if the defined pre-conditions are met.
Knowledge Graph
Intent pre-conditions for Knowledge Graph can be associated with terms.
- You can define intent pre-conditions for any of the terms present in the Knowledge Graph.
- Paths that contain terms with pre-conditions are qualified only if the pre-conditions are met.
Contextual Intent Detection
Contextual intent detection helps detect relevant intents using the output context set by previously executed intents.
Tasks
You can define Rules for identifying contextually relevant intents by using output context tags the same as traits (refer here for more).
Knowledge Graph
The Platform consumes the output context tags and uses them for improving intent detection in the Knowledge Graph engine based on the flag set by the developer. This flag ensures that the context tags are used to qualify paths in the Knowledge Graph. Context tags are used to extract terms that are grouped with any other terms present in the user utterance. The consolidated list of terms is used for qualifying the path.
You can configure this as follows:
- Select the Build tab from the top menu
- From the left menu, click Natural Language > Thresholds & Configurations
- Click Knowledge Graph
- Locate Qualify Contextual Paths and set it to Yes
Conversation Flows
The context tags available in the context object are used to customize the conversation flows.
These can be used as follows:
- To pre-populate entity values
- To define transition conditions
- For custom conversation flow
The Scripts to access the context tags are:
- From the current context: context.currentTags.tags
- From the previous context: context.historicTags[0].tags
Conclusion
Now we have everything we need to build IVAs that understand and manage context throughout a conversation on the Kore.ai XO Platform.
Try it for yourself and get started today for free.