How to build a Dialogflow CX agent with open questions?

1.8k views Asked by At

I am trying to build a Dialogflow agent for something like StackOverflow, where it takes care of the user asking a complete question. I want to store the answer (and feed it back to the user). For example:

User: "I get an error."
CX: "Which error?"
"Java.lang.NullPointerException"
"Okay, what have you tried so far to solve this problem?"
"I googled it but found no results..."
"On what line of code do you get the error?"
"if (running) {counter ++}"
"Okay, so to summarize:
 - You got the error Java.lang.NullPointerException
 - You tried: I googled it but found no results...
 - You got the problem on the line of code:  what line of code do you get the error?
Is that correct?"

With no 'Fallback Intent'-hack available in CX; how would I go about building a bot with open ended questions?

2

There are 2 answers

0
Leri On BEST ANSWER

Here is the following response to your comment How to build a Dialogflow CX agent with open questions?

To work with open ended (meaning: open answers that cannot be categorized into intents / parameters) questions, and store answers, you can use the same approach provided in my previous response, and utilize the “sys.any” entity and parameters.

To do this:

  1. When you create an intent for the utterances, annotate the utterances to the “sys.any” entity. Here is a sample for your reference: enter image description here

    You can change the name of your parameter-id to distinguish the parameters that you will use in each page.

  2. Add those parameters on each page. Here is the sample for your reference: enter image description here

  3. Continue applying Step 1 & 2 to your other intents and pages for the collection and storage of answers to your open-ended questions.

  4. When you have reached your final page, you can reference your parameters in the responses through this format: $session.params.parameter-name. Here is the sample for your reference: enter image description here

    You can check out reference session parameters for more information.

    When this is completed, this is how your use case similarly looks like: enter image description here

3
Leri On

To build a bot with open ended questions in Dialogflow CX, you can utilize the Flows and Pages features.

As an overview, Flows are used to define your topics and its associated conversational paths. For each flow, you can define many pages, where your combined pages can handle a complete conversation on the topics the flow is designed for. You configure each page to collect information from the end-user that is relevant for the conversational state represented by the page. Once a page becomes active, the agent follows several steps which may involve entry fulfillment, pre-filling forms, state handler evaluation, form parameter prompting, sending response messages to the end-user, and either a page change or a repeat loop.

For your use case, you can create a flow for the user getting an error and pages for the error details. To do this:

  1. Create an intent for the utterance “I get an error”.
  2. Add this intent as an intent route in your flow.
  3. In the same intent route, create a new page for the error.
  4. Under the Page’s Fulfillment, you can add your response as shown below:

enter image description here

This approach will leave an open ended question. See the test result below:

enter image description here

  1. Continue the flow by creating another intent for the utterance “Java.lang.NullPointerException”.

  2. Add the intent as an intent route in your page for the error(As an example: The page for the error is named “Error Types” and the intent name in Step#5 is “Java Error” as shown below):

enter image description here

  1. In the same intent route, create a new page for the “Java.lang.NullPointerException” (As an example, the page named is “Java Error Type” as shown below): enter image description here

  2. Under the Page’s Fulfillment, you can add “Okay, what have you tried so far to solve this problem?” as the response.

  3. Continue the flow by applying the same approach to your other open ended questions.

    When this is completed, this is how your use case similarly looks like in the visual builder: enter image description here

    See the test result below:

enter image description here