Handle dynamic group with various group schema

Hello, I want to create assistant that handle orders of coffee, ice cream and drinks

There are entities:

  • item_size - 200ml, 300ml, 400ml
  • drink_type - cola, sprite, fanta, …
  • coffee_type - latte, double latte, cappuccino, …
  • topping_type - chocolate cookie, fresh lemon, …
  • ice_cream_type - banana, chocolate, banana+chocolate, …

And i want to handle examples like these:

  1. i want two banana ice cream and cappuccino please
{coffee_type: cappuccino, item_size: None, topping_type: None}
{ice_cream_type: banana, item_size: None, topping_type: None}
{ice_cream_type: banana, item_size: None, topping_type: None}
  1. banana and chocolate ice cream in small cups
{ice_cream_type: banana, item_size: small, topping_type: None}
{ice_cream_type: chocolate, item_size: small, topping_type: None}
  1. please me big cola, one banana ice cream with chocolate topping and small cappuccino
{drink_type: cola, item_size: big}
{ice_cream_type: banana, item_size: None, topping_type: chocolate}
{coffee_type: cappuccino, item_size: small, topping_type: None}

My question is: Is that possible to handle 1, 2, 3 using DIET’s roles/groups? And how?

I don’t understand how to design domain to 1 and 2 examples

This is a good use case for forms. I don’t think you’ll need roles for this but you could choose to use them.

Forms require static schema. For example, one item_size and one coffee_type. I think there is only choice to write custom action here.

In my examples I don’t know which exactly slots to collect before user message. NLU have to understand number of positions in food order (i suppose to use group here) and understand which schema it relates to (coffee, drink or ice cream).

Any suggestions here?

No, forms can be dynamic. You can modify required_slots as slots are filled. See dynamic forms for details.

1 Like

I solved this following way:

NLU:

  • component with context-free grammar rules to extract entity and group
  • DIET classifier for intent/entity/group classification
  • hybrid component to join predictions of rules and diet with some logic

Form:

  • 3 different forms for coffee, ice_cream and drink
  • custom action to determine which form to collect
  • custom action to select and run next form

Thank you a lot @stephens