# Virtual Agent (Chatbot) Blueprint - deprecated from 11/2024
# Inference
A chatbot is a computer program that simulates and processes human conversation, allowing people to interact with digital devices as if they were communicating with a real person. This chatbot's main goal is to serve as a virtual agent that allows businesses to communicate with their customers without requiring human resources.
# Purpose
Use this inference blueprint to immediately infer the intent of a customer message. To run this pretrained intent-recognition model, create a ready-to-use API-endpoint that can be quickly integrated with your data and application.
This inference blueprint's model was trained using e-commerce data. To use custom data according to your specific business, run this counterpart's training blueprint, which trains the model and establishes an endpoint based on the newly trained model.
# Supported Modes
The endpoint response contains either the intent only or the intent and an appropriate response (to the message given) with a confidence score. Thus, this blueprint supports the following two modes:
- intent - returns the intent of the given text.
- response - returns a response message relevant to the identified intent based on an intent-response dictionary provided in the environment variable
responses_dict
. Define the mode by defining intent/response in the mode environment variable.
NOTE
The uploaded inference blueprint includes the default responses_dict
with the default data, and as such, is not accessible. If users retrain the model using the associated training blueprint, they need to upload their own responses.
# Instructions
NOTE
The minimum resource recommendations to run this blueprint are 3.5 CPU and 8 GB RAM.
Complete the following steps to deploy the chatbot API endpoint:
- Click the Use Blueprint button. The cnvrg Blueprint Flow page displays.
- In the dialog, select the relevant compute to deploy API endpoint.
- Click the Start button.
- The cnvrg software redirects to your endpoint. Complete one or both of the following options:
- Use the Try it Live section with any text to check the model to infer the intent.
- Use the bottom integration panel to integrate your API with your code by copying in your code snippet.
An API endpoint that infers the intents of customer messages has now been deployed. For information on this blueprint's software version and release details, click here.
# Related Blueprints
Refer to the following blueprints related to this interence blueprint:
# Training
A chatbot is a computer program that simulates and processes human conversation, allowing people to interact with digital devices as if they were communicating with a real person. This chatbot's main goal is to serve as a virtual agent that allows businesses to communicate with their customers without requiring human resources.
# Overview
The following diagram provides an overview of this blueprint's inputs and outputs.
# Purpose
Use this training blueprint to train a tailored model that infers the intent of a customer message based on your custom data. To train this model with your data, you need to provide a training dataset, which is a collection of possible messages mapped to their intent.
This blueprint retrains a neural network on the custom dataset. The result is a trained model file that can be used to build a chatbot that meets an organization's needs by detecting customer intents and generating responses accordingly. This blueprint also establishes an endpoint that can be used to make inferences for customer message intents based on the newly trained model.
# Deep Dive
The following flow diagram illustrates this blueprint's pipeline:
# Flow
The following list provides a high-level flow of this blueprint's run:
- Update the S3 Connector task with the data bucket name and the path to the training dataset. Ensure the dataset is a CSV file having a two column format, with column one containing the text and column two containing the intent, as the following example table illustrates:
- Provide the dataset path in the Train task and train the model on the extended dataset to produce a model file in the Inference task. The trained model can then be used for a personalized business chatbot.
# Arguments/Artifacts
For more information on this blueprint's tasks, its inputs, and outputs, click here.
# Inputs
--data
is the base training dataset.--additional_data
is the additional training dataset that contains the data unique to the business.--model_file
is the model's file name.
# Output
chatbot_model.pt
is the file that contains the retrained model, which can then be used for detecting the intent of a customer's message.
# Instructions
NOTE
The minimum resource recommendations to run this blueprint are 3.5 CPU and 8 GB RAM.
Complete the following steps to train the chatbot model:
Click the Use Blueprint button. The cnvrg Blueprint Flow page displays.
In the flow, click the S3 Connector task to display its dialog.
- Within the Parameters tab, provide the following Key-Value pair information:
- Key:
bucketname
- Value: enter the data bucket name - Key:
prefix
- Value: provide the main path to the data folder
- Key:
- Click the Advanced tab to change resources to run the blueprint, as required.
- Within the Parameters tab, provide the following Key-Value pair information:
Return to the flow and click the Train task to display its dialog.
- Within the Parameters tab, provide the following Key-Value pair information:
- Key:
data
- Value: provide the S3-Connector path to the dataset /input/s3_connector/text_classification_data/text_classification_data.csv
- ensure the above dataset path adheres to this format
- Key:
NOTE
This path refers to the base training data, not data for fine-tuning the model. The following link stores the default base training data: http://s3.amazonaws.com. Also, use the
--additional_data
parameter to include business-specific data for training.- Click the Advanced tab to change resources to run the blueprint, as required.
- Within the Parameters tab, provide the following Key-Value pair information:
Click the Run button.
The cnvrg software launches the training blueprint as set of experiments, generating a trained chatbot model and deploying it as a new API endpoint.
NOTE
The time required for model training and endpoint deployment depends on the size of the training data, the compute resources, and the training parameters.
For more information on cnvrg endpoint deployment capability, see cnvrg Serving.
Track the blueprint's real-time progress in its Experiments page, which displays artifacts such as logs, metrics, hyperparameters, and algorithms.
Click the Serving tab in the project and locate your endpoint.
Complete one or both of the following options:
- Use the Try it Live section with any text to check the model to infer the intent.
- Use the bottom integration panel to integrate your API with your code by copying in your code snippet.
A custom model and API endpoint, which can infer the intents of customer messages, have now been trained and deployed. For information on this blueprint’s software version and release details, click here.
# Connected Libraries
Refer to the following libraries connected to this blueprint:
# Related Blueprints
Refer to the following blueprints related to this training blueprint: