DialogFlow : Using Original Value Associated with Parameter

DialogFlow : Using Original Value Associated with Parameter

Dialogflow has capability of converting the strings to required entities, and it’s quite powerful as well. It can extract entities from the user queries which we can use to complete the task.

No alt text provided for this image

We can see in the image above, that Dialogflow is able to recognize that today is date and london is a city.

We will be getting value of date, depending what user have asked, as part of Dialogflow raw API response.

No alt text provided for this image

We get this value in parameters, tomorrow is converted to actual date.

We can also use this in our response using $parameter_name

No alt text provided for this image

We can see that Dialogflow is intelligent enough to convert tomorrow into an actual date object, and showing human understandable date format in it’s response.


But sometimes, there might be a requirement where we want to use the actual phrase said by the user in our response, or for some processing.

How do we get that?

Well, there is no direct way to do this. But we can make use of contexts to get it done.

We will have to set an output-context in our intent. By doing so, we will get an extra value in our raw API response like below:

No alt text provided for this image

We can use it in the response using #context_name.parameter_name.original. Or we can use use it in our webhook for some processing, if required, as well.

In our example, context_name is book-flight and parameter_name is departure_date. So we will be using #book-flight.departure_date.original in our response. This way, response will be more human like.

No alt text provided for this image

Here is the question asked on stackoverflow from which this article is inspired : https://stackoverflow.com/questions/54678897/dialogflow-get-original-string-associated-with-parameter

Original article is posted on Medium : https://medium.com/@sid8491/dialogflow-using-original-value-associated-with-parameter-10c97b510982

Thanks for reading!

To view or add a comment, sign in

More articles by Siddharth Shukla

  • Introduction to Dialogflow

    What is Dialogflow Dialogflow (formerly called API.AI) is Google-owned chatbot development framework.

    1 Comment
  • Tensorflow performance : tensorflow vs tensorflow-gpu

    Recently I have bought MSI GV62 8RE laptop which has nvidia gtx 1060 GPU so I thought of tryig out how is it going to…

  • Chatbots (what and why)

    What are Chatbots? By a quick Google search we can see that a Chatbot is a computer program designed to simulate…

  • Show Analyzer

    Data Science refers to an emerging area of work concerned with the collection, preparation, analysis, visualization…

    4 Comments

Others also viewed

Explore content categories