Socket
Socket
Sign inDemoInstall

nodejs-formaction-sdk-rasa

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    nodejs-formaction-sdk-rasa

FormAction SDK for nodejs to handle forms in rasa


Version published
Weekly downloads
0
Maintainers
1
Install size
5.11 kB
Created
Weekly downloads
 

Readme

Source

#FormAction SDK for Rasa

###Installation :

npm i nodejs-formaction-sdk-rasa

###Usage:

const {handleFormAction} = require('nodejs-formaction-sdk-rasa');
handleFormAction(<REQUIRED_SLOTS_ARRAY>, <ENTITIES_ARRAY>, <SLOT_ARRAY>, <TEMPLATE_ARRAY>, <NEXT_ACTION_NAME>, <senderID_OPTIONAL>);

####OR

const formAction = require('nodejs-formaction-sdk-rasa');
formAction.handleFormAction(<REQUIRED_SLOTS_ARRAY>, <ENTITIES_ARRAY>, <SLOT_ARRAY>, <TEMPLATE_ARRAY>, <NEXT_ACTION_NAME>, <senderID_OPTIONAL>);

###Example:

const {handleFormAction} = require('nodejs-formaction-sdk-rasa');

const request = req.body; // from express endpoint in external nodejs actions endpoint
const required_slot = ['origin', 'destination', 'date'];
const entites = request.tracker.latest_message.entities;
const slots = request.tracker.slots;
const templates = request.domain.templates;
const nextAction = 'utter_flight_details';
const senderID = request.sender_id;
//SenderID is used to send out random unrepeating utterance if multiple utterance available. Optional feature to enhance user experience 

const formHandle = handleFormAction(required_slot, entities, slots, templates, nextAction);
formHandle.then(resp=>{
	console.log(resp);
	//send the response back to rasa python agent
}).catch(err=>{
	console.log(err);
});

NOTES:

  • TURN OFF AUTOFILL for SLOTS in domain, but use the same name as the ENTITIES for SLOTS - SlotFilling happens in the module
  • Register utter_ask_<SLOT_NAME> this is used to dynamically utter a question back to the user.
  • Register nextAction name - utterance/custom action name in domain. That action will called upon successfully completing slot filling.

Keywords

FAQs

Last updated on 03 Mar 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc