1.0.0-alpha.1 • Published 3 years ago
@dabblelab/mantium v1.0.0-alpha.1
Mantium NodeJS SDK
This is a NodeJS SDK for the Mantium API.
Installation
npm install @dabblelab/mantium
Usage
- Require the SDK:
const mantium = require('@dabblelab/mantium');
- Create a new client:
const client = new mantium(process.env['MANTIUM_USERNAME'], process.env['MANTIUM_PASSWORD']);
Note: The example above assumes the environment variables
MANTIUM_USERNAME
andMANTIUM_PASSWORD
are set. 3. Set the client's authorization token:client.token = await client.getToken();
- Use the client:
const promptId = "b44bc7de-ab0d-441e-9b8a-f0ddc98e1dfe"; // from mantium dashboard const text = `In today’s world, technology changes fast, and unless you’re mindful, it’s easy to fall behind. For much of the 20th century, hyper specialization was key. Today however, you need to dabble in a lot of areas to keep up.`;
client.tryPrompt(promptId, text) .then(response => console.log(response)); .catch(error => console.log(error));
1.0.0-alpha.1
3 years ago
1.0.0
3 years ago