Clients are the spine of any enterprise. Understanding buyer expertise is essential for each firm, and conducting buyer suggestions evaluation is all the time an important software for elevating your model. On this article, we’ll discover how a synthetic intelligence agent can be utilized to carry out buyer suggestions extraction and evaluation simply and effectively. We are going to construct the AI agent utilizing Kumologica, a low-code growth platform, and the Anthropic AI platform.
Use Case
ABC restaurant chain has determined so as to add a suggestions function to their menu and ordering cell app. Together with the traditional star ranking mannequin, they launched a easy free-text field permitting prospects to supply suggestions in their very own phrases. This provides extra flexibility for patrons to share detailed feedback. It permits administration to higher perceive buyer expectations.
Determine 1: Suggestions kind (Picture source: writer)
Design
Primarily based on the use case, the client is given a easy kind within the cell app with solely a free textual content subject and a ranking choice. The structure group determined to make use of a synthetic intelligence platform to learn the consumer feedback, extract obligatory data, and analyze the sentiment. The extracted particulars, such because the menu merchandise, consumer suggestions, and related sentiment, shall be saved for later retrieval and evaluation. The group will develop an AI agent utilizing Kumologica, join with Anthropic AI for extraction and evaluation, and retailer the information in AWS DynamoDB.
Determine 2: Structure diagram (Picture source: writer)
Primarily based on the design we shall be growing an API with the POST
technique and useful resource path as /buyer/suggestions
. The request to the API shall be a JSON payload having two attributes; i.e., remark and ranking. The JSON payload is as follows.
{
"comment" : "",
"rating” : ""
}
The response from Anthropic AI shall be as follows:
{
"feedback": "",
"item" : "",
"sentiment" : ""
"rating" : ""
}
These attributes shall be saved in AWS DynamoDB.
Now let’s get began with the event of the API.
Implementation
Prerequisite
1. Obtain and set up Kumologica Designer.
2. Set up the OpenAI node within the Kumologica undertaking package deal.
npm i @kumologica/kumologica-contrib-anthropicai
3. AnthropicAI account entry and token for accessing the AnthropicAI platform
4. AWS account entry with entry key and secret having obligatory permission to attach and insert information into DynamoDB.
Steps
Now we’ll begin the implementation of the suggestions service in Kumologica.
Step 1
Open the Kumologica Designer. On the menu click on File > New Mission. This may open the next popup to supply the undertaking title and file location to avoid wasting the undertaking.
Determine 3: New undertaking choice (Picture source: writer)
Step 2
Drag and drop the EventListener
node from the pallet to the canvas. Present the next config for the node.
Show Identify : [POST] /buyer/suggestions
Supplier : AWS
EventSource : Amazon API gateway
Verb : POST
URL : /buyer/suggestions
The article takes the belief that ABC restaurant’s IT division has AWS cloud infrastructure.
Step 3
Drag and drop the Logger and wire it to the EventListener
node added in the first step. Present the next config for Logger.
Show Identify : Log Entry
Degree : INFO
Message : 'Request recevied : ' & msg.payload
Log format : String
Step 4
Add two set property nodes to the canvas and supply the next config. The primary one is to extract the request information and the second is to set the foundations for extracting the remark to fields to retailer and analyze sentiment.
Set-Property 1
Show Identify : Set Suggestions Information
Operation : Set
Goal : msg.remark
Supply : msg.payload.remark
Operation : Set
Goal : msg.ranking
Supply : msg.payload.ranking
Set-Property 2
Show Identify : Set Rule
Operation : Set
Goal : msg.rule
Supply : 'Primarily based on the suggestions given by the consumer extract the objects talked about, the remark in regards to the merchandise and supply the sentiment.' &'The extracted particulars to be responded within the following JSON format solely: { "item" : "" , "comment" :"" , "sentiment" : ""}'
5. Now add the AnthropicAI node from the pallet and supply the next config. Then wire the node to the set property node in step 4.
Show Identify : AnthropicAI
Operation : Single Q&A
Mannequin : claude-3-sonnet-20240229
API Key : >
System : msg.rule
Consumer : msg.remark
Step 6
Now we have now the response from Anthropic AI which could be saved in DynamoDB utilizing the DynamoDB
node. The next is the configuration for the DynamoDB
node.
Show Identify : DynamoDB
Operation : PutItem
Desk ARN : >
Attributes:
Itemid = msg._msgid
Merchandise = msg.payload.merchandise
suggestions = msg.payload.remark
sentiment = msg.payload.sentiment
ranking = msg.ranking
Step 7
Lastly wire the DynamoDB
node to the EventListener Finish
node with a logger
reporting the exit.
The finished circulate will look as proven beneath.
Determine 4: Buyer suggestions circulate (Picture source: writer)
Strive It
The above circulate could be invoked with the next endpoint regionally.
Endpoint : http://localhost:1880/buyer/suggestions
Technique : POST
Content material-Kind : utility/json
Physique : {
"rating" : "2",
"comment" : "The chicken curry is too salty. Would have been better if less spicy as well"
}
You’ll get the response beneath. The response exhibits that the Anthropic AI has extracted the merchandise and suggestions and recognized the sentiment on the consumer suggestions remark. These information could be seen within the DynamoDB desk as effectively.
{
"item":"chicken curry",
"comment":"too salty and spicy",
"sentiment":"negative"
}