2
votes

I have created an entity "editable" having entries as {name, age, color, place}

bot: select an option to update [options are {name, age, color, place}]

user: name

bot: enter your name?

user: Xyz

bot: record updated. select an option to update [options are {name, age, color, place}]

this works fine

but if a user says something like "my name is Xyz" to update the name.

bot: select an option to update [options are {name, age, color, place}]

user: name

bot: enter your name?

user: my name is Xyz

bot: enter your name.

as when the user includes "name" in his phrase then bot matches it with entity and again ask the same question. how to resolve this issue, I just want to extract the "Xyz" though he uses the phrase "my name is Xyz".

1

1 Answers

0
votes

You can use contexts to handle the flow of the conversation. Contexts are used to help dialogflow detect the correct intent. Output contexts are the contexts created after the intent was detected, and input context is a context required for an intent to be detected.

Think of dialogflow contexts, as the real context of a conversation, there are some phrases that you can expect after an interaction.

Here's an example using 3 intents for this conversation:

  • "Default welcome"
  • "Updating name selection"
  • "Updating name"

Conversation

Intent detected: Default welcome

Agent says: "Select an option to update [options are {name, age, color, place}]"

Output context: "select-option"


User says: "name"

Input context: "select-option"

Intent detected: Updating name selection

Agent says: enter your name

Output context: "update-name"


User says: "My name is Xyz"

Input context: "update-name"

Intent detected: Updating name

Agent says: "record updated"


In addition to this, there are follow-up intents which are used for this scenarios, one of the advantages is that in follow-up intents, the contexts are created automatically.

Parameters

You can get all the information to be updated within the same intent. For this, you can add the paramaters as required and take advantage of slot filling. Notice that you can specify the define prompts to be used when asking for these parameters.

Actions and parameters

You would need to add training phrases that help indetifying different parameters given:

Training phrases

During the conversation, when this intent gets detected, the agent will try to match all the required parameters, and will ask for missing information. At the end, you will have access to this information:

Example of parameters collected

Consider that this kind of intents can quickly become hard to manage. Try using well defined entities for your parameters, and lots of training phrases (notice that in one training phrase you can collect more than one parameter, e.g., "My name is Xyz and I'm 27").