We have an language learning Action, where the user can ask say anything they want. When they say "dinner", our Action immediately quits, without saying the cancel response.
We tried several other Actions and they all behave the same way.
Except Google Translate that says "Something went wrong".
Is there a way for our Action to react on "dinner" somehow?
I think you should make another intent where you can mention "dinner" as a training phrase. Then you can give a response against that training phrase. This might solve your problem.
Related
I am using actions-on-google and Dialogflow to build a social robot for Elderly.
I was wondering how I can easily repeat the last sentence when asked by the user ("repeat please") as often the Senior doesn't hear the sentence the first time.
One way would be to have repeat followup intents in Dialogflow but this is quite heavy since :
you need to add one after each intent and I have many
in a multi-user environment you need to keep track of the last sentence for every user ...
Another way would be be to take advantage of Dialogflow Contexts. As you send the message, you can also add that message to a context (for example, you can call it "last_message"). You can then have another Intent that takes as an input context the "last_message" context and, if triggered, uses the value saved in the context to repeat it.
However, I still have the problem that I need to add a context to every intent I have, which are many.
Does anyone know how to accomplish this in a quicker way? I found this package but it is in JS and I need it Python: https://github.com/SysCoder/VoiceRepeater/pulls .
How do I implement this VoiceRepeater library? Do I put the code under fulfillment function 'repeat' I have made and mapped to an intent called 'repeat' that I have made which responds to utterances such as 'Sorry, could you repeat that'? Also, where do I install the VoiceRepeater library (code: npm install voice-repeater --save)?
Using Followup Intents is probably the wrong way to do this. As you note, it is way too heavy for more than a few Intents. It may be useful in certain circumstances if you want the "repeated" message to clarify the response in a different way, but in general, it isn't very useful. (It should also be noted that Followup Intents use Contexts, but in a different way than discussed below.)
You don't need to add the Context to the UI as part of the Outgoing Context - you would set this as part of your Fulfillment. It would include a parameter that either contained exactly what you said, or the information you needed to recreate what you said (possibly in a different form, if appropriate). In your "repeat" Intent, you'd read the value that you had saved in this Context, and send it as the output again. If you're using SSML, you may wish to change the speed or volume, if that is appropriate.
Update based on new questions
The readme for VoiceRepeater has the basics of what you need to do to use it, but it does assume a little familiarity with Node. But in general, yes, you install it the way you describe, setup an Intent that captures requests to repeat, and registers a handler function (repeatLastStatement(app) in the readme) that handles the Intent to send a reply through voiceRepeater.lastPromptWithPrefix().
It also may assume you're using version 1 of the actions-on-google library. I haven't dug too deeply into the code, but it looks like it replaces the library's ask function with its own, and I'm not sure how well that works with version 2 of the actions-on-google library.
Unlike Voice Repeater, multivocal doesn't require you to register handlers specifically since it tries to hide as much boilerplate under the covers. You just need to define the replies that you might want it to use. It uses the Context scheme I outline above to store responses and make them available when the user asks for it to be repeated.
There aren't any videos on using multivocal, but the simple example does include the configuration illustrating how to configure responses for the "multivocal.repeat" Intent. While VoiceRepeater works with the actions-on-google library, multivocal is a complete replacement, offering a more template-based approach to building fulfillment.
However, neither of these directly help you if you want to implement it for Python. But if you look at the source for VoiceRepeater, you can get a sense for how to implement it yourself in Python.
The key bit is on line 47 where it saves the reply in a context. (It also saves the reply with a prefix message.) It then calls the original function that would send the reply:
app.setContext("last_prompt", 100,
{
"last_prompt": textToSpeech,
"prefixed_last_prompt": repeatPrefix + lastStatement,
});
originalAsk(response);
Later, in the call to lastPromptWithPrefix(), it uses the contents of the Context to send a reply.
lastPromptWithPrefix() {
return this.app.getContext("last_prompt") !== null
? this.app.getContextArgument("last_prompt", "prefixed_last_prompt").value
: "um....I don't remember what I said!";
}
I created a very simple agent on dialogflow. Every now and then, even using static responses (where only the session ID changes), the application crashes (both on Google Assistant and in the simulator).
On the logs I find the message in question: "MalformedResponse at expected_inputs [0]: Responses must provide at least one possible if this is not the final response. What does it mean?".
I don't understand what it means.
Could anyone help me?
I'm having the same problem. That i've noted is that this problem doesn't ocurre every time. The behavior is really unstable.
I'm using 2 required parameters in the intent. I don't know if that has something to do with the problem.
MalformedResponse at expected_inputs[0].input_prompt: 'input_prompt' is empty
MalformedResponse at expected_inputs[0]: Responses must provide at least one possible intent if this is not the final response
The problem, appears to be caused when you use own parameters, not when use sys. parameters.
Google answer me the following:
"Hi Alberto,
This issue has already been escalated to our engineering team. You are correct about required parameters causing the problem. Our engineering team is working thoroughly to resolve this since it is affecting some other AoG projects as well. "
I was facing the exact same issue when I was using custom entities as input parameters to my action.
I was asking for 2 custom parameters and one system (sys.color) and triggering the same with input prompts.
I found a workaround for that by taking all 3 in separate intents and using the response of the previous intent as a trigger to enter the next parameter, also by making the training phrases as sample values of the custom parameter.
I am still in contact with Dialogflow Suppport and waiting for bug fix but it works for now.
The bot which I have created within Dialogflow is using a webhook to link to our external site.
One of the intents we have for the bot is to search for knowledge
within the site. Originally, we had in the Request Knowledge intent,
a phrase which was a #sys.any parameter, which would then be the
search term.
However, because the whole phrase was a #sys.any parameter, this
would be prioritised over most other intents.
We are trying to get users to use natural language when using the
bot, however people still do just type in one word or a phrase for
the search function.
What I would like if possible is to have a fallback intent which is
the search function. So if the bot cannot successfully match the one
word, it would then run a search for this word.
I am not sure if this would fix this problem or just produce more issues.
If anyone has solved something similar to this, I would greatly appreciate the help. Sorry if this is simple to do, I am all new to the whole Dialogflow world!
You can turn fulfillment on for Fallback Intents, and these will be sent to your webhook. The JSON includes the full text of what was entered.
However... the results will clearly be less useful since some of the results will be text that is conversational, but didn't get picked up by one of the other Intents.
What's wrong with Wit.ai ? My bot understand few numbers as location and it breaks my stories. You can see the picture below :
What can I Do for that ? Thank you.
If you earlier have validated some GPS coordinates on your Understanding console, this type of misprediction may be possible. For avoiding that, you can validate some useful numbers with the wit/numbers intent, other GPS coordinates should be validated with the wit/location.
Also you may accidentally validated some numbers using the wit/location entity, feed some numbers with the wit/numbers entity. wit.ai does not know anything about numbers, locations, etc, without you validated them first.. Try to write " Amsterdam " on your Understanding tab, you'll see that wit.ai cannot assign this text to any intent or location entity because you have not trained his modal yet :) Validate it with wit/location. After that he will know..
Also you can train(validate or feed) your own wit.ai NLP without the Understanding tab. You may use simple CURL command and a loop.
Check this out:
https://wit.ai/docs/http/20160526
Have a nice day :)
What is the simplest way to make a confirmation dialog in Yesod? In some cases, when a form is posted, I want to ask for confirmation before carrying out the action. I imagine this working by sending the user a separate confirmation page, and then processing the posted data if the 'Yes' button is pressed.
I think this should be possible, using functions like setUltDestReferer. The question is, what is the easiest/most typical way to do it in Yesod? Ideally it should boil down to a single function call in the handler, like requireAuth does.
If I understood this right, you want something that will
Render some confirmation page and abort further processing of the request.
Have the "Yes" button link back to this handler and set a flag.
If the flag is set, do nothing and continue with the request instead.
This immediately raises the question of how the original form data should be carried along. There are ways of solving this, e.g. by storing it in the session or by including it URL encoded in the "Yes" link.
The latter approach works, but can be a bit messy. The former can cause problems when users hit the back button, open links in new tabs and so on. This comes from the stateless design of HTTP.
Instead, it might be cleaner to create a new AJAX handler and add some JavaScript that
Calls the handler to check if confirmation is needed.
Shows the confirmation if that was the case.
If the user clicked "Yes", proceeds with submitting the form as you normally would.
I recommend you go with #hammar's approach, I think it's the best. If for some reason AJAX isn't an option, you can consider putting a hidden form on the confirmation page containing the form data submitted from the first page. This should be fairly trivial using runRequestBody.