Developing an AI chatbot is a very tedious and time-consuming process. However, with the help of some libraries, it is possible to build a successful AI chatbot in a few days.

 

I have developed a custom chatbot by making few modifications to an existing Artificial Intelligence Chatbot Using Neural Network and Natural Language Processing. This may help anyone to implement a chatbot in 10 days in the production system.

To copy and build a chatbot on your own requirements, please follow below steps:

  1. Go to GitHub https://github.com/rcgopi100/AIChatbot (fork and source from Github NeuralNine)
  2. Download all files.
No alt text provided for this image

3. Open intents.json and check if you want to update your contents and function call (you can work with your python and SAP UI developers to integrate SAP backend calls to fetch Order information on Run the program training.py “tag” : “sostatus”. This is not only for SAP even for any ERP or any frontend systems can call the program as it uses similar logics and validations.)

4. Run training.py program

5. The program will run 500 epochs and creates chatbot_model.h5, labels.pkl, and words.pkl files. The sample files already attached.

Epoch 1/500 10/10 [==============================] – 0s 2ms/step – loss: 2.4801 – accuracy: 0.0423 Epoch 2/500 10/10 [==============================] – 0s 723us/step – loss: 2.3048 – accuracy: 0.2163 Epoch 3/500 10/10 [==============================] – 0s 0s/step – loss: 2.2063 – accuracy: 0.2503 Epoch 4/500 10/10 [==============================] – 0s 2ms/step – loss: 2.0829 – accuracy: 0.3555 Epoch 5/500 10/10 [==============================] – 0s 0s/step – loss: 2.1044 – accuracy: 0.2899 Epoch 6/500 10/10 [==============================] – 0s 2ms/step – loss: 1.7779 – accuracy: 0.4039 Epoch 7/500 10/10 [==============================] – 0s 0s/step – loss: 1.8921 – accuracy: 0.3708 Epoch 8/500 10/10 [==============================] – 0s 0s/step – loss: 1.7310 – accuracy: 0.4783 Epoch 9/500 10/10 [==============================] – 0s 0s/step – loss: 1.7128 – accuracy: 0.3259 Epoch 10/500 10/10 [==============================] – 0s 0s/step – loss: 1.4811 – accuracy: 0.6077 Epoch 11/500 10/10 [==============================] – 0s 2ms/step – loss: 1.3332 – accuracy: 0.5456 Epoch 12/500 10/10 [==============================] – 0s 0s/step – loss: 1.4323 – accuracy: 0.6421

…………………………………….

accuracy: 0.9783 Epoch 495/500 10/10 [==============================] – 0s 0s/step – loss: 0.0690 – accuracy: 0.9631 Epoch 496/500 10/10 [==============================] – 0s 2ms/step – loss: 0.0101 – accuracy: 1.0000 Epoch 497/500 10/10 [==============================] – 0s 0s/step – loss: 0.0471 – accuracy: 0.9586 Epoch 498/500 10/10 [==============================] – 0s 2ms/step – loss: 0.0372 – accuracy: 0.9722 Epoch 499/500 10/10 [==============================] – 0s 0s/step – loss: 0.0887 – accuracy: 0.9595 Epoch 500/500 10/10 [==============================] – 0s 2ms/step – loss: 0.0592 – accuracy: 0.9393 Done

6. Run chatbot.py program and all set now.

7. Hola! You are ready to chat with Artificial Intelligence Chatbot.

Sample AI chatbot chat:

Bot: Hi! How can I help you

User: hi

Bot: Hi there, how can I help you?

User: how are you

Bot: Hi! I am good, how about you?

User: I am good

Bot: What can I do for you?

User: I want to query an order

Bot: Please provide order number.

User: 123456789

Bot: The Order is ready to deliver on 3rd June 2021.

You can check my blogs which discuss how to design a simple chatbot and how to implement a simple wireframe design for SAP FIORI UI chatbot.