0

When you present a Google Actions carousel/list on Assistant, you get a list of items. For example:

  • Soccer
  • Basketball
  • Rugby

Next, the user can say Soccer, Basketball or Rugby but not Tennis, Cycling, ... This means that the matching happens in the current context, as created by the carousel or list. This is powerful, as the backend service will only be called upon expected inputs.

I would like to have this behavior in a general conversion; that is, outside the carousel or list functionality. In my application, the user asks for a list of sports. The fulfillment service returns a list of suggested sports. Now the user can repeat a certain sport, to retrieve more information about that sport. If he mentions a sport which was not recently enumerated, an error message could be read out.

I know this could be implemented by keeping the list of mentioned sports in the context and checking against that context in the fulfillment backend service when the user ask for a specific sport. But as said, I noticed that the carousel or list already somehow provide such functionality, which does not rely on the backend service, so I was wondering if there was a better way to implement this behavior?

One way could be bookkeeping user entities during the conversation? That is, we could create a user entity user sport which only holds the sports as previously mentioned. This way, if the user asks for a sport not in that list, there will be a matching error. I am not sure if this is a good application of user entities, though.

Are there better ways?

Andrew Eers
  • 347
  • 2
  • 16

1 Answers1

0

You can use entities for this purpose. Create an entity for the desired list of values (i.e. Soccer, Basketball or Rugby) with an entity type of preferredSports (or similar). Then in a intent use the preferredSports entity in your training phrases and don't use names or sports or entity that don't include your desired list of values. The intent will probably not be matched unless a user says on of the values of the entities you're trying to capture. Learn more here: Entities docs, Intent docs

mattcarrollcode
  • 3,429
  • 16
  • 16
  • Thank you for your feedback! I understand the concept of entities and have been using them, but my question is more specific. Say you have an entity `preferredSports` with 100 sports. The user asks for 5 sports available in his city. These 5 sports are proposed by the service. Now, when the user says `I want more information about soccer`, I only want a match when `soccer` is one of these 5 sports proposed earlier. So I want a contextual match of `preferredSports`. That's exactly how the carousel/list is behaving, so I am wondering how to implement this outside the scope of a carousel/list. – Andrew Eers Mar 10 '18 at 14:23