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

botbuilder-qna-maker

v1.0.0

Published

Calls Microsoft's QnA Maker service and returns an answer from that service. This can be used to build a bot whose logic is partially based on the QnA maker responses.

Downloads

4

Readme

Wrapper for Microsoft QnA Maker for Microsoft Bot Framework

###Short sample

const QnA = require('botbuilder-qna-maker');

// Send request to QnA maker, get an answer
const serviceGuid = '<INSERT SERVICE ID>';
const subscriptionKey = '<INSERT SUBSCRIPTION KEY>';

const qna = new QnA(serviceGuid, subscriptionKey);
const answer = await qna.answer('hi!');

console.log(answer);

###What's it for? This package provides a shortcut to call the Microsoft QnA Maker service and get a response. It works with bots written in Node.js using Microsoft Bot Framework (see the botbuilder package), but actually can be used in any code, not just in a bot.

###Methods and Static Members

The constructor takes two required and one optional parameter:

const qna = new QnA(serviceGuid, subscriptionKey, host);

You can get all of them from the Settings page at qnamaker.ai.

As for the host, by default we're using the West US server ( https://westus.api.cognitive.microsoft.com/qnamaker/v2.0) but you can change it if the service becomes available in another region.

Methods:

  • async answer(question) - retrieves an answer and returns it as string, without any metadata.
  • async getRawAnswer(question) - retrieves an answer together with some metadata like the original question and the confidence score. Returns an object.

Static Members: QnA.FAILED_ANSWER = 'No good match found in the KB';

This is the answer returned by QnA maker when there is no suitable answer found. You can use it to output your own message:

if (answer === QnA.FAILED_ANSWER) {
  console.log('Oops, no answer found.');
} else { 
  console.log(answer);
}

###Comments and suggestions If you have any comments, contact me here: https://github.com/catcher-in-the-try/