0

I am trying to connect different entity types or entity properties. Consider this case:
I have a list of animals and I have a list of vegetables
Each animal eats a subset of vegetables - Cow eats veggieA,veggieB and Hen eats veggieB,veggieC
Once Cow is in context, the only vegetable entities I want to catch are veggieA and veggieB. Even if veggieC is mentioned, I do not have want to catch this entity for all my follow up intents

How can I achieve this?
Can I have an animals entity type with a list of animals like Cow,Hen etc and a vegetable entity type with a list of vegetables like veggieA,veggieB etc
Or like Each animal form a different entity type - Cow is a entity, Hen is a entity
How can I connect different entities like how I described earlier?

Jordi
  • 3,041
  • 5
  • 17
  • 36
Sid Anand
  • 167
  • 1
  • 10
  • What version of Dialogflow are you using, Dialogflow Essentials or Dialogflow CX? – Jordi Nov 06 '20 at 17:07
  • Im using Dialogflow CX, do you have any suggestions – Sid Anand Nov 09 '20 at 02:32
  • Could you please provide a sample dialog consisting of expected user queries and bot responses that would illustrate what you mean by “Cow is in context” and also illustrate different bot behavior depending on the entity value extracted? – Riel Nov 12 '20 at 02:10

1 Answers1

0

The key point to consider is that any value within an entity (custom or not) will be a valid match for a particular intent that has that entity as a parameter.

Meaning, if you have an animal entity and a vegetable entity, even if you train an intent Cow-intent only with cow as the animal this intent will be matched regardless of the animal you submit. As far as I know you cannot restrict the entity values that are valid within an intent.

For this reason, the easiest approach to ensure your behavior is met is to create separate entities for each animal (group of animals with the same veggies). Then create specific intents for each animal entity which follow-up intent/s will have a specific vegetable entity assigned as well. Meaning, a lot of particular entities instead of general ones. You would have entities: Cow-like,Hen-like,Cow-veggies,Hen-veggies,...

If that seems unfeasible for your particular use case you can also try to keep general entities and code some conditionals in the Webhook Fulfillment to handle your particular behavior, similar to what is done in here.

aemon4
  • 1,037
  • 6
  • 11