-3

I am able to develop Dialog Flow ChatBot with Rasa Core and Rasa NLU. But unable to implement conversational ChatBot. Any one can you please help me on it.

For example:
===============================
Bot: Hi, how can I help you ?

User: I want to apply leave.

Bot: Sure, may I know when you want to apply ?

User: 07-07-2018

Bot: Ok, How many days ?

User: 1 day

Bot: Ok, which type of leave ?

User: Casual Leave ?

Bot: You want to apply Casual Leave from 07-07-2018 to 07-07-2018 ?

Bot: Please confirm Yes / No ?

User: Yes

Bot: Congrats, your leave applied successfully.

Scenario 1:

If I enter everything sequentially it's work fine.

Scenario 2:

If I enter in negative manner or different question, loop not breaking.

For suppose

....
Bot: Ok, How many days ?

User: show me my leaves count

Bot: Ok, which type of leave ?
....

How to break the dialog flow and make it conversational.

durgas09
  • 30
  • 6

2 Answers2

2

With Rasa Core, the flow of a conversation is learned from real examples. So you should also provide example conversations where the user does not cooperate, and how the bot should respond in those cases.

If you only provide examples where the user provides all the requested info, then that is all Rasa Core will know how to handle.

amn41
  • 1,164
  • 1
  • 9
  • 17
  • Refer **Scenario 2** for use case When the Bot asked How many days user should give number of days, but if user gives wrong input or raise different question example: Before giving number of days he want to check how many leaves he has. Then the Bot should react properly based on the question user asked, It should show the leaves count. But Bot asking which type of leave ? which will be the next question in that sequence. – durgas09 Jul 03 '18 at 05:46
1

Since you recognise that there may be situations where the user will enquire on leave count, you need to cater for that in stories.md as well, to train the dialogue engine.

## Happy Flow
* intent_applyLeave
- utter_whichDay
* informDay
- utter_typeOfLeave
* informType
- utterConfirmation
> checkConfirmation

## confirmYes
> checkConfirmation
* informYes
- action_ApplyLeave

## confirmNo
> checkConfirmation
* informNo
- action_ResetParams

## Not-so-Happy flow
* intent_applyLeave
- utter_whichDay
* query_leaveBalance
- utter_leaveBalance
- utter_whichDay
 * informDay
- utter_typeOfLeave
* informType
- utterConfirmation
> checkConfirmation   

I would also use the FormAction functionality in Rasa Core (see https://core.rasa.com/patterns.html). Create a custom action where you define the required fields (eg StartDate, TypeOfLeave, etc). This will help cater for situations where the user already entered the necessary information in a single sentence. Of course be sure to train rasa_nlu with these possibilities as well

EDM
  • 51
  • 5