How to develop and train an AI-BOT for your business
Published: 2023-09-05 11:07:53


Generative AI is one of the cutting-edge technologies in the field of science and technology today. With the continuous increase of data volume and improvement of computing power, AI is more and more widely used in business and personal life. AI-BOT (hereinafter referred to as BOT) is one of the important application forms of generative AI technology. It can help people perform a series of tasks by learning various business data information, thereby improving work efficiency and reducing labor costs.


As a BOT development platform, GPTBots has always been a frontier explorer of generative AI. This article will share with you how to develop and train a highly available BOT for your business on GPTBots.


## Preparation

## Register GPTBots account
Registering a GPTBots account is the first step in developing a BOT.


Enter the GPTBots platform (https://gptbots.ai/developer), click [Sign Up], and log in to [Developer]. After completing the registration, the platform will give you some credits, which can allow you to experience the platform's functions for the first time, such as creating BOT, debugging BOT, training BOT, etc. If you complete the enterprise authentication, you can also get a gift of up to 500 credits.



## Business Analysis
First, you need to clarify the positioning and goals of the BOT in your business.


Positioning refers to the special position of the BOT in your business. It is used to solve a problem in a specific field, so it is different from other BOTs. Goals refer to the specific results that BOT can achieve in your business, such as reducing costs and improving human efficiency.


We suggest that you can understand a BOT as an employee who is knowledgeable and omniscient, but lacks in certain professional fields. However, as long as relevant professional knowledge is provided, it can become a domain expert and effectively solve professional problems. Therefore, when clarifying positioning and goals, we can think like this:


- lPositioning: A very professional e-commerce after-sales customer service staff who knows the company's business well and can quickly and professionally solve various after-sales problems for customers.
- lGoal: Improve customer service efficiency and quality, reduce customer service costs.

Second, you need to understand the problems and challenges in the business domain that the BOT needs to solve. Understanding these will help you further locate the capabilities of the BOT.



## Data Collection

After clarifying the positioning and goals of the BOT, we need to collect data for the BOT.


Following the advice we provided above, we envisioned this bot as an omniscient employee. But a powerful employee, unless some people are talented, must be able to achieve more through continuous knowledge learning and experience accumulation. The BOT data refers to the knowledge that the BOT needs to learn.


Continue using the example above. A "very professional e-commerce after-sales customer service personnel" must have a very rich knowledge of the company's after-sales business, including but not limited to: the company's after-sales service policy, the company's history and classic cases of after-sales problems...


Therefore, we need to do the following:


1.Data collection. As a learning material for this "e-commerce after-sales BOT";

2.Data classification. The clearer the classification, the more conducive to the maintenance and management of BOT knowledge and the improvement of the response quality of BOT. For example, e-commerce after-sales service knowledge can be roughly classified into: general service rules, service rules, service process, common problems, classic cases, etc.;

3.Data cleaning and preprocessing. To ensure that the final data for BOT learning is relatively "clean" and free of "impurities".


Please note that the collection of data is not the more the better, but the quality of the data is more important. We need to "learn" high-quality knowledge for BOT, so that BOT can output high-quality results for us.



## Build BOT
After the above preparatory work is completed, you can start to build this "e-commerce after-sales BOT".


For more tutorials on how to use GPTBots, please visit the official GPTBots document, and will not be expanded in detail in this article.

## Create BOT

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/y3k1vc48cx00a9va7bfo.png)
According to the actual business, create a suitable type of BOT. GPTBots defines two types of BOTs:


Knowledge Q&A: with "short memory" ability, suitable for some simple question and answer scenarios, such as translation, customer service, knowledge retrieval, etc.;

- AI Assistant: It has the ability of "short memory + long memory", which is suitable for more complex dialogue scenes.
- Developers can choose the BOT type according to their actual needs.



## Tips for writing identity prompt
In the process of building a BOT, one of the more important part is to write an identity prompt for the BOT.


Identity prompt can be used to shape a BOT's identity, capabilities, boundaries, and emotions. A high-quality identity prompt can allow the BOT to respond to user questions more in line with expectations.


We can use a general structure to write identity hints, as follows:


Role: the role that BOT needs to play, such as "professional after-sales service personnel";

- Skills: the skills that BOT needs to have, such as "excellent after-sales service ability and customer communication skills";
- Personality: BOT's tone, personality, communication style, etc., such as "please be calm in tone and polite in words";
- Target: BOT's task target, such as "based on reference content and customer questions, answer customer questions";
- Chain of thought: Provide some thinking processes and methods for BOT to guide BOT to think and solve problems according to your requirements, such as "MUST follow these steps to answer the customer queries: Step1 - Step2 - Step3 - Step4..." . In some relatively vertical and specific scenarios, this method is very useful. More chain thinking skills can be learned here: Zero-Shot-of-Chain. Please note that this part is not required and can be written according to actual needs.
- Output rules: If you need BOT to output content in a specific structure or format (such as: json, markdown...), you can also define it here. Please note that this part is not required and can be written according to actual needs.

Taking the above "e-commerce after-sales BOT" as an example, we can write an identity prompt like this:


Please act as a professional after-sales service personnel. You have excellent after-sales service capabilities and customer communication skills. Your task is to answer the customer's questions based on the reference content and the customer's questions. Please use a calm tone and polite words.


## Train BOT
After setting the basic information of the BOT, we need to "feed" and train the BOT with knowledge.

## Knowledge Import

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l3qteylk13zeqenvvqaw.png)
We need to "feed" the after-sales service data collected in the data collection phase to the BOT in a suitable format for training. The GPTBots platform currently supports document import (.docx, .md, .txt, ...), website crawling, online text, online Q&A, etc. for knowledge import.



## Vector Search


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h3aj26qkx7c8tmqglytz.png)
After the training is completed, you can immediately use the "Vector Search" function to conduct a vector search test on the knowledge to check the hit. The purpose is to observe whether the trained knowledge can effectively complete information recall when faced with practical problems.



## Chat Records Training

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7hoorh9np9gjya5zdv9j.png)
After the BOT has been put into use, we can still train the BOT repeatedly.




Currently GPTBots supports training based on chat records. The advantage of this training method is that the training corpus uses the actual dialogues that occur when users use the BOT. Using these dialogues as training materials can make the BOT more effectively approach the actual user usage scenarios.



## Debug BOT


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c7m5bn0glng7nzhaqvrs.png)


Debug mode can help developers adjust BOT parameters while using BOT, so that BOT can achieve the desired effect of developers.



## How to deal with more complex scenarios?
In actual business, there will be many scenarios that are far more complicated than after-sales service questions and answers. In the face of these scenarios, GPTBots provides a richer processing method to deal with.


## Plugin, Adding Wings to BOT


![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r84zr502jh8sco35ir0a.png)
The large language model (LLM) itself is limited by the scope of knowledge. When LLM is needed to help us handle more business-customized and complex tasks, we can expand the capabilities of LLM by adding plug-ins to LLM, so that BOT has more powerful ability.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rdte6esst6hijn9mieaq.png)




GPTBots currently supports the plug-in function.


GPTBots has officially provided some free public plug-ins for users to use (more official plug-ins are on the way...).


At the same time, GPTBots also supports developers to develop their own plug-ins to cover their own business scenarios in a personalized way. For example, developers can develop plug-ins to connect BOT to their own business systems, call their own business data, and let BOT handle specific business tasks.



## Build BOT by FLOW
If there are more complex business scenarios, you can build a BOT through a visual process FLOW.

![Image description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/atj19j3fkxr2gbz9v5gp.png)

GPTBots is currently testing “build BOT by FLOW” function. We abstract a BOT's proper or common modules into multiple components. Users can individually build a BOT in complex scenarios by dragging and dropping on the visualization panel, to solve more problems in vertical and specificscenarios.


## Connect BOT with your business
GPTBots supports connecting the BOT with the user's own business. Currently, there are three main methods:


- API: GPTBots currently provides multiple APIs for interacting with BOT, including but not limited to creating conversations, sending messages, getting messages, etc.;
- iframe webpage embedding: embed the BOT dialogue interface into your webpage in the form of iframe for use;
- bubble webpage widget: Embed BOT into your webpage in the form of bubble widget for use, and it will be displayed in the lower right corner of your webpage in the form of bubbles.

## Conclusion
Today, with the rapid development of generative AI, GPTBOTS provides developers with a powerful ability to independently build AI-BOTs, which can help developers quickly and efficiently build personalized BOTs to solve their business pain points or problems and drive business growth.


You are cordially invited to try GPTBots. Sign up now and get reward credits. Participate in enterprise certification or invite friends to register, and you can also get more credits.