Git Product home page Git Product logo

wallacezq / conversational-ai-chatbot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from intel/conversational-ai-chatbot

0.0 1.0 0.0 2.64 MB

The Conversational AI Chat Bot contains automatic speech recognition (ASR), text to speech (TTS), and natural language processing (NLP) as microservices and leverages deep learning algorithms of Intel® Distribution of OpenVINO™ toolkit. This RI provides microservices that will allow your system to listen through the mic array, understand natural language expressions, determine intent and entities, and formulate a response.

License: Other

Makefile 0.91% Dockerfile 5.20% Shell 6.58% Python 87.30%

conversational-ai-chatbot's Introduction

Conversational AI Chat Bot

Introduction

This guide helps you build and run the Conversational AI Chat Bot Reference Implementation.

Upon completing the steps in this guide, you will be ready to integrate services to build your own complete solution.

Block Diagram

Block Diagram

Prerequisites

The following items are required to build the Conversational AI Chat Bot. You will need additional hardware and software when you are ready to build your own solution.

Here's how to install git, curl, and make on an Ubuntu 18.04 system - other operating systems may vary:

sudo apt-get update -y
sudo apt-get install -y git curl build-essential

Hardware

  • 8th Generation (and above) Intel® Core™ Processor, 32GB RAM and 100GB of HDD.
  • ReSpeaker™ or equivalent USB Mic Array
  • Auxiliary (AUX) Port Speaker or USB speaker
  • Network with speed greater than 60 mbps preferable while building the docker images.

Recommended Domain Knowledge

To use the chatbot, we need the credentials of an Open Bank Project compatible server. This reference implementation uses a sandbox server hosted here. For this demo, create credentials here.

Getting Started

Step 1: Clone the repository

git clone https://github.com/intel/conversational-ai-chatbot

Step 2: Build the reference implementation

You must build the provided component services and create local docker images. To do so, run:


$ sudo chmod a+x setup
# set env variables
$ source <repo-root>/setenvvars.sh
$ ./setup build

NOTE: This command may take a while to run depending on your internet connection and machine specifications.

For development or a quick demo, you can follow the quickstart instructions here.

Step 3: Start the reference implementation

The solution is to be deployed on a single node docker swarm. It stores the keys as docker secrets.

  1. Create a docker swarm

This is a one time step.

# Check your ip
$ ip=`hostname -I | awk '{print $1}'`
$ echo "The ip of machine is $ip"
$ docker swarm init --listen-addr $ip
  1. Create a directory to hold unix sockets.

This is a one time step. Assume the path you chose is ~/ipc_sockets. Follow these steps to create the directory and set its permissions.

$ mkdir -p ~/ipc_sockets
$ cd ~/ipc_sockets && export SOCKET_DIR=`pwd` && cd -
# Change the ownership of the path
$ sudo chown 800:1102 $SOCKET_DIR
  1. Create Secrets

This step creates secrets and keys. This has to be run preferably at every run.

./create_secrets.sh
  1. Run the compose file via make

Set the required env variables. TAG and SOCKET_DIR.

TAG=1.0 and SOCKET_DIR is the absolute path of the socket directory we created in the step 2.

cd ~/ipc_sockets && export SOCKET_DIR=`pwd` && cd -
export TAG=1.0

# choose asr
export ASR_IMAGE=kaldi_asr
# or
# export ASR_IMAGE=deepspeech_asr

# For wave audio file ingestion
# make -e run

# OR

# For recording via mic, we need to run this command
make -e run_respeaker

# to stop

make -e stop 

#OR
make -e stop_respeaker

Step 4: Dive In

All of the core components of Conversational AI Chat Bot are up and running, and you are ready to begin going through the following phases.

  • Login: Login Using openbankproject credentials

  • Phase 1: Record From Microphone

General Guidance

After completing the steps in the Getting Started section, it may be helpful to read through the remainder of this document for some further guidance on the Conversational AI Chat Bot reference implementation.

Please go through this link for an overview of the services used in this solution.

How to build service individually

# build deepspeech
make deepspeech_asr

# build kaldi asr
make kaldi_asr

# build huggingface asr
make huggingface_asr

# build quartznet_asr
make quartznet_asr

# build audio ingestion for wave files
make audio_ingestion

# build audio ingestion to record from mic
make audio_ingestion2

# build tts
make tts

# build authz
make authz

# build nlp_app
make nlp_app

# build rasa_action
make rasa_action_server

Quickstart

Use these steps to quickly start with the software. You need to create login credentials first as discussed here. Login

This method is recommended only for development or a quick demo. This requires the user to enter credentials via env variables.

There are two ways to run the application:

1. Wav File Ingestion: A quick test of the RI to illustrate how it responds to speech. Use this method to see the RI run with sample audio files. Use a speaker or headphones as the output device or monitor the log files.

2. Live Speech Ingestion: An interactive test of the RI that involves speaking words and phrases into a microphone or mic array. Use this method with Seeed ReSpeaker or another device as the input mic. Use a speaker or headphones as the output device or monitor the log files.

Update the environment variables.

NOTE: The default ASR(speech recognition) set via setenvvars.sh script is quartznet_asr, in case the user want a different asr, user can edit the ASR_IMAGE variable in setenvvarsh.sh to any one of these {kaldi_asr, deepspeech_asr, hugginface_asr. Additionally, in case of multiple output devices, we can choose the specific output device by setting the ALSA_CARD value. The available card options can be checked via aplay -l.

# install alsa-utils, if not available
sudo apt-get install alsa-utils
aplay -l
# this lists the sound cards
export ALSA_CARD=<alsa sound device>
or
export ALSA_CARD=''
# for default device

Set env variables.

# set env variables
source <repo-root>/setenvvars.sh
# This script is interactive and will prompt the user for credentials and alsa_card value.

Run wave-ingestion

Run the software using pre-recorded queries.

./setup run wave_ingestion

The responses of the bot would be heard in the speaker in a short while.

Stop the software.

./setup stop wave_ingestion

Run Live Speech Ingestion

Make sure you have connected a working microphone to the setup.

Run the live speech

./setup run speech_ingestion

Stop Live Speech

./setup stop speech_ingestion

Expanding the Reference Implementation

The reference implementation you created is not a complete solution. It provides the base components for creating a framework to run an OpenVINO powered Conversational AI Chat Bot. This section provides information about components you might want to include or replace or change.

Component Description
Authz Service Currently we need to use linux commandline for login It doesn't represent an actual banking use case login. It can be replaced or extended to give a UI/web UI based interface for login.

Release Notes

Find the release notes here.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.