Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ads-vdh/qnamaker-api

Package Overview
Dependencies
Maintainers
3
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ads-vdh/qnamaker-api

An unofficial node wrapper for the Microsoft QnAMaker API

  • 1.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
3
Created
Source

Provides a wrapper around the Cognitive Services APIs for QnaMaker

Installation

Install on npm

npm install @ads-vdh/qnamaker-api --save

Usage

Initialize the Client:

let qnaMakerApi = require("@ads-vdh/qnamaker-api");

let client = qnaMakerApi({
  endpoint: endpoint,
  apiKey: ocpApimSubscriptionKey,
  kbId: kbId, // optional (sets default for each method)
});

Knowledge Base Methods:

let knowledgeBases = await client.knowledgeBase.listAll();
let knowledgeBase = await client.knowledgeBase.download(kbId);
let kbDetails = await client.knowledgeBase.getDetails(kbId);

await client.knowledgeBase.publish(kbId);
await client.knowledgeBase.replace(kbId, qnaList);
await client.knowledgeBase.replace(kbId, qnaUpdates);

Alterations Methods:

let alterations = await client.alterations.get();
await client.alterations.replace(alterations);

Recommendations

Store your environment variables in a file named .env that looks something like this:

Endpoint=https://***.cognitiveservices.azure.com
kbId=***
OcpApimSubscriptionKey=***

Then use the dot-env package to read them in like this:

require("dotenv").config();

which should then make the environment variables available like this:

let client = qnaMakerApi({
  endpoint: process.env.Endpoint,
  apiKey: process.env.OcpApimSubscriptionKey,
  kbId: process.env.kbId,
});

Keywords

FAQs

Package last updated on 13 Apr 2020

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc