Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Working with Context for different intent

Hello,
i'm really new in DialogFlow and would like to dig deep my knowledge about this topic.
My question right now is about context. So for my case, i build a Conversational Bot for a Fitness Center and trying to create intent related to an individual's program goal

So for the training phrases would be

"i want to get ideal weight"
"i want to build muscle"
"i want to be more healthy"
"i want to lose weight"
"i want to gain weight"

I Called the entity "Individual-goal"
Tha Output Context for this is "Fitness-Goal"

Now for my question:
i would like to segment OR create the "Sub-Context" for this Fitness Goal, in following category:
Health - Gain Weight
Health - Lose Weight
Health - General
Fitness - Muscle Building
Fitness - General

For this case:
1. Is it better for me to create multiple Intent ?
2. Is there a way to put a context based on the response, like "IF Individual goal contain 'gain weight' then Output Context set to "Health - Gain Weight"

Whats the best scenario for this ?

0 2 298
2 REPLIES 2

It is better to create separate intents as shown in the examples of this documentation.

j-c
Bronze 1
Bronze 1

Its a while since you asked this so you may have already worked it out. You probably need to create an intent for each category like 'gain weight; so another one for 'fitness building'.

As CX is a 'state machine' (think of it this as lots of rooms off a corridor) the conversation depends what room your in. So if your in a 'lose weight room' your intent keyword of 'weight' will mean 'lose weight in that room'. But in a 'gain weight' room any conversation around weight will pick up trained phrases that interpret this in a way that relates to adding on weight. 

Hence you need to chose how many separate 'rooms' (different topics) you need and build the dialog specific to each room through intent to get you in there, and then build up your fulfilment from it too. Each room is standalone really. CX only finds the trained answers for that specific room when it is in it. This is the 'state machine' in action.

From that map of rooms you then link your rooms together through pages / routes. 

The map starts in the 'default start page' so all rooms connected to start page ('routed') lead off it like a big entrance hall. User initially chatting 'gain weight' will be taken into that room (state) by CX. Once in there, unless you build a route directly from the gain weight room to the lose weight room, the visitor won't be able to access lose weight. They'd have to go back to the entrance hall to have a door into lose weight.

So you'll need to build a network of rooms through intent and pages, route them off a central entrance hallway and if you want them to interconnect you'll have to build a route network between them too.

It can get messy but it's genius when you get your head round it. Do the logical design first or frankly it can hurt 🙂