A showcase of best practices with the new Financial Digital Assistant sample

new

Originally published on the Oracle Digital Assistant Blog​

A new sample digital assistant, called Financial.DigitalAssistant has been added to the Store with release 22.10.

This digital assistant and its skills showcase a variety of useful design and implementation practices, such as composite bag entities, ML entities, visual flow design, test suites, handling of small talk, and using answer intent.

This is a handy guide to keep in mind if you’re developing an AI assistant of your own.

Store

You can find the Financial Digital Assistant sample in the Store.

Press Pull to have it installed in your ODA instance.

store

Let’s examine a bit more in detail the 4 Skills under this new DA.

Financial.Account – Skill

This is a sample banking skill that is part of the Financial.DigitalAssistant sample digital assistant. This skill highlights a variety of useful design and implementation practices, including composite bag entities, ML entities, visual flow design, and test suites.

Check the financial.reg.balance intent and observe the utterances. We recommend starting at 30-40 for development and 80-100 for production (general rule). But this is not purely an exercise of reaching a certain number of utterances. If you want to make your NLP model good, you need to include proper grammar and variety.

intents

​Each intent has an associated composite bag that will drive the conversation. This is what we call model-driven conversation and it allows to remove complexity from the dialog flow, as the composite bag controls the interaction.

Each composite bag has one or more bag items where we configure their behavior with the available properties. On top of that, we use resource bundles in every possible step. This consolidation of the bot messages allows the copywriter, or conversation designer to easily manage the text.

Using multiple prompts is also a best practice. This way we can disclose more information in each prompt, providing extra guidance to the user.

prompts

Below is an example of the above implementation, where we do have a different text in the re-prompt message.

preview

This skill also has a composite bag (cbe.spendTrack) that has a bag item of type machine-learning (ML) entity. 

ML entities are a powerful solution when we need to extract unknown data.

Check the entity ml.sellers and examine the data set with the annotated utterances.

ml

The above dataset is part of a set used to train this entity, and it will allow the extraction of unknown values as seen below.

ml2

The dialog flows are simplified due to the usage of composite bags to drive the conversation, (model-driven conversation, as mentioned before). Check the below example that only requires one dialog flow state (resolve composite bag)  to fully manage the conversation

preview

If you check the resource bundles, you can find a solid naming convention (these are suggestions only)

rb

Financial.Insurance &  Financial.OnlineBanking – Skills

These are FAQ skills part of the Financial.DigitalAssistant sample digital assistant. They use answer intents that are trained to answer common questions about insurance/online banking.

An answer intent does not require a dialog flow, but these 2 skills go a step further and use a global flow (check global.handler.answerIntents in either of the skills) to manage all answer intents.

In doing so, it allows for the acknowledgment of the question. This is achieved with the proper use of the (intent) conversation name (check the state displayTopAnswer in the flow global.handler.answerIntent)

acknowledge

Observe that every answer is preluded with the question acknowledgment.

Another cool feature we can find in this skill Is the ability to display in a carousel any question that matches above 40%, while giving the user the choice to decide.

carrousel

The dialog will render a button whenever we have more than one intent above 40%

carrousel2

The core logic is implemented with an Entity Event Handler – check the cbe.AnswerCarouselNER and cbe.DisplayResolvedAnswerNER entities and respective event handlers for more details.

Financial.Common – Skill

A sample utility skill that is part of the Financial.DigitalAssistant sample digital assistant. This skill provides common functionality for the whole digital assistant, including greeting and acknowledgment behavior and handling of unrelated small talk that a user might initiate.

Another best practice is to have variety in the answers (every time a different message)

variety

You can verify the resource bundles with key feedback.reg.answerHelping.answer1 (1 to 4) for these responses.

Resource bundles are quite flexible and we can create customized bundles depending on the channel.

Another feature is the ability to create parametrized resource bundles:

  • Check the resource bundle with key: smalltalk.reg.whoBuiltYou.answer1
  • It takes a parameter in its invocation which is then replaced. For this skill, the parameter has the value Financial
whobuiltyou

The Digital Assistant

The Digital Assistant has default intents which are pre-seeded.

We can however train them with extra utterances.

da

In some cases, you might have a digital assistant that has skills outside of their primary purpose. For example, the Financial.Common skill is meant to handle small talk. In these cases we would want the skill to take a secondary role in the digital assistant.

If you check this skill as part of the digital assistant, you notice it is marked as hidden. This means it is there and will be called if invoked, but we won’t display it to the user as part of any help or menu.

Testing

All Skills (except Financial.Common) have model test cases. Once again, this is often neglected, but it is fundamental in establishing a baseline against which one can measure any changes in intents/utterances or when you later test the skill on updated versions of the Digital Assistant platform.

These skills offer a testing framework that provide scores and detailed reports of how successful the model is at resolving user messages. 

testcase

Running those test cases will establish that baseline, against which any future test run can be compared.

Worthwhile mentioning that the utterances used for the test suites are not part of the model training utterances – The recommendation is to use 20% of the sourced utterances for training purposes.

result

Other valuable store skills – The Pizza Skill

The pizza skill focuses on the visual dialog flow and showcases several techniques.

  • Separate flows for each regular intent.
  • A default flow for answer intents.
  • A special flow for an answer intent that includes states that allow the user to respond to the answer.
  • Creating user-scoped variables to store user information from prior visits.
  • Use of resource bundles for messages to users.
  • Native multi-language support.