rainbird-api-js
A promise-based wrapper around the Rainbird API
Install
Requires Node v8.11.0 or later.
npm install rainbird-api --save
Usage
const rb = // Start a new sessionconst session = apiKeyawait sessionstartknowledgeMapId await session// > { question: { prompt: 'Where does John live?', ... } } // Inject factsawait session // Respond with a factconst facts = await session // Get an evidence tree object by calling audit on the answer.await facts0
Context
Context is supported but supplying a contextId
option when creating a new Session
eg.
const session = apiKey: API_KEY contextId: '123'
Notes
Session.response
and Session.query
can return either questions or facts (answers)
Development
Clone and install dependencies
git clone https://github.com/tom-sherman/rainbird-api-js
cd rainbird-api-js
npm install
You must set the following environment variables to be able to run tests:
RB_API_KEY
- A valid Rainbird API key.RB_HELLOWORLD_KMID
- A "Hello World" knowledge map.
These can be placed in a .env
file for convenience.