Notice: Function wp_is_block_theme was called incorrectly. This function should not be called before the theme directory is registered. Please see Debugging in WordPress for more information. (This message was added in version 6.8.0.) in /www/eksidoio_182/public/wp-includes/functions.php on line 6121

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807
Create chatbot using bot framework sdk and LUIS — Part 2 - VEP Test Site
Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Deprecated: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in /www/eksidoio_182/public/wp-includes/formatting.php on line 3539

Deprecated: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /www/eksidoio_182/public/wp-includes/kses.php on line 1807

Create chatbot using bot framework sdk and LUIS — Part 2

Create chatbot using bot framework sdk and LUIS — Part 2

In part 1 we completed basic structure of the bot service. In Part-2 our bot will give create, view and cancel options to the user.

This is continuation of Part-1. If you are coding along with me then follow this blog otherwise you can also download the completed code from here.

In Part-2 we will cover following:

  • Our Bot will give Create Order, View Order and Cancel Order options to the user.
  • We will add sub-dialogs for create, view and cancel.
  • For create order we will complete the basic flow of conversation.
  • For create order selection, conversation will be diverted to create order sub-dialog.
  • Bot will ask user to provide the order details.
  • Bot will then respond with the same order details (echo) provided by the user.

In the subsequent parts we will save the order details against the user id in a data storage. we will add intelligence to the bot with LUIS service to interpret the order description.

Creating sub-dialogs

Create a new folder in dialogs folder and name it operations. In operations folder create 3 scripts- createorder_dialog.py, vieworder_dialog.py and cancelorder_dialog.py

Let us start with coding createorder_dialog.py. In this part we will add only 2 steps (order_step, summary_step) in the waterfall dialog steps for create order. we will add more steps in the subsequent parts.

In the first step bot asks user to provide his order details. Second step is added to accept the text provided by the user in the context object and echo i.e. respond with the same text as bot’ response. in the next part we will save the order in the data storage. But for now just echo the text.

Add below code in createorder_dialog.py

We will also define the classes vieworder_Dialog and cancelorder_dialog. We will not add any waterfall steps for now. just the basic sturcture.

Code for vieworder_dialog.py:

Trending Bot Articles:

1. How Conversational AI can Automate Customer Service

2. Automated vs Live Chats: What will the Future of Customer Service Look Like?

3. Chatbots As Medical Assistants In COVID-19 Pandemic

4. Chatbot Vs. Intelligent Virtual Assistant — What’s the difference & Why Care?

Code for cancelorder_dialog.py

Now we need to update app.py to create objects of the new dialog classes we have created. These objects will be passed to the main_dialog class.

Below is the updated app.py:

Next we will update main_dialog.py. First update the init function to add parameters to accept objects of the sub-dialog classes. These objects needs to be added as sub-dialog. Call add_dialog method to add these objects in the dialog. In the waterfall conersation flow we will add one more step act_step after intro_step.

update intro_step to give Create order, View order and cancel order options to the user. In act_step add code to read the option selected by the user. Depending on users selection divert the dialog to createorder_dialog, vieworder_dialog or cancelorder_dialog.

Update main_dialog.py:

We have completed coding required for Part-2. In the next part we will add code to save order details provided by the user in a data storage. In the subsequent parts we will add more intelligence to the Bot to read and interpret the order details.

Now test the bot using Bot framework emulator. instructions for using emulator is already given in Part-1.

To be continued..

Don’t forget to give us your 👏 !


Create chatbot using bot framework sdk and LUIS — Part 2 was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.


Posted

in

by

Tags: