article by Frank Nimphius, August 2020

Answer intent in Oracle Digital Assistant uses Trainer Tm, a machine learning model, to understand how users ask for a particular answer. Unlike other systems that map an answer to one or more questions in order to retrieve the answer, the machine learning based system learns from examples (utterances) allowing it to produce answer with high confidence.

Also, by using Trainer Tm as the machine learning model in Oracle Digital Assistant, answer intents use the same optimized algorithm as regular intents, which leads to the question of what is better to use for FAQ, answer intents or regular intents. Before going into any details, let me share the answer: "Use both!"

Answer Intents

Answer intents in Oracle Digital Assistant retrieve answers from resource bundles. The resource bundles key is determined by the name of the resolved intent. The image below shows how the intent is mapped to a resource bundle .  

The way that answer intents work is that the intent is resolved through a trained machine learning algorithm. All that developers need to do is to define sample phrases how a user would ask for a given answer. When the intent is resolved, then the answer is immediately displayed to the user. Except for a System.Intent dialog flow state, no other dialog flow steps are required. And this pretty much is the benefit of an answer intent: Its easy to use. 

Regular Intents

To put in simple terms, a regular intent leads to a conversation. A conversation in Oracle Digital Assistant involves multiple states in a dialog flow, entities associated to an intent that then get extracted from the initial user messages, as well as custom components in case custom logic or backend services should be executed. Beside of this, and from a NLP perspective, regular intents are the same as answer intents. The difference is in the follow-up, which is a dialog for regular intents and an answer for answer intents.

Use Case Matters

With the before mentioned differences, the answer to the question of what to use for building FAQ in Oracle Digital Assistant is reduced to the use case. And since the use case is on the intent level (the question so to say), the answer to which intent type to use really is to use both. Most of the FAQ questions require a "plain" answer. This means that most of the time you find yourself using answer intents.

Some questions however may require additional information or a follow-up. Imagine the question about opening hours for a store. If this is a question to the chatbot of a single store or office then the answer is – well – just an answer. If the same question is asked to a company with many stores or offices, then the bot probably requires information about the region the store or office is located in (assuming office and store hours differ). Because there is an additional information needed, the intent to use would need to be a regular intent.

But even with regular intents, bot responses should not be in BotML but read from where they can be managed easily and from where they can be translated if needed: resource bundles. So in this regard, answer intents are special cases of regular intents. Or, looking at it differently, regular intents are answers with a conversational pre- or post-processing; or both.

How To Use Regular Intents As Answers Intents

Regular intents that provide answers to frequently asked questions lead to short dialog flow conversation. The requirement is a System.Intent component state (required to resolve an intent) and a few dialog flow states that handle the follow-up and that provide the answer (from a resource bundle). In the following I will outline how to best handle answers that require pre- or post processing.

The Basics

The System.Intent component in Oracle Digital Assistant skills forwards user messages to the NLP engine to resolve the user intent (intent) and extract named entities (NER) configured for an intent and that are found in the user message. The intent engine returns the name of the intent that resolves as the best scoring intent if it passes a configurable confidence threshold. If no intent resolves above confidence threshold then the unresolvedIntent intent is returned. The System.Intent component maps the resolved intent name, or the unresolvedIntent name, to a dialog flow state to which the user conversation then navigates to. 

The mapping, as shown in the below image, is done in the actions transition. As you see, the intent state has a configuration next: "showQnA". There is something to know about the next transition for a System.Intent component. The next transition is followed whenever an intent is resolved that does not have a mapping in the actions transition.

So if, in the below use case, an intent resolves to "askTravelVoucher", then – because no action transition is defined to handle this intent – the next transition is followed. 

With this knowledge, it is quite easy to understand how to implement regular intents to provide answers for questions that require pre-processing and those that require post processing. 

The pre-requisites

First, you need to create an entry in a resource bundle for the answer that a regular intent should provide to a user. The key (the identifier for the answer) must have the same name as the intent. The resource strings, as shown in the image below, are created as User-Defined resources (not as Q&A, which are resources used by the answer intent).

 

Post-Processing

To post process answers you use the next transition explained above. All intents that are not defined in the actions transition settings are handled by the next transition. So all regular intents that should provide an answer string but that require a follow up (e.g. a rating for the quality of the answer. See How-to allow customers to provide feedback  for a sample) should not have an entry in the actions transition mappings. 

So all answer intents of this type will follow the next transition and will be handled by the showQna state (in the sample). 

In the image below, the showQnA state uses a custom component to provide the answer. The sample is taken from the following article:  TechExchange: How-to allow customers to provide feedback on the usefulness of answers to frequently asked questions . Notice how the answer label is obtained from the resource bundle using the following expression ${rb(iResult.value.intentMatches.summary[0].intent)}. The expression accesses the resolved intent name to use the name as the key when looking up the resource bundle. 

Note:  It is not required to use a custom component to display the answer. All that really matters is to understand how to obtain an answer from a resource bundle using the intent name.

Pre-Processing

To apply pre-processing, you would treat the answer intent like a regular intent and define a dialog flow state mapping in the Sytem.Intent actions transition configuration, This also allows you to assign an entity to the intent in case that the user question e.g. contains the regional context for a question about opening hours. The mapping points the skill to a next state which then can do whatever needs to be done before it displays the answer )again using the ${rb(iResult.value.intentMatches.summary[0].intent)} expression. 

Use Cases Regular Intents As Answer Intents Are Good For

Here are some use cases for which you would use regular intents as answer intents

  • Pre- or -post processing
  • Requirement for entity extraction
  • Display different messages based on a condition (membership status, time of the day, day in a month, channel type etc.)

 

Use Cases That Answer Intents are Good For

Answer intents are easy to use. So they are good to use for all true FAQ that need to return an answer to a question with high confidence. I recommend to start out with answer intents and only use regular intents for answers if you have a use case for it. There is no need for answer intents to deal with System.Intent mappings as the answer is directly printed. All resource bundle management is also handled by the intent design time. 

 

Related Content

TechExchange: How-to allow customers to provide feedback on the usefulness of answers to frequently asked questions

TechExchange Quick-Tip: Working with the new QnA Intent in Oracle Digital Assistant 19.4.1 and later

TechExchange: All 2-Minutes Oracle Digital Assistant Tech Tip Videos on YouTube

Author