Botfuel/botfuel-dialog

Explanation of reentrant

ieshan opened this issue · 4 comments

Could you please add more details regarding 'reentrant' value in the documentation?

constructor(config, brain, characteristics = { reentrant: false }, parameters = {}) {

Hello @ieshan, thank you for your interest!

We’ll add more documentation soon, but here is a quick explanation:
We store two stacks of dialogs:

  • "previous" dialogs
  • "current" dialogs

When a dialog is completed, it moves from the "current" stack to the "previous" one.
Reentrant is a Dialog characteristic that indicates that a dialog can be re-executed even when completed.
When the sentence itself does not contain enough information for the DialogManager to compute a dialog, the DialogManager recalls the first reentrant dialog from the stack of previous dialogs.

It allows conversational interactions such as correcting previous user input:

User: I would like to book a flight to Paris today.
Bot: OK, flight booked!
[Dialog is completed and moved to the previous stack]
User: Sorry, I meant tomorrow!
Bot: OK, your flight is changed from today to tomorrow.

PromptDialogs are the only reentrant Dialogs.

Hope that helps!

Reopening so we don't forget adding documentation about this 😉

Hey, I'm sorry, it could be a dumb question, form the code below it looks like it works as a validator (whether an input text has all the required entity values). Could you please elaborate the user input example you have shown how that might work?

Also, a suggestion, it would be great to have a community on gitter for botfuel-dialog.

if (dialog.blocked) {

No dumb question, please ask away 😄

Actually the dialog.blocked part is not related to entities and user input.
Botfuel Dialog has the capability of being able to detect multiple intents (up to 2, by default we don't allow multiple intents) from a user sentence. In this case, we need the chatbot to take care of one intent first. The second dialog then waits for the first dialog to be completed, so we set the second dialog as blocked.

Check out our new article about the PromptDialog here: https://medium.com/botfuel/building-a-trip-planner-chatbot-with-botfuel-dialog-ecfc56867740, I think it might makes things clearer for you.
We still lack a lot of documentation, but we are working on it!