r/GoogleAssistantDev • • May 20 '19

User specific entities not present as session entities when using direct invocations. Is there a solution?

When adding session entities through the Dialogflow API (apparently currently not working properly with V2), there is a certain delay until the session entities appear in Dialogflow.

This delay can be handled somewhat when the writing of the session entities happens while the conversation is ongoing but it becomes a problem when the user is directly invoking an intent that relies on the session entities. So something like 'Ok Google, what's the status of XYZ?'. In that case Dialogflow is only matching with the developer entities and cannot find a match with the user specific session entities since they are not present yet. The matching seams to happen before any code is run on the fulfillment side. So if the session entities are pushed with the first intent that is sent to the fulfillment (a failed match) it works afterwards. So some seconds later the exact same phrase will match with the session entities since they have now been successfully added.

I've been looking into keeping a copy of the users entities in userStorage to possibly speed up the first API call, instead of getting the entities from a database every time. But so far the delay is still to great for this to work. Or the api push always happens after the match anyways, in which case it's not a problem of timing.

Of course I could add all user entities to the developer entities but that is not very practical either since those entities are supposed to be private.

Is there any way around this?

3 Upvotes

3 comments sorted by

2

u/afirstenberg GDE May 20 '19

The way I handle this now (or when it worked, anyway) was to leave this as @sys.any and then try to do the matching locally when first invoked. This is non-optimal.

I've considered something similar where the only thing the Welcome Intent does with invocations such as this load the Session Entity and then call Dialogflow's detectIntent() via API to do the processing, but this seems kinda messy.

1

u/qriss May 22 '19

Thank you. That's certainly a possibility. To try and match this locally. But... I really don't want to go there if possible. Hole different kind of headache.

Your second approach would certainly be interesting too. To catch that first invocation and basically trigger another one automatically with the entity that the user requested. If that is actually possible. I will look into that.

On the other hand I would expect this to be on the road map to be fixed somehow. Direct invocations are quite important for many use cases and session entities are a central feature that allows for very personalized agents.

So I guess we need something like 'user entities' in addition to developer and session entities.

Or sessions that can persist for a very long time.

2

u/agildehaus May 24 '19

User entities are exactly what we would need. Something tied to the Google account that we can update at-will. Either stored indefinitely or with a long, known expiration so we can periodically refresh it.

I'm looking to create a genealogy app, and it'd be great if my users could say things like "Okay Google, ask <app> how old <proper name associated with user's account that my app previously stored with Google> is."

But this seems impossible currently :(

Let me know if you find some way of accomplishing it.