Mass push values to keyword based entities on Wit.ai
npm install wit-keywords --save
Push an array of actors to the actor entity
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
])
.then(response => console.log(response))
.catch(err => console.log(err));
//=> [{
//=> value: 'Leonardo DiCaprio',
//=> status: 'added'
//=> }, {}, {}, {}]
Trigger a function after
each pushed item
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
Trigger a function after
each pushed item
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
Set custom number of parallel requests (concurrency
)
const keywords = require('wit-keywords');
new keywords(process.env.WIT_TOKEN)
.concurrency(4) // Default = 3
.entity('actor')
.after(actor => {
// Do something
})
.push([
'Leonardo DiCaprio',
'Steve Carell',
'Alec Baldwin',
'Micheal Cera'
]);
MIT © Daniel Eckermann