Skip to content

Sample for using Luis with Bot Framework V4 in a simple banking scenario

Notifications You must be signed in to change notification settings

martinkearn/Bot-Banko

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banko

This repo is based on a preview version of the Bot Framework and is not a good reference right now. Work is underway to upgrade to the final version and this message will be removed when that work is complete. Use the official samples in the meantime: https://github.com/Microsoft/BotBuilder-Samples

This is a very simple bot used to demonstrate several Cognitive Services Luis capabilities with the C# Bot Framework V4 SDK and Azure Bot Service.

This was written in July 2018 whilst the V4 SDK is still 'preview' so may not be accurate in the future.

This sample demonstrates:

  • Luis Intent detection
    • Using LuisRecognizer not LuisRecognizerMiddleware
    • Using Luis in middleware means every single message will go via Luis which is not necessary and costly in this scenario because once we have the intent and initial entities we no longer require Luis
  • Luis entity extraction; getting the entities we have from the initial Luis utterance
  • Entity completion; using bot dialogs to complete entities that were missing from initial Luis utterance
  • Basic bot dialogs with waterfall steps

This sample leans heavily on the ContosoCafe-5-DialogsWithLUISEntities example but simplifies it and focuses on just the Luis aspects.

The Banko Bot Concept

The bot is built around a very typical banking scenario which has two main capabilities:

  • Check balance
  • Make a transfer

Check Balance

Simple intent that displays a made-up balance for the user's account

To invoke the Check Balance feature

  • "Check my balance"; no entities just the Balance intent

Using Make a Transfer

To make a transfer, the user must provide four different entities. These can be included in the initial utterance; if they are not, the bot will use a dialog to complete them:

  • AccountLabel; a simple Luis entity to represent the nick name for the account to transfer from i.e. 'Joint', 'Savings', 'Current' or 'Sole'
  • Money; a pre-built Luis Currency entity to represent the amount to be transferred
  • Date; a pre-built Luis DatetimeV2 entity to represent the date the transfer should take place
  • Payee; a simple Luis entity to represent the label for the payment recipient. This will typically be a name or company name (The Luis model has very limited training here, so only 'Martin Kearn', 'Amy Griffiths', 'John Jones' and 'BT' are likely to work as a payee)

The Make a Transfer feature can be invoked using natural language including some, all or none or the required entities. Here are some examples:

  • "I want to make a transfer"; the Transfer intent without any entities.
  • "Transfer from the joint account"; the Transfer intent with the AccountLabel entity.
  • "Transfer £20 from the joint account"; the Transfer intent with the AccountLabel and Money entities.
  • "Transfer £20 from the joint account on saturday"; the Transfer intent with the AccountLabel, Money and Date entities.
  • "Transfer £20 from the joint account to martin kearn on saturday"; the Transfer intent with the AccountLabel, Money, Date and Payee entities.