简体   繁体   中英

How to capture user text with Dialogflow

I am working on creating a new bot for google hangout chat. It seems like using Dialogflow may be the best tool to do so. (Please advise otherwise if I am wrong). The goal is to be able to create a Q&A bot that is able to retrieve the full response of the user as the answer.

I have tried googling a few different search terms but have not found the answer, I am starting to think Dialogflow is not the right tool for me.

The bot I want to create should be able to have the following conversation: (B: Bot, U: User)

U: I would like to work remotely today.
B: Ok, please let us know what you will be working on today
U: I will be completing task A, B and C
B: Great, your team has been notified that you will be completing task A, B and C.

or

U: I will be in the office late today
B: Sure, what time do you think you will be in the office?
U: Before 2pm
B: Great, your team has been notified you will be in the office before 2pm

I have been trying to do this with Dialogflow. I am able to get the bot to ask for the next input by making a parameter required and then prompting for more info, the problem is that the response to the prompt requires me to input fixed answers via Entities. It can't capture the complete user response as the answer.

It isn't clear which response you think you need the "full response" for. In general, Dialogflow works to help you get the important bits of the information you need as parameters and help filter out the other parts of the user's input that may vary, but is semantically the same.

So in your first example, you probably want to pick up phrases such as

  • I'll be [completing tasks A, B, and C]
  • I'm [working on D]
  • Probably [continuing with E and F]

The parts I marked with [brackets] are really the parts you want, with the other components of the reply being semantically the same. You can mark each of these parts with @sys.any , which is something like the regular expression .* (but not exactly).

For your second example, you may want multiple Intents that match your reply. Remember: Intents match what the user says, not how you handle that reply .

One intent may collect specific answers with times such as:

  • Sometime [after] [2pm]
  • [Around] [3]
  • [Not before] [1:30]
  • Probably [not] [today]

Each of these have two parameters - one being the time and the other being a phrase relative to that time.

You can also have other intent with phrases like

  • It depends
  • I don't know

and these don't need parameters at all. The Intent itself should reflect what the user is intending to say.

In all of these cases, you will want to set a Fallback Intent for the specific question you're asking. You may just want to record that answer, or you may want to use the Fallback Intent to prompt them for what kind of message you want.

You need to figure out what user might say to your bot and based on that you need to create different intents in your dialogflow agent.
When user says something, dialogflow will try to figure out what is the intention of the user by matching the intent and extract the parameters from it, and you can configure responses based on that.

For example, you can make an intent work_remotely with user phrases I would like to work remotely today , I would like to work remotely today and will be working on tasks A, B and C .
Assign a parameter @sys.any and highlight A, B and C . Also, you can mark that parameter as required and provide a prompt Ok, please let us know what you will be working on today for which user will respond with tasks he is working on. Finally the bot will capture parameter value and give a response Great, your team has been notified that you will be completing task $parameter_value.

Similarly, you need to design multiple flows, make intents, train it with user phrases, provide parameters and responses.

Hope it helps.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM