Multiple Dialog Task using same context

Hi @Subrahmanyam and @andy.heydon ,

We are trying to invoke a new Dialog task from currently running Dialog task and want to use the context variables of already running Dialog task for both tasks.

For example:
If there are two dialog tasks like Dialog1 & Dialog2. We are invoking Dialog2 from Dialog1 task.
Is it possible to run both the dialog with the same context i.e. with Dialog1 task’s context.

Please suggest if we can achieve this.

Thanks,
Neha Sheik

Hi @nehamsheikh It all depends on how you define the Dialog2. If you are calling the Dialog 2 as an intent from wthin Dialog1, then yes the context variables stored/defined are available. But in case, if you initialise Dialog2 as another Dialog from within Dialog1 then context variables stored/defined in Dialog1 are not available.

Hi @nehamsheikh It all depends on how you have defined the Dialog2. If you are calling the Dialog 2 as an intent from wthin Dialog1, then yes the context variables stored/defined are available. But in case, if you initialise Dialog2 as another Dialog from within Dialog1 then context variables stored/defined in Dialog1 are not available.

Hi,

Can you please explain how to differentiate this invocation?

Regards,
Neha Sheikh

@nehamsheikh Please refer the screenshots below.
In first screenshot, we are using a Dialog task as a sub dialog within the main dialog
41%20PM
In second screenshot, we are using dialog task as an intent within the main dialog.
53%20PM

Refer https://developer.kore.ai/docs/bots/bot-builder/defining-bot-tasks/dialog-tasks/creating-dialog-task-flows/ and https://developer.kore.ai/docs/bots/bot-builder/defining-bot-tasks/dialog-tasks/ for more information

Hi @swathi.vadlamani,

We are trying to get the value of an entity defined inside a separate dialog task from running dialog task.

For example:
There are two dialog tasks, Dialog1 task with ‘entity_test1’ entity & Dialog2 task with ‘entity_test2’ entity receptively. Let the value for ‘entity_test1’ is ‘abc’ and for ‘entity_test2’ is ‘xyz’. We want to fetch the values from both entities to show them in a single response.

i.e. {{context.entities.entity_test1}} + {{context.entities.entity_test2}}

Please suggest if we can achieve this.

Thanks,
Neha Sheik

Hi @swathi.vadlamani Currently in agent transfer failed scenario i am invoking a new dialog task as below image. along with invoking i want to pass some context values . is there any way to do this?
image

@swagata.sengupta Any Update on this?

@damaresh.n
data object has context in it.
data.context

You can access or set any variable if you use correct path.

Usually we do it like this.

var context = data.context;
var entVal = context.entities.entity_test1;

You can set it also like this
context.entities.entity_test1 = "Test";

Then you should call sdk.sendBotMessage
If you check out botkit repo on github there will be many files like fid flight, book a pizza. You can take reference form there.

I Tried the above approach but it did’nt work.

so i am doing something like this, which is working for me.
Please have a look at the approach and suggest if it has any negative impact.

i am sending the entity value with message like this
image

and i have a entity node like this, which is a list of enumeration
image

and i am loading the list with data from api call and using it in enumeration.
image

and finally i have trained the Intent with utterances and entity.
This is working for me.

@damaresh.n

I did not understand one thing…

If you are getting the value of
data.context.entities.InquiryType
in
var entityVal

it means the entity has been already set. Why are you trying to set again. And if you are successful in invoking the utterance, then let the user type / select the entity.

In your code, for every user message, the same intent will get triggered. Any specific reason you are doing this? I think here is the mistake you are making, even when you try to input the entity value, it will override it as “create inquiry request” which will be no match to the list you are populating. You need to have some condition before you enforce an intent through botkit.

If you append something to data.message essentially you are just changing the utterance/ user input before sending it to the bot.

Loading the list part looks fine.