Chatbots - should I call LUIS?

Radical changes in Microsoft BotFramework v4

Microsoft stack for bots lets you quickly build smart and functional bots. It's great, check it out, build your own ~friends~ virtual assistants. Architecture can be boiled down to:

  • Bot Service - a connector that abstracts any channel (Skype, slack, etc.)
  • REST-ful app that you develop with BotFramework SDK that is called by Bot Service with every message
  • Any additional services that provide "intelligence" to your bot (LUIS, QnA, Azure Search..)

LUIS, part of that offering - Language Understanding service - enables you to easily detect what the user wants. If you want to know that user asks to "BookFlight" (intent) and you expect people to say something like:

    Book flight to [place] on [date]

I want to go to [place] on [date]

On [date] I want to fly to [place]

Congratulations, you have just pretty much written down a LUIS model.

Now, if you are interested in BotFramework you may have noticed that in SDK v3 the default behavior is to send every user query to LUIS. All samples related to intelligence use middleware that hijacks the flow if an intent is found in user answer.

Should we call LUIS on every single message?

The short answer: no. And that's also direction SDK v4 has recently taken, but before that let's consider two situations:

Where do you want to pick up your order?

  1. At our restaurant
  2. At your office
  3. At your home


What's your home address?

Home Street 1145

Asking LUIS by default wouldn't provide any value. And on the other side we would dent our LUIS calls quota (50 calls / sec / service, chargable) and possibly get sensitive user data in endpoint logs!

SDK v4 - changes

BotFramework SDK v3 is the current production-quality release. V4 is in preview and changes rapidly, but if you look at the docs and samples you can still see LUIS middlewares used everywhere.

Commit screenshot>

Well. 27.06, pretty much a week ago, all middleware for LUIS and QnA was removed from master branch. The idea is that we as developers must own the decision when to call LUIS. And that's great!

LUIS and input

In contrast to previous samples, let's consider:

What's your street address?

Wait, why do you need my address?

In that case the user obviously (for me and my fellow humans such as you, my dear reader) wants to do something different, but at the level of input to an app - we don't really know that. Should we call LUIS just in case?

The pragmatic reality

One of the most important (and far too often not used at all or poorly implemented) patterns in user experience is the ~undo~ functionality. However, as hard as it's to implement sensibly in conversational interfaces, we can at least rely on double confirmations

We will send your package to "Wait, why do you need my address". Is that correct

no, go back!

Confirmation might be the right place to call LUIS, or even better - try checking the answer with rule-based, "less-intelligent" parser.

Building chatbots is a very different kind of challenge that any traditional UI. There are hundreds of weird edge cases like that and at the end we are still nowhere near pretending to create human-level experience with chatbots. But if we as creators don't overpromise - users turn a blind eye for some minor blunders in our "intelligent" applications. And get some real problems solved behind the scenes which is the only thing that counts in the end.

Still, some brave souls that use preview version of BotFramework SDK may be in for a surprise after next release.

Comments & Webmentions

These are webmentions via the IndieWeb and Mention this post from your site: