In my Dialog Flow agent, I have an entity @city
. Possible values are New York
, Berlin
, ... But Amsterdam
is not in that list.
Is there a way to dynamically validate an entity value against the values in my SQL database? For example, if the user writes Amsterdam
, I want to give the user an hint that he should ask for another city. Can this be done via a webhook?
Or should I synchronize my database cities with the agent on a regular basis? If so, can this be done via an API?
I am not sure what the standard way of this is here.
Automated expansion is used when a user input matches an intent but the entity value doesn't exist yet. See a detailed explanation in the documentation. Example: Entity color [blue, green] Intent "My favorite color is [color]"
To help agent designers create high-quality agents, Dialogflow provides a validation feature. Agent validation results are available automatically whenever agent training is performed and completed. You can access the results of validation from either the Dialogflow Console or the API.
How to enable and use developer entities in Dialogflow. Create developer entities. Edit intent to accommodate the newly created developer entity. Test your chatbot.
Dialogflow sends an API interaction response for each step of slot filling. For each of these slot filling responses, the intent and action will be the same, and the parameters collected so far will be provided. When building an agent, you provide prompts that the agent will use to get parameter data from the end-user.
You have a few options here, depending on what will work best for you.
In the most simple case you can set the parameter entity type to @sys.any
and handle all the name resolution in your webhook. This is the worst possible scenario.
As you've done, you can create your own entity type, @city
, and populate it with a few cities. If you want to populate it with the cities in your database, there is an API (hence the old name, API.AI) that lets you create and modify Entities. See the documentation at https://dialogflow.com/docs/reference/agent/entities for details.
Even best, however, might be a combination of the two. You have an Intent that uses @city
, and another lower priority Intent that uses @sys.any
(or a fallback intent) that handles the case of them saying something you don't understand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With