
Product
Introducing GitHub Actions Scanning Support
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
botkit-middleware-luis
Advanced tools
This middleware plugin for Botkit allows you to seamlessly integrate Luis natural language intent APIs into your Botkit bot.
One of the key problems in human-computer interactions is the ability of the computer to understand what a person wants, and to find the pieces of information that are relevant to their intent. For example, in a news-browsing app, you might say "Get news about virtual reality companies," in which case there is the intention to FindNews, and "virtual reality companies" is the topic. LUIS is designed to enable you to very quickly deploy an http endpoint that will take the sentences you send it, and interpret them in terms of the intention they convey, and the key entities like "virtual reality companies" that are present. LUIS lets you custom design the set of intentions and entities that are relevant to the application, and then guides you through the process of building a language understanding system.
Once your application is deployed and traffic starts to flow into the system, LUIS uses active learning to improve itself. In the active learning process, LUIS identifies the interactions that it is relatively unsure of, and asks you to label them according to intent and entities. This has tremendous advantages: LUIS knows what it is unsure of, and asks you to help where you will provide the maximum improvement in system performance. Secondly, by focusing on the important cases, LUIS learns as quickly as possible, and takes the minimum amount of your time.
Go to Luis.ai and log in with your microsoft account :
The first step to using Luis is to create an application. In the application, you will bundle together the intents and entities that are important to your task.
From your app's settings page, snag the service url. You will need this to use Luis's API.
Next you will need to add botkit-middleware-luis as a dependency to your Botkit bot:
npm install --save botkit-middleware-luis
Enable the middleware:
var luis = require('./lib/luis-middleware.js');
var luisOptions = {serviceUri: process.env.serviceUri};
controller.middleware.receive.use(luis.middleware.receive(luisOptions));
controller.hears(['hello','hi'],['direct_message','direct_mention','mention'], luis.middleware.hereIntent, function(bot,message) {
bot.reply(message,"Hello.");
});
Using the Luis middleware with Botkit causes every message sent to your bot to be first sent through Luis.ai's NLP services for processing. The response from Luis is then returned in the incoming messages as seen below:
{
"query": "start tracking a run",
"intents": [
{
"intent": "startActivity",
"score": 0.9999981
},
{
"intent": "None",
"score": 0.144195557
},
{
"intent": "stopActivity",
"score": 1.54796021E-06
}
],
"entities": [
{
"entity": "run",
"type": "activityType",
"startIndex": 17,
"endIndex": 19,
"score": 0.9391843
}
]
}
Using the Wit hears middleware tells Botkit to look for Luis intents information, and match using this information instead of the built in pattern matching function.
FAQs
Middleware for using http://luis.ai with Botkit-powered bots
We found that botkit-middleware-luis demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.
Product
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.