Using key-value pairs as api.ai entities for Google Actions

310 views Asked by At

To create a simple Google Action app in Api.ai, you need at least one intent and some entities depending on what you want to do. In the published personal chef example by Google Developers, you have entities like dish, vegetables and etc. very simple. link to video

One step further:

How would you introduce a set of key-value pairs in API.ai? For example, how would you store data like this:

apple : 5, pear : 6, grapes: 4

So that when user says something like "do you have apples?", you could respond with " Yes, I have 5 of them."

Another example could be a small phone book that you can ask for people's number with their name (key) and get their number (value) read to you.

It seemed to be a trivial problem to solve but I can't figure out a way to do this on api.ai console.

1

There are 1 answers

2
SysCoder On BEST ANSWER

Setup your entity like this: enter image description here

Setup your intent like this: enter image description here

Bonus Material: If you are doing this, you probably want to put a lot of data in your entity. It might save you time if you switch to editor mode: enter image description here