Category: Chat

  • Create chatbot using bot framework sdk and LUIS — Part 1

    Create chatbot using bot framework sdk and LUIS — Part 1

    We will create a simple e-commerce chatbot using Microsoft bot framework SDK in python. Our bot agent is a Bakery Shop agent. Users can request the bot to create an order , view orders and cancel order.

    Source code for the bot is available here. You can download the code from the git directly or you can follow this blog to code along with me.

    We will develop the bot in multiple parts.

    Part 1 — Below mentioned conversation flow we will complete in part 1:

    • bot will welcome and greet the user [this will be implemented using an adaptive card]
    • Bot will ask the user whether he is an existing user or a new user [using option buttons]
    • If user responds as new user then a new user id will be generated and displayed to the user as response
    • If the user’s response is “Existing user” then Bot will prompt user to provide his user id.
    • User id provided by the user will be saved in the context object.

    Tools and Libraries used:

    • VS Code as development environment
    • Bot Framework SDK python libraries for designing the flow for conversation
    • LUIS App for adding intelligence to the bot.
    • Bot Framework Emulator to test the bot

    Create a bot service:

    Open your working directory in VS Code. Create python script files config.py and app.py.

    In config.py add below code to save the port number, microsoft app id and password in the configuration attributes. Microsoft app id and password are required for Bot framework SDK.

    PORT = 3978

    Now in app.py. We will create the basic structure of the bot service. copy the below code in app.py.

    In the above code we are importing libraries required for bot framework. Pip install these libraries. We have created the main bot message handler method “messages”.

    Now the service is ready, we will create the bot response.

    First create a class to save the context values related to the user like user id which we would preserve to use throughout the conversation.

    In the main project folder create a new python script user_details.py, create a class with an attribute user_id. We will add more attributes as we proceed.

    Adding helper classes:

    We will now create few helper classes. Create a new folder in the main project and name it as “helpers”. Add __init__.py, activity_helper.py and dialog_helper.py. Base code of activity_helper.py and dialog_helper.py are taken from bot-builder samples provided by microsoft. Activities are the main objects of bot framework that drives the bot.

    add below code in __init__.py

    __all__=["activity_helper", "dialog_helper"]

    Copy below code in activity_helper.py:

    Copy below code in dialog_helper.py. Object of UserDetails class is initialised here and None is set as user_id.

    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?

    Adding bots:

    Base code is taken from bot-builder samples . Create a new folder with the name bots in the main folder. Add 3 files “__init__.py”, “dialog_and_welcome_bot.py” and “dialog_bot.py”

    In __init__.py add below code.

    from .dialog_bot import DialogBot
    from .dialog_and_welcome_bot import DialogAndWelcomeBot
    __all__ = ["DialogBot", "DialogAndWelcomeBot"]

    Base code of dialog_and_welcome_bot.py is taken from bot-builder samples. Code is updated to use an adaptive card as response. First we will add an adaptive card. Create a folder in the main project and name it as cards. Add the json for the adaptive card in this folder. You can use the json script given below or can create your own adaptive card by visiting https://adaptivecards.io/designer/.

    Add below code in dialog_and_welcome_bot.py.

    Now we will add code in dialog_bot.py. This will be accessed from app.py. DialogBot object initialization expects a parameter dialog object. We will next define this class.Add below code in dialog_bot.py:

    Now we have basic structure ready. We have to tell the bot what to response and how to drive the conversation. For that we will be using Bot Framework’s waterfall method of defining conversation flow. For now we will create 2 dialog flows one to handle cancel and help and the second one will be the main conversation. We will add more dialogs as we proceed.

    Creating Dialogs:

    Create a new folder dialogs. Add 3 files — __init__.py, cancel_and_help_dialog.py and main_dialog.py.

    Code for __init__.py:

    Code for cancel_and_help_dialog.py:

    Next we have to code main_dialog.py. In this script we will add code for the main converstaion flow. We will add 4 steps in the waterfall flow. In first step we will ask user if he is an existing user or a new user. In second step we will take the user’s response. If user selects “new user” option then we will generate a user id (using random function). For existing user we will ask user to provide the user id. In third step we will read the user id provided by the user and save it in the context object. In the fourth step we will just loop the conversation.

    Copy below code in main_dialog.py:

    Now we have to update app.py. We will add code to initialize bot adaptor. We will also initialize dialog classes. And as a first bot response, object of DialogAndWelcomeBot class from module dialog_and_welcome_bot.py will be invoked.

    We will now need to add adapter_with_error_handler.py. copy the below code to handle any error from adaptor.

    With this we have completed the coding required for Part-1. We will all code for create order in the next part.

    Test the Bot using Emulator:

    To test the bot download and install bot framework emulator.

    Start the bot service which we have created. Open command prompt. Go to the project folder. Execute app.py. This should start the service on port 3978

    Now start Bot framework emulator. you will see below screen:

    Click on Open Bot. In bot url provide the url http://127.0.0.1:3978/api/messages and click on connect.

    You will get below screen. Bot has displayed the adaptive card for greeting. And prompts the user to select the option.

    Click on “New User”. Bot will generate a new user id and respond with the new user id.

    Now try the flow selecting “Existing User”.

    In next part we will add code to read the order description provided by the user and save the data in a storage.

    Link for Part 2

    Thanks.

    References:

    1) Microsoft documentation for Bot Framework SDK https://docs.microsoft.com/en-us/azure/bot-service/bot-service-overview?view=azure-bot-service-4.0

    2) Adaptive cards designer https://adaptivecards.io/designer/

    3) Microsoft bot-builder samples on github https://github.com/microsoft/BotBuilder-Samples/tree/main/samples/python/13.core-bot

    Don’t forget to give us your 👏 !


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

  • Learning Chatbot from Scratch: Rasa Open Source 3.x Installation and Set up on macOS

    I started to explore chatbot design two weeks ago and decided go with Rasa for my first chatbot development. As a leading open source chatbot platform, Rasa recently upgraded from 2.x to 3.x. While users are encouraged to upgrade to the latest version, I encountered some hiccups during installation and fortunately all got resolved through Rasa forum and googling. In this article, I am going to guide you through the installation process step by step, and also include all the tricks leading towards running your first chatbot example on macOS.

    TLDR: Hiccups I encountered and how to fix them

    Problem 1: ImportError when running “rasa init” after successfully installed Rasa 3.0

    ImportError in sanic package

    Solution: downgrade sanic to 21.9.3 via running “pip3 install sanic==21.9.3”. Credit to nik202 on Rasa community forum.

    Problem 2: Trying to install Rasa X on my local machine to enable conversation driven development, but encountered a series of errors during installation (see my post on rasa forum for details).

    Solution: Basically, Rasa X is designed for server deployment. If you are new to chatbot, I’d recommend to test your chatbot logics in command lines or use other front end deployment on a single machine. I’ve tried the Chatbot Widget from git, and it works perfectly for single machine deployment.

    Problem 3: After running “rasa init” and training the first model, you may want to modify the example moodbot and test your own logic. How to ensure all the logics comply to Rasa underlying training mechanism and train your own model?

    Solution: Here are some commands you want to run:

    rasa data validate: to ensure no conflicts in the stories and domain file

    – rasa train: to train your own model

    – rasa shell — debug: test the responses while you can track the states of the intent prediction and entity values

    Problem 4: After modified the stories and intents, and trained a few models, the responses started to divert from the design. For example, the response should be text but it always showed buttons in the previous design.

    Solution: Try to delete the old models and run “rasa train” again.

    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?

    Step-by-Step Installation Guide

    If you are new to python or Rasa, the steps below could help lead to your first chatbot running on a single machine. The commands used in the follwing steps are slightly different from Rasa installation page or their Youtube installation guide, and I am listing the ones worked for me.

    Step 1: Check your python version — 3.7 or 3.8 supported

    It is recommended to install and run Rasa in a virtual environment with python 3.7 or 3.8. You can jump to Step 3 if you already have python 3.7/3.8 and virtualenv installed.

    Otherwise, you need to first install python via pip or the binary file from python Download page. I will recommend using the binary file if you are new to python. After downloading, just double click on the .pkg file and follow the installation wizard.

    Step 1.1: Install Python 3.7 or 3.8

    Installation Wizard of Python 3.8.1

    I’ve followed the youtube guide and installed python 3.7.9. Once installation is done, you can check the python version in terminal by running the command below.

    Step 2: Install virtualenv and create a virtual environment

    • Install virtualenv: run “pip3 install virtualenv
    • Create a project directory if it does not exist: run “mkdir rasa-init-demo”
    • Create a virtual environment in the project directory by running:

    cd rasa-init-demo

    virtualenv venv

    • activate venv: run “source venv/bin/activate”. To exist the virtual environemnt later, run “deactivate”
    “(venv)” would appear after activation

    Step 3: Install Rasa Open Source in venv and initialize an example project

    • install Rasa in venv: run “pip3 install rasa”. Note that Rasa X is not supported with Rasa 3.0, so you need to downgrade to Rasa 2.8.x (e.g.: “pip3 install rasa==2.8.13)if planning to run with Rasa X.
    • initialize the first Rasa bot: run “rasa init
    • optional: downgrade sanic if encoutered any ImportError: run “pip3 install sanic==21.9.3”. Then rerun “rasa init”
    Successfully initialized the example project (credit: Rasa Youtube Installation Guide)

    At this point, we should see the welcome message and guiding questions in the terminal. As a new user, one may proceed with “Yes” for the two questions and start training an initial model (mood bot). In case you prefer to pause here and train the model with your own data, you may reponse “N” to the second question. You can start to modify the data, action and config file, and train your own model later.

    I will continue with the modification and creation of your own bot in next post.

    References:

    Rasa 3.x Docs

    Rasa Community Forum: very helpful source

    Conversational AI with Rasa Open Source 3.x: Youtube Playlist

    Don’t forget to give us your 👏 !


    Learning Chatbot from Scratch: Rasa Open Source 3.x Installation and Set up on macOS was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • A Rising Trend: Benefits of Chatbot for Recruiters

    It’s a known fact that the lifeblood of a company is its employees. Recruiters in the HR department have a large responsibility to bring in the best people to make the business run smoothly.

    And, off the recruiter goes to find that perfect unicorn.

    Chatbots are super-powered virtual assistants who simulate human conversations. These conversational agents engage with prospective candidates and follow them through the onboarding phase of a typical job hiring process. Read more.

    submitted by /u/impiger_technologies
    [link] [comments]

  • What’s going on with my my dialogflow chatbot

    I’ve been using a web demo link to try to train my bot. It’s been going well on the laptop but when I share to other parties for testing me inclusive it doesn’t seem to work. I’m getting a 404 error. Says the requested url isn’t found on the server Below is the link to the bot. Kindly assist Kay bot

    submitted by /u/Historical-Youth6448
    [link] [comments]

  • 10 Essential Slack Bots for Remote Workers

    Image Source: Pixabay

    Managing remote teams can be extremely challenging. When team members are scattered in different locations, building a tight connection among team members can be hard.

    Tools like Slack are becoming the preferred tool to communicate with teams that are in the office together, as well as remote.

    In this article, we’ll discuss 10 best Slack apps and bots to keep your remote team happy and productive.

    1. EngageWith

    EngageWith is an employee recognition and rewards platform that enriches your company culture. It virtually brings recognition and fun within your Slack and MS Teams workspace. With EngageWith, everyone across your organization can publicly recognize everyone else by giving points that add up to valued rewards (employees can redeem their points).

    2. Trivia

    Trivia is the new way to connect with your remote team while playing exciting quizzes and remote games on Slack and Microsoft Teams! Get summarised results at the end of every Trivia quiz and find your very own Quizzard!

    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?

    3. Giphy

    Giphy app allows you to search from the world’s largest library of animated GIFs, making it easy to find and share them on Slack. Want to display a cat gif? Just typing “/giphy cats” will display a cat GIF in your channel.

    4. HeyTaco!

    HeyTaco lets you recognize a team member by giving them tacos when they accomplish something great! Then, that teammate can redeem their tacos for custom rewards. It sparks conversations and builds stronger relationships with its fun and unique kindness currency…tacos!

    5. TINYpulse

    TINYpulse bot is a feedback-based app that encourages the whole team to provide input. Customizable weekly queries that can range from “How valued do you feel at work?” to “Where should we hold the company holiday party?”.

    This provides actionable, specific data for executives to reference in decision-making.

    6. Zoom for Slack

    Zoom for Slack allows you to instantly share video, audio, and screens from any Slack channel or group. From any channel in Slack, you can start an instant meeting by entering the /zoom command.

    7. ToDoBot

    ToDoBot is a task management app for slack. It assigns tasks during conversations and set due dates. That way, instead of creating a 15-minute task in your project management tool, you can monitor it straight from Slack.

    8. Pocket

    Pocket for Slack helps you capture and save all of the interesting articles, links, and videos your teammates share in Slack throughout the day — right to Pocket.

    9. Monday.com

    Sync conversations across both platforms, receive updates, and track changes instantly to ensure everyone is on the same page. Monday enables teams to manage work, meet deadlines, and build a culture of accountability and inclusion.

    10. Standuply

    Start your day with a Standuply meeting in Slack, to prompt teammates to share what they’re working on, what’s blocking them and what they’ve completed.

    Don’t forget to give us your 👏 !


    10 Essential Slack Bots for Remote Workers was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Human vs chatbot: Decide in which scenarios they are more effective

    Can you help me out with a study? Here’s a short survey:

    https://tidiosurveys.typeform.com/to/c5maPfPO

    I’ll share the results soon.

    submitted by /u/KazRainer
    [link] [comments]

  • In your opinion which company currently has the best customer service chatbot?

    To be honest I was never big into chatbots, and I have yet to run into a chatbot that has legitimately solved my customer support issues, but I will likely have to develop a chatbot for my next project at work. I was hoping I could interact with the best chatbot out in the wild, just to get some inspiration as to what the user experience should feel like when done properly.

    I know chatbots can have a lot of variety so the chatbot I’m looking for would strictly be handling things like:

    • Canceling an order

    • Dispute bill

    • Payment Plans

    • Membership upgrades

    So far the best chatbot I have seen is Amazon’s. Mainly because it has me specify my order that I’m contacting about before starting the support chat session. However, I’d be curious to get everyone’s input in case there’s something better.

    TLDR; What’s the best chat bot encounter you’ve had and what made it so pleasant?

    submitted by /u/YouLostMeThere43
    [link] [comments]