简体   繁体   中英

[dialogflow][actions-on-google] Composite entities for slot filling

I have a very basic example

I want to be able to add multiple types and quantities of things - the user may or may not enter the quantity in which case i want to ask for it.For example

I want to order 1 Margherita pizza Medium pan crust and a deluxe veggie

I have defined the following entities

@Pizzas
@PizzaCrusts
@PizzaSizes`

And a composite entity @PizzaWithCrustAndSizes which is made up of all three of the above.

In my request i have a slotfill parameter 'allPizzas' which is a list of the above composite type.

There is a webhook call which refines the order before confirming it. However when i receive the parameter - i get it as a string rather than an object type.

allPizzas: [ '1 Margherita Pan Medium' ]

How do i make Dialogflow send it as an object, is there any way

Yes you can achieve this

you have 3 entites

@Pizzas
@PizzaCrusts
@PizzaSizes

and a composite entity @PizzaWithCrustAndSizes

so in the entity @PizzaWithCrustAndSizes first uncheck the define synonyms checkbox then you will get the value field now enter the values as

@Pizzas:Pizzas @PizzaCrusts:PizzaCrusts @PizzaSizes:PizzaSizes

go to intent training phrases

I want to order 1 Margherita pizza Medium pan crust

remove all the individual entities and select "Margherita pizza Medium pan crust" and map it to composite entity "@PizzaWithCrustAndSizes"

it will give you the parameter value as object.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM