1

How would you approach a problem where a user can order multiple objects which each can have entities associated

For example with a user utterance "I want to order a large pizza with pepperoni and a small pizza with ham and pineapple"

I would want to Recognise two distinct pizzas The different size for each pizza The topping associated with each pizza

I know Rasa has an option called entity groups which can handle this but does dialogflow cx? Or is it better to design a conversation flow that manages the conversation in a way that doesn't allow this sort of input?

Oliver
  • 11
  • 1

2 Answers2

1

You would have to use a form parameter in your page collecting your pizza order. You can see in the form parameter documentation that there's a boolean option for each parameter of the form named isList that collects multiple instances of a particular entity type you specify, which in your case I assume it would be the entity pizza.

Mr. Nobody
  • 200
  • 9
0

For the example your provided ("I want to order a large pizza with pepperoni and a small pizza with ham and pineapple"), you can use numerical indexes in the intent parameter names in the training phrase annotations.

The annotations may look like this:

pizza intent

Numerical indexes will allow you to understand how many pizzas were ordered.

Extracted parameter values for this annotation will look like this:

pizza test

For this proof of concept, the fulfillment is defined as conditional response:

pizza conditional response

You can define more sophisticated dynamic responses in your webhook.

Note that if you opt for this approach, you will need to add multiple diverse training phrases and annotated all of them consistently. Check out agent design best practices.

An alternative approach – collecting parameter values one by one via required form parameters – has various advantages:

  • you don't need to add and annotate training phrases
  • parameter value extraction may be more accurate.

In form parameter prompts, you may need to instruct the end-user to responds with only one piece of information at a time.

Svetlana
  • 88
  • 5