Routing with common training phrases

google-assistant
dialogflow

#1

Hello.

I’m currently porting a dialogflow project to Jovo because I want to run it with amazon alexa and eventually other virutal assistants.

My project is a very long narrative experience with A LOT of intents, and some of them have common training phrases (the “yes” and “no” for example, but there are others that are a much more specific.)

With the input and output context of Dialogflow, it was easy to differentiate those intents. If you answer yes at the third question, it won’t route you to the forty-fifth question where you could also answer yes…

I thought the Jovo States followed the same principle, but this doesn’t seem like it’s the case. For example, at the beginning of my experience, I’ve got a yes/no question, which should route to the yes or no intent that i put in my State 2 (and it’s working using the Jovo debugger…) but instead in Dialogflow i got routed to a random intent from ANOTHER STATE, and I get a routing error.

Since it’s working with the Jovo debugger, this seems to be a Dialogflow-related problem. Any idea on how to fix it?

Thanks for you help,
Lucas.


#2

Hi @Lucas_Rioust, welcome to the Jovo community :wave:

Could you provide a response (with e.g. State 2 in it) and a following request from Dialogflow? Would be helpful to see if it’s a problem with Dialogflow or Jovo.

Also, this course offers a general introduction into state management with Jovo: https://www.jovo.tech/courses/project-2-adventure-game/step-5-introduction-to-states


#3

Hi @jan,

So first, at the beginning of the application, this response is sent to the user :

{
“fulfillmentText”: "\n <audio src="https://storage.googleapis.com/link_to_my_sound.mp3 ">\n …\n \n ",
“outputContexts”: [
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/_jovo_session_lpaet”,
“lifespanCount”: 1,
“parameters”: {
“sympathie”: 0,
“fallbackcount”: 0,
“marque”: “google”,
JOVO_STATE”: “02”
}
}
],
“payload”: {
“google”: {
“expectUserResponse”: true,
“richResponse”: {
“items”: [
{
“simpleResponse”: {
“ssml”: "\n <audio src="https://storage.googleapis.com/link_to_my_sound.mp3 ">\n …\n \n "
}
}
]
},
“noInputPrompts”: [
{
“ssml”: "\n <audio src="https://storage.googleapis.com/link_to_my_sound.mp3 ">\n …\n \n "
}
],
“userStorage”: “{“userId”:“131c80cb-3bf6-44ed-9e5e-ca215d4d6b21”}”
}
}
}

Here you can see that the Jovo_State is set to “02”, which is the state in which i put my two yes and no handlers ub lt app.js :

“02”: {
parler_non() {
do_things();
}
parler_oui(){
do_some_other_things();
}
}

Unfortunately, while the training phrases of those two intents are correctly set up (and I say this because this works in Jovo and Alexa…), the matched intent is on another state. Here :

{
“responseId”: “28028bbd-f8d1-45a7-b528-3301f293bfd0-d5092e1d”,
“queryResult”: {
“queryText”: “oui”,
“parameters”: {},
“allRequiredParamsPresent”: true,
“outputContexts”: [
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/actions_capability_media_response_audio”
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/actions_capability_account_linking”
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/actions_capability_screen_output”
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/actions_capability_audio_output”
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/google_assistant_input_type_voice”
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/_jovo_session_lpaet”,
“parameters”: {
“sympathie”: 0,
“fallbackcount”: 0,
“marque”: “google”,
JOVO_STATE”: “02”
}
},
{
“name”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88/contexts/system_counters”,
“parameters”: {
“no-input”: 0,
“no-match”: 0
}
}
],
“intent”: {
“name”: “projects/jovo-mjid/agent/intents/3cb72cda-bc21-4c9f-af10-ec91b03aa440”,
“displayName”: “lalala_oui”
},
“intentDetectionConfidence”: 1,
“languageCode”: “fr”
},
“originalDetectIntentRequest”: {
“source”: “google”,
“version”: “2”,
“payload”: {
“user”: {
“locale”: “fr-CA”,
“lastSeen”: “2020-09-10T07:45:53Z”,
“userStorage”: “{“userId”:“131c80cb-3bf6-44ed-9e5e-ca215d4d6b21”}”,
“userVerificationStatus”: “VERIFIED”
},
“conversation”: {
“conversationId”: “ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88”,
“type”: “ACTIVE”,
“conversationToken”: “[”_jovo_session_lpaet"]"
},
“inputs”: [
{
“intent”: “actions.intent.TEXT”,
“rawInputs”: [
{
“inputType”: “VOICE”,
“query”: “oui”
}
],
“arguments”: [
{
“name”: “text”,
“rawText”: “oui”,
“textValue”: “oui”
}
]
}
],
“surface”: {
“capabilities”: [
{
“name”: “actions.capability.MEDIA_RESPONSE_AUDIO”
},
{
“name”: “actions.capability.ACCOUNT_LINKING”
},
{
“name”: “actions.capability.SCREEN_OUTPUT”
},
{
“name”: “actions.capability.AUDIO_OUTPUT”
}
]
},
“isInSandbox”: true,
“availableSurfaces”: [
{
“capabilities”: [
{
“name”: “actions.capability.AUDIO_OUTPUT”
},
{
“name”: “actions.capability.WEB_BROWSER”
},
{
“name”: “actions.capability.SCREEN_OUTPUT”
}
]
}
],
“requestType”: “SIMULATOR”
}
},
“session”: “projects/jovo-mjid/agent/sessions/ABwppHFyokiDerHTGj3nIgk5FwtASmvhEj10b0UHcwKHohaPcPgSXWr52O5w-YfucR6WKSKFZp88”
}

I get the routing error :

Message:
Could not find the route “02.lalala_oui” in your handler function.

And that’s understandable, because lalala_oui() is in the “39” State.

I’m lost here, i don’t know why Dialogflow wants to look at matches with intents in other states.
Thanks for your help.


#4

It seems like 02 state is set in the request and response. Are you setting 39 as a state somewhere?


#5

No, 39 never shows up. It looks like to me that Dialogflow simply ignores the Jovo_States I set up in my app.js and instead matches the first intent with valid training phrases it finds.


#6

Yes, this seems like expected behavior to me. The state is a session variable (learn more here) that is handled by the Jovo app. Dialogflow knows nothing about it, it just sends it back to the Jovo app. In your code, you need to define which states should be added.

Is there anything we can do to make the documentation clearer? https://www.jovo.tech/docs/routing/states


#7

No, I’m setting the state correctly in my handler.

For example, at my starting intent, i have

this.followUpState(“02”).ask(things_to_ask);

The state is set to “02” here, but Dialogflow just don’t want to acknowledge it, while it works on Jovo and Alexa debugger.


#8

Dialogflow doesn’t know about the state and matches to whichever intent it thinks is closest to the utterance.

It seems like your parler_oui and lalala_oui intents are similar, could you share your phrases for both?


#9

Yes they are indeed very close. There are matching training phrases.

After reading the Jovo documentation, I thought that Dialogflow would only try to match the phrases with intents contained in the Jovo_state you’re in. Isn’t that the whole point of Jovo_states?

Sorry if I’m missing the point, but I was pretty sure that the States were used as an alternative to Dialogflow’s input and output “Context”.