GPT Task
Smartflows allow you to create chatbots that generate pertinent responses using the GPT Task feature. In this tutorial, we will walk you through setting up a chatbot that leverages GPT to generate answers based on customer feedback. Let's begin!
Step 1: Prepare Your Use Case and Attributes
Before you start, it's essential to have a clear use case in mind. For example, let's say you want to create a bot that handles feedback requests.
Assign an attribute to store the customer's feedback. In Smartflows, attributes are used to capture and store information from user interactions. You can create a custom attribute (e.g., "customer_feedback") to store the feedback provided by users.
Step 2: Define the GPT Prompt
To generate pertinent responses using GPT, you need to define a prompt that instructs GPT on how to generate an answer based on the customer's feedback.
Consider the context of your chatbot. If your use case involves feedback requests, you might use a prompt like: "Provide a helpful response to the customer's feedback regarding [customer_feedback]."
Here, "[customer_feedback]" is a placeholder for the actual customer feedback attribute.
Make sure the prompt is clear and instructive, as GPT will generate responses based on it.
Step 3: Set the Max Number of Tokens
Decide the maximum number of tokens you want the GPT response to have. Tokens are chunks of text, and limiting their number can help control the length of the generated responses.
Determine whether you want shorter or longer responses based on your use case.
For example, if you want concise responses, you might set the max number of tokens to 50. If you want more detailed responses, you can set it to a higher value, like 150.
Step 4: Create a "Reply" Action with GPT Attribute
In Smartflows, create a new block or use an existing one where you want to generate GPT responses.
Within the block, create a "Reply" action to generate the response.
In the "Reply" action, add the attribute "gpt_reply" to store the generated response.
Step 5: Configure GPT Task*
In the same "Reply" action, configure the GPT Task feature.
Set the "Prompt" field to the GPT prompt you defined in Step 2.
Specify “GPT Model” and the "Max Tokens" field based on the desired response length, as determined in Step 3.
Based on the model chosen, you will impact the consumption of Imagicle Tokens.
Step 6: Implement Attribute Assignment
After configuring the GPT Task, add an action to assign the generated response to the "gpt_reply" attribute.
Use a "Set Attribute" action and assign the GPT-generated response to the "gpt_reply" attribute.
Step 7: Test Your Chatbot
Test your chatbot to ensure it generates pertinent responses based on customer feedback.
Provide feedback in the chat to see how the GPT-generated response is handled.
Verify that the response is captured in the "gpt_reply" attribute and displayed correctly to the user.
That's it! You've successfully created a chatbot with Smartflows that uses the GPT Task feature to generate pertinent responses based on customer feedback. This can greatly enhance your chatbot's ability to provide relevant and context-aware responses to users.