Conversational AI updates for March 2019

05

Mar

Conversational AI updates for March 2019

Conversational AI updates for March 2019
https://azure.microsoft.com/blog/conversational-ai-updates-for-march-2019/

We are thrilled to share the release of Bot Framework SDK version 4.3 and use this opportunity to provide additional updates for the Conversational AI releases from Microsoft.

New LINE Channel

Microsoft Bot Framework lets you connect with your users wherever your users are. We offer thirteen supported channels, including popular messaging apps like Skype, Microsoft Teams, Slack, Facebook Messenger, Telegram, Kik, and others. We have listened to our developer community and addressed one of the most frequently requested features – added LINE as a new channel. LINE is a popular messaging app with hundreds of millions of users in Japan, Taiwan, Thailand, Indonesia, and other countries.

To enable your bot in the new channel, follow the “Connect a bot to LINE” instructions. You can also navigate to your bot in the Azure portal. Go to the Channels blade, click on the LINE icon, and follow the instructions there.

Channels blade in the Microsoft Azure portal

SDK 4.3

In the 4.3 release, the team focused on improving and simplifying message and activities handling. The Bot Framework Activity schema is the underlying schema used to define the interaction model for bots. With the 4.3 release, we have streamlined the handling of some activity types in the Bot Framework Activity Schema, exposing a simple On* methods, thus simplifying the usage of such activities. On top of the activity handling improvements, for C# we have added MVC support, allowing developers to use the standard ASP.NET core application and ApiController. As with any release, we fixed a number of bugs, continue to improve LUIS and QnA integration, and further clean our engineering practices. There were additional updates across other areas like Language, Prompt and Dialogs, and Connectors and Adapters.

Simplify activity message handling

This release introduces a new way to handle incoming messages through a new class called ActivityHandler. An ActivityHandler receives incoming activities, as defined in the Bot Framework Activity Schema, then delegates the handling of each activity to one or more handler functions based on the activity’s type and other properties. For example, ActivityHandler exposes methods such as:

  • OnMessage – For dealing with all incoming messages
  • OnMembersAdded – For dealing with messages representing members being added
  • OnEvent – For generic event activities

You can find all the methods in the ActivityHandler.ts (for JavaScript) and ActivityHandler.cs (for .NET).

Using ActivityHandler, developers can handle events for incoming messages, application events, and a variety of conversation update events. This should make it easier to create common bot behaviors such as sending greetings and welcoming users.

This class provides an extensible base for handling incoming activities in an event-driven way. In JavaScript and TypeScript, the base ActivityHandler class can be used directly as main activity handler, as seen in the example code below. Developers can also derive subclasses from it to extend the core features.

Here is a small JavaScript code snippet example:

// Import the class from botbuilder sdk
const { ActivityHandler } = require('botbuilder');
// Create the bot “controller” object
const bot = new ActivityHandler();
server.post('/api/messages', (req, res) => {
      adapter.processActivity(req, res, async (context) => {
          // Route incoming activities to the ActivityHandler via the run() method
          await bot.run(context);
      });
});
// bind a handler for all incoming activities of type message
bot.onMessage(async (context, next) => {
      // do stuff
      await context.sendActivity(`Echo: ${ context.activity.text }`);
      // proceed with further processing
      await next();
});
// say hello when new members join
bot.onMembersAdded(async(context, next) => {
await context.sendActivity('Hello! I am a bot!');
await next();
});

Web API integration for .NET developers

A core tenant for the Bot Framework team is to drive parity across .NET and JS implementations. In that spirit, the .NET implementation of the ActivityHandler.cs exposes the same functionality with the given special programing language capabilities. However, ASP.NET Core provides a rich set of infrastructures supporting Web API, which can be easily integrated and used by bot developers. Therefore, in addition to the activity handling improvements, for C# we have added Web API support, allowing developers to use standard ASP.NET core application and ApiController.

Here is a simple code snippet for ASP.NET Web API Controller: 

[Route("api/messages")]
     [ApiController]
     public class BotController : ControllerBase
     {
         private IBotFrameworkHttpAdapter _adapter;
         private IBot _bot;

        public BotController(IBotFrameworkHttpAdapter adapter, IBot bot)
         {
             _adapter = adapter;
             _bot = bot;
         }

        [HttpPost]
         public async Task PostAsync()
         {
             // Delegate the processing of the HTTP POST to the adapter.
             // The adapter will invoke the bot.
             await _adapter.ProcessAsync(Request, Response, _bot);
         }
     }

Note, the _bot passed to _adapter.ProcesAsync method is the actual bot implementation and will handle any activity sent from the adapter, which has a very similar code to the above JS sample.

QnA Maker and Language Understanding

QnA Maker released Active Learning, which helps developers improve their knowledge base, based on real usage. Active learning helps identify and recommend question variations for any question and allows users to easily add them to their knowledge base.

QnA Maker Active Learning

For a user query, if QnA Maker returns top N answers where the difference in confidence score is low, Active Learning is triggered. Based on collective feedback across users, QnA Maker shows suggestions for alternate questions in your knowledge base.

To learn more about how QnA Maker Active Learning works and how to use it, read the documentation, “Use active learning to improve knowledge base.”

Templates and the Virtual Assistant Solution Accelerator

Templates and Solution Accelerators provide a mechanism to identify high growth opportunities for our Conversational AI, Speech, and broader Azure platform. These enable our customers and partners to accelerate delivery of advanced, transformational conversational experiences typically not viewed as possible or require too much effort to deliver a high-quality experience.

In this latest release we have provided significant updates to our Templates and Virtual Assistant solution. A high level summary of changes are covered in our Release Notes.

We are happy to share the availability of a JavaScript (Typescript) version of the Enterprise Template along with a Yeoman Generator. Work has started on the equivalent for the Virtual Assistant. We’ve also added coded unit tests to all Bots created by the templates providing a way to automate unit testing of dialogs along with further enhancements to the telemetry capabilities and the associated PowerBI dashboard.

We’ve also delivered a wide range of changes to the Virtual Assistant and Skills including a new template enabling Skills to be quickly created and added to a Virtual Assistant. There is also new support for proactive experiences, enabling the assistant and Skills to proactively reach out to a user or perform long running asynchronous operations.

Also, in this release are wide ranging improvements to the Productivity Skills including email, calendar, and to-do,  as well as the addition of FourSquare support to the Point of Interest Skill, and an enhanced WebChat test experience.

Web Chat 4.3

Web Chat is a popular component that lets developers add a messaging interface for their bot on the websites or mobile apps. Web Chat 4.3 release addresses the remaining accessibility issues and popular feature requests, like better indication of connectivity state for users with poor network connection.

Chat box in Web Chat 4.3

To try Web Chat 4.3, follow the instructions on GitHub or explore code samples.

Get started

As we continue to improve our conversational AI tools and framework, we look forward to seeing what conversational experiences you will build for your customers. Get started today!

Share