Building a response in Dialogflow using multiple responses - dialogflow-es

Please excuse me if this is a really basic question - I'm very much still learning, and I just cannot find a solution.
I'm trying to use the standard basic text responses in Dialogflow, which from what I understand, should work.
What I want to do, is have a set statement (Okay, let's see what I can find), then a random pick from a list, then another set statement, essentially stacking the responses in Dialogflow (see screenshot).
It works absolutely fine in Dialogflow's test console - however, it doesn't do what I want when I take it into the Google action simulator.
Have I made a stupid error, missed a toggle switch somewhere, or am I trying to do something unsupported?

To surface text responses defined in Dialogflow's default response tab go to the Google Assistant response tab and turn on the switch that says "Use response from the DEFAULT tab as the first response.":

Related

Dialogflow - Repeat last sentence (voice) for Social Robot Elderly

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!";
}

Fallback intent as a search

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.

How to remove simple response when displaying list card in actions on google for phone surface

Hi i'm having facing a problem that i have selected phone surface where returning both simple response and list card.But in display i'm getting both in simulator.How to remove the simple response when using or displaying list card.
This requirement is for both google home mini and assistant in phone.
Here i need to clear that their is no request from user by clicking
list card.It is only meant for display purpose.
whether my way of implementation is wrong or not don't know correct me if i am wrong.But is it possible to remove or any other way to get rid of the simple response?
Keep in mind that you must have at least one SimpleResponse, in addition to any other RichResponses you may send. This SimpleResponse can contain a blank space - but it must exist. (It should, however, probably include more than a blank space.)
Use following code to detect the Surface
const screenAvailable = conv.available.surfaces.capabilities.has('actions.capability.SCREEN_OUTPUT');
If Surface present, only use UI based response.
If Surface is not present, only use simple response.
Test on a real mobile device and home as simulator shows extra information during simulation.

Google retiring "ranking" email action...how to replace Gmail/Schema.org actions

I'm wondering how I can replace the functionality of the Google ranking action.
I'm sending out email at the end of a ticket/support issue and want to be able to let customers state whether they are happy or not with the service they are getting without opening a web browser(inline button/link) or another method. I was trying to hijack the RSVP method however it appears as if the only answers you can set are "Yes, No, and, Maybe"
Looks like there is a lot in SCHEMA.ORG seems like Google has given up on any additions to the basic 3(Yes,No,Maybe) buttons with no real options.
Thanks

How to write text values in masked field?

i need some help related to masked field in web form. Syntax of phone field is (___)___-_____, if i execute this code in ruby shell
browser.text_field(:id => 'txtphone').set '7893457889'
... nothing has been added in the phone field.
then i find this solution in one blog, someone said first unmask this field using this code.
browser.text_field(:id,'txtphone').fire_event("unmask")
then write the above code again.
browser.text_field(:id => 'txtphone').set '7893457889'
but still nothing has happened. kindly help me out...am i doing right or still there is a mistake.
If you could provide some sample of the page HTML it will be easier to give you an answer more likely to work.
Given what you have provided us to work from, we have to go with the normal way that such masked input fields typically work and go from there. Usually pages with this kind of thing are calling a javascript function which is triggered by a specific event. Most often this is an event such as onchange but it may be something like keypress or any other even that happens when a normal user types or pasts text into the cell.
You likely need to experiment with using the '.fire_event' method to fire the proper javascript event, or if that fails entirely making a direct call to execute the proper script
When doing this do not confuse the name of a script such as 'applymask' or somesuch with the javascript event which causes that script to be invoked.
The answers to this question How to find out which JavaScript events fired? include some good information on how to use firebug or the chrome developer tools to figure out what events are being fired when you interact with an object on the browser screen.
Update: instead of responding here to indicate if this answer was of any use the OP reposted their question here Masked Text Box issue and by digging around on the vendor's demo site (since that time he actually had posted some of the HTML when we asked for it) I was able to find a solution using watir-webdriver that worked for him.

Resources