Create your own customizable Chatbot on Huawei Cloud ☁️

Berhan Ay
Huawei Developers
Published in
6 min readNov 6, 2023
Cover of Article

The Simple Way to Create a Chatbot🤖 with Huawei Cloud

Hello everyone! 👋😊Today, I’m going to show you how to create your very own chatbot in just a few simple steps.🤗☕🍫

Nowadays, chatbots have become an indispensable part of improving customer service for businesses and developers. These chatbots are able to communicate with users in a smart and effective way by utilizing the power of large language models. Cloud services like Huawei Cloud provide the infrastructure you need to create your own chatbot.🧠

Large language models are highly capable artificial intelligence systems in generating and understanding text. In this article, you will learn how to create a chatbot step by step using Huawei Cloud and how you can utilize large language models. Additionally, you will discover how your chatbot can contribute to your business and improve the user experience.

Creating your own chatbot is not only a great way to improve customer services but also a fantastic way to empower your business with automation and increase efficiency. With the robust infrastructure provided by Huawei Cloud, reaching these goals becomes more accessible.

Let’s get started and move on to the steps to create your own chatbot on Huawei Cloud!

Step 1: Creating a Huawei Cloud Account

  • Go to the official Huawei Cloud website.
  • Click on the “Sign Up” option to open a new account.
  • Fill in the requested information and verify your account via email or phone number.

Step 2: Setting Up a GPU-Supported Virtual Machine

  • Log in to the Huawei Cloud console.
  • Go to the “Compute” and “Elastic Cloud Server” menu.
ECS
  • Find and click the “Create ECS” or “Launch New ECS” option.
  • Fill in the necessary details completely:
  • Region and Availability Zone: Select your preferred region.
  • Server Type: Choose a server type with GPU accelerated.
  • Operating System: Preferably choose Ubuntu 22.04.
Creating GPU Accelerated ECS
  • Network Settings: Configure options for VPC, Subnet, Elastic IP, and Security Group.
  • After completing the other required settings, press the “Create” or “Start” button to set up your server.

Step 3: Providing Internet Access with an Elastic IP

  • Navigate to the “Elastic IP” section.
  • Click on “Allocate Elastic IP” or “Create New Elastic IP.”
  • Assign the Elastic IP you created to your new virtual machine to provide internet access.

Step 4: Security Group Settings

  • Go to the “Security Group” section.
  • Create a new Security Group or edit an existing one.
  • Set the incoming connection rules as follows:
  • Protocol: Allow SSH (port 22) and HTTP (port 80).
  • Source IP: Specify IP addresses that you are sure of their security for SSH.
  • Assign your created Security Group to your server.

Step 5: Connecting to the Server

  • Use an SSH client to connect to your virtual machine.
  • Make an SSH connection using the Elastic IP address obtained in previous steps.
  • You can use any program like mobaXterm or putty or you can ssh on your local terminal as ssh root@(your elastic ip)
  • Enter your server username and password.

Step 6: Installing Conda and Creating an Environment

# Download and install Miniconda
curl -sL "https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh" > "Miniconda3.sh"
bash Miniconda3.sh
# Create a new conda environment
conda create -n chatbot python=3.11
conda activate chatbot

Step 7: Installing PyTorch and Dependencies

The installation of PyTorch can vary depending on whether you have a GPU, and if so, what type. The following commands illustrate PyTorch installation for different systems:

Dependencies list

Once Miniconda is installed, create a new conda environment:

conda install -y -c nvidia/label/cuda-11.3.0 cuda-runtime

Step 8: Setting Up a Web Interface

If you wish to create a web interface for your chatbot, you can clone this repository (it is an opensource large language model UI) and install the necessary dependencies using the following commands:

git clone https://github.com/oobabooga/text-generation-webui
cd text-generation-webui

Use the appropriate requirements file based on your system:

Requirements list
pip install -r requirements.txt

To start the chatbot UI:

conda activate chatbot
cd text-generation-webui
python server.py --share

Login to the Chatbot Site

LLM Loading to Web App

Step 1: Choose a pre-trained model from Hugging Face, like llama, open-chat, mistral etc.

Step 2: Click ‘Get file list’ to view available versions of the selected model.

Step 3: Write the exact name of the model you intend to use.

Step 4: Click the download button for the chosen model to download it.

Step 5: Locate and select the downloaded model in your local directory.

Step 6: Load the model for your application.

Configuration of ChatBot

Character: This tab is currently selected and appears to let you configure the persona of the chatbot. In this case, the persona is Albert Einstein, and the user can interact with the chatbot as if they were speaking to Einstein himself.

Character picture: The image representing Albert Einstein, enhances the immersion of the conversation.

Your picture: An image of the user, which might be used to personalize the chat session.

Character/Your name: Fields where the names are specified for the character (Albert Einstein) and the user.

Context: An area where the context or backstory for the character is provided, which the chatbot presumably uses to tailor its responses to match the persona of Albert Einstein.

Albert Einstein Bot ‍🔬:

Chat with Albert Einstein

This particular interface allows for a simulated chat with a character designed to represent Albert Einstein. The chat is interactive, with the user typing in questions or comments and the Einstein chatbot responding.

Huawei Cloud DTSE Bot:

Chat with DTSE Bot

This chatbot is presented as a tech enthusiast with a calm demeanor and an ability to simplify complex technical concepts.

In the conversation, the user asks Kenji to suggest a web application architecture for using Huawei Cloud Services. Kenji DTSE responds with a list of five recommendations tailored to the Huawei Cloud environment.

Conclusion

The project’s journey has led us to successfully establish a sophisticated chatbot on Huawei Cloud, leveraging the power of GPU-accelerated virtual machines and the robustness of Python’s ecosystem. By utilizing Conda environments and installing PyTorch, we’ve set the stage for advanced machine learning capabilities. The chatbot, poised to enhance customer interaction and service, stands on the cutting edge of conversational AI. The web interface integration promises a seamless user experience, making the chatbot accessible and user-friendly. As businesses continue to evolve, the chatbot created in this project represents a significant step towards embracing AI-driven communication, ensuring that businesses stay ahead in the dynamic digital landscape.

References

--

--