npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bot-kit

v0.0.2

Published

Framework for building chat bots. Currently supports Facebook Messenger and will support Amazon Lex.

Downloads

4

Readme

NPM Version

bot-kit

Easy-to-use chat bot framework for node.js with built-in NLP.

Introduction

Use bot-kit to build AI chatbots in a matter of minutes.
bot-kit provides a customizable, intelligent chatbot for use in your applications. The framework allows you to do the following with minimal knowledge of NLP principles:

  1. easily train an AI to understand user messages
  2. instruct your AI to execute actions (functions) based on those messages

Tutorial

  1. Install and include bot-kit in console: npm install bot-kit --save
    in app code:
const botKit = require('bot-kit');
  1. Understand the Intent object and create your intents. Simple explanation: an Intent is a key-value pair that represents a message and an action to take when we receive it. The label field is the message-classification and the action field is a function that the bot will execute when a user message maps to that label. Another way to think about it is label == capability and action === code for that capability. It is important to keep the labels consistent. This means if you have a intent with the label "greeting", then don't have another intent with the label "hello", unless they should have different corresponding actions.
let myIntents = [
    { 'greeting': userId => sendMessage(userId, 'Hello there!') },
    { 'weather': userId => getForecast(new Date()).then(forecast => sendMessage(userId, forcast)) }
];
  1. Create a new instance of the Bot object, which acts as an interface to your bot's brains. The constructor takes in an array of intents. This tutorial uses the example of a chatbot that gives weather reports.
let weatherBot = new botKit.Bot(myIntents);
  1. Before we can train the bot's AI, it needs some data so that it can learn. All you need to provide is some sample data and expected output. It is suggested that about 60-80% of this data should be used for training and the other portion should be used for testing. Also, more data will produce a smarter AI, obviously.
let trainingData = [
    {'What\'s the weather like today?': 'weather'},
    {'Tell me today\'s forecast': 'weather'},
    {'Hi': 'greeting'},
    ...
];

let testData = [
    {'What\'s the temperature outside?': 'weather'},
    {'Why, hello there!': 'greeting'},
    ...
];
  1. Train the bot to extract intent labels from user messages. Use the learning data we just created, and (optionally) choose a confidence metric for your test data (defaults to 0.6). This method will Error if the training results is below the confidence threshold. test success rate. Without explaining NLP intricacies, the underlying code uses a technique called classification. Read more about it on natural's github repo.
weatherBot.trainBot(trainingData, testData [,confidence]);
  1. Now you can use your bot to extract intents from user messages.
onMessageReceived(webhook, (message) => {
    return weatherBot.determineMessageIntent(message.text).action(message.senderid);
});

Contributing

If you would like to contribute, please follow these steps:

  1. Open an issue of git.
  2. Fork the code and make your contribution.
  3. Test the code using npm test
  4. Submit a pull request on the master branch.

Thanks for sharing your enthusiasm for chatbots and AI! I'm looking forward to seeing what you all create :D

Future/Road Map

Right now, bot-kit is in initial development, but there are plenty of features on its roadmap. Future features include slots/prompts to further engage a user, dynamic learning, more AI features and support for Amazon Lex (whenever they add me to their beta program -_-). I also plan on integrating a facebook messenger bot app as an optional feature in the next release.