When building an application that involves artificial intelligence, the interaction between different departments within the company is the key to success. This is especially true for conversational applications, where each of the team members can focus on their specific areas: domain experts, for instance, can contribute to the implementation of useful features in their own application domain, translators can translate dialogues into a different language, and so on.
Not everyone has the technical knowledge to build an application from code. In these cases we can use tools that allow us to build applications with little code, called low-code tools, or even without any code, called no-code tools. These solutions make it possible for those who don’t have knowledge of coding or artificial intelligence to still be included in the development process.
There are many platforms, both Cloud-based and not, that offer such tools. Today we will focus on the one offered by Microsoft, which includes several solutions for the creation of Bots that fit a variety of needs: in this article we will take a look at the Bot Framework Composer.
What is it
As you can already guess from the name, Composer is based upon Bot Framework, a set of open source libraries and tools for the development of Bots. Writing code is no longer a strict requirement since Composer uses a graphical approach based on building flow charts and text templates that will form the logic of the Bot, while still allowing for the customization of some technical aspects. To make the most of the framework’s features, it can be useful to know its conventions and which integrations it offers.
One example is the integration with different services on the Azure Cloud, for which the tool offers native integration, like the NLP services LUIS and QnA Maker, that help us build a rich and smart application.
If you don’t know LUIS, you can get a general idea of which features it offers by looking at this previous article.
Once installed and opened, Composer immediately shows us many examples from which to start or even just draw inspiration. Among these we will take a look at “To Do with LUIS”, a Bot for the management of to do lists and that uses LUIS to understand user requests.
After opening a new project, the main screen looks like this:
- A side menu to move between different parts of Composer.
- The list of the dialogs managed by the Bot.
- The flow of the selected dialog.
- The properties of a single block in the flow.
But what are these dialogs?
A conversation with a user is managed in what is called a dialog, that represents a specific sequence of interactions with the user. Inside a dialog we can request information from the user, send him messages, evaluate data we have at hand and perform actions. Let’s see this in practice by selecting the WelcomeUser dialog from the list.
This dialog sends a welcome message to the users that open a conversation with the Bot. The message is sent from the Send a Response block.
From here it is possible to enrich the response. We can add variations to the phrases, to make the conversation more dynamic, or we can add a spoken response by synthesizing the text.
We can use the graphical approach, or directly edit the text template that uses the LanguageGenerator syntax. This syntax allows us to go beyond simple text, and respond with rich and interactive cards, for instance including audio or video, or using Adaptive Cards.
With Adaptive Cards, it is possible to create interactive cards to present information graphically and interactively, like this card with flight info, that is only one of the many examples provided on the Adaptive Card portal.
User intent recognition can be done by defining fixed rules, or relying on LUIS. In Composer we can define the example phrases and even the entities contained in them.
In the event that you don’t want to rely upon LUIS, you can define a list of regular expressions in the trigger phrases field. With this method it is possible to recognize simple phrases and it’s a good method when we expect phrases that won’t vary much, or when using custom codes.
With regular expressions not only it is possible to recognize the user’s intent, but we can even extract parts of the phrase as variables to use in our dialogs.
It’s often necessary to access external services in order to perform the required actions or retrieve information to be returned to the user. Composer provides many tools for accessing external resources. For instance, it’s possible to invoke a REST API. The result of the invocation can then be manipulated in the dialog flow and returned to the user.
Bot Framework Composer also allows us to manage dialogs in multiple languages, so it is easy to translate the app into your users’ languages.
As we mentioned before, Bot Framework Composer is part of a bigger framework called Bot Framework: a flexible system, to which we can apply many customizations that suit every use case. In Bot Framework Solutions, for example, you can find the implementation of a feedback mechanism to ask for the users’ opinion of the Bot, so we can improve it based on user feedback.
Testing the application
To test the application, it is possible to start the Bot and open a conversation. Composer runs the Bot and creates the resources we need to test the application, in this case, for example, it creates the LUIS apps automatically.
There are many ways to deploy the application, one is completely automatic and there’s also a manual one. For the former, the tool will take care of creating and managing all the resources needed to run our bot on Azure, for example the LUIS and QnA maker apps.
In project settings, we create a publish profile. The wizard will ask us to login to our Azure account (for which we must have a valid subscription) and will then do the rest.
The second way is exporting the application code and deploying it manually into the preferred environment. This procedure is for expert users, and allows us to customize the applications’ more technical aspects.
Either way, once exported the Bot can be published on the available channels like Teams, Skype, Facebook and many others. Alternatively, we can use the Web Chat project to integrate a chat into an already existing site.
The Bot Framework Composer with its low-code approach helps us separate the technical problems from the domain ones, allowing non-technical people to be included in the product development cycle, while leaving the door open to Bot customization by modifying the code to integrate features that are not already included.
It’s very important to understand that technology like this shouldn’t be left to developers alone, which is the main reason why we are creating Elly: to build tools that help the experts give value to their own data!
Keep following us!