Low Code AI Agent Using Kumologica and Anthropic AI for Customer Feedback Sentiment Analysis

Kumologica
5 min readOct 9, 2024

--

Photo by Priscilla Du Preez 🇨🇦 on Unsplash and edited by Pranav K

Customers are the backbone of any business. Understanding customer experience is key for every company, and conducting customer feedback analysis is always a vital tool for elevating your brand. In this article, we will explore how an artificial intelligence agent can be used to perform customer feedback extraction and analysis easily and efficiently. We will build the AI agent using Kumologica, a low-code development platform, and the Anthropic AI platform.

For those who are new to Kumologica, For those who are new to Kumologica I would recommend to go through our articles and youtube videos to get an insight.

Training & Certification
For a limited time, Kumologica offers free online certification
for developers on https://training.kumologica.com/

Use Case

ABC restaurant chain has decided to add a feedback feature to their menu and ordering mobile app. Along with the conventional star rating model, they introduced a simple free-text box allowing customers to provide feedback in their own words. This offers more flexibility for customers to share detailed comments. It enables management to better understand customer expectations.

Figure 1: Feedback form (Image source: author)

Design

Based on the use case, the customer is given a simple form in the mobile app with only a free text field and a rating option. The architecture team decided to use an artificial intelligence platform to read the user comments, extract necessary information, and analyze the sentiment. The extracted details, such as the menu item, user feedback, and associated sentiment, will be stored for later retrieval and analysis. The team will develop an AI agent using Kumologica, connect with Anthropic AI for extraction and analysis, and store the data in AWS DynamoDB.

Figure 2: Architecture diagram (Image source: author)

Based on the design we will be developing an API with the POST method and resource path as /customer/feedback. The request to the API will be a JSON payload having two attributes; i.e., comment and rating. The JSON payload is as follows.

{
"comment" : "",
"rating” : ""
}

The response from Anthropic AI will be as follows:

 {
"feedback": "",
"item" : "",
"sentiment" : ""
"rating" : ""
}

These attributes will be stored in AWS DynamoDB.

Now let’s get started with the development of the API.

Implementation

Prerequisite

  1. Download and install Kumologica Designer.
npm install -g @kumologica/sdk
  1. Install the AnthropicAI node in the Kumologica project package.
 npm install @kumologica/kumologica-contrib-anthropicai

3. AnthropicAI account access and token for accessing the AnthropicAI platform

4. AWS account access with access key and secret having necessary permission to connect and insert data into DynamoDB.

Steps

Now we will start the implementation of the feedback service in Kumologica.

  1. Open the Kumologica Designer. On the menu click File > New Project. This will open the following popup to provide the project name and file location to save the project.
Figure 3: New project option (Image source: author)

2. Drag and drop the EventListener node from the pallet to the canvas. Provide the following config for the node.

Display Name : [POST] /customer/feedback
Provider : AWS
EventSource : Amazon API gateway
Verb : POST
URL : /customer/feedback

The article takes the assumption that ABC restaurant’s IT department has AWS cloud infrastructure.

3. Drag and drop the Logger and wire it to the EventListener node added in step one. Provide the following config for Logger.

Display Name : Log Entry
Level : INFO
Message : 'Request recevied : ' & msg.payload
Log format : String

4. Add two set property nodes to the canvas and provide the following config. The first one is to extract the request data and the second is to set the rules for extracting the comment to fields to store and analyze sentiment.

Set-Property 1
Display Name : Set Feedback Data

Operation : Set
Target : msg.comment
Source : msg.payload.comment

Operation : Set
Target : msg.rating
Source : msg.payload.rating

Set-Property 2
Display Name : Set Rule

Operation : Set
Target : msg.rule
Source : 'Based on the feedback given by the user extract the items mentioned, the comment about the item and provide the sentiment.' &'The extracted details to be responded in the following JSON format only: { "item" : "" , "comment" :"" , "sentiment" : ""}'

5. Now add the AnthropicAI node from the pallet and provide the following config. Then wire the node to the set property node in step 4.

Display Name : AnthropicAI
Operation : Single Q&A
Model : claude-3-sonnet-20240229
API Key : <<API key from AnthropicAI>>
System : msg.rule
User : msg.comment

6. Now we have the response from Anthropic AI which can be stored in DynamoDB using the DynamoDB node. The following is the configuration for the DynamoDB node.

Display Name : DynamoDB
Operation : PutItem
Table ARN : <<ARN of your table>>
Attributes:
Itemid = msg._msgid
Item = msg.payload.item
feedback = msg.payload.comment
sentiment = msg.payload.sentiment
rating = msg.rating

7. Finally wire the DynamoDB node to the EventListener End node with a logger reporting the exit.

The completed flow will look as shown below.

Figure 4: Customer feedback flow (Image source: author)

Try It

The above flow can be invoked with the following endpoint locally.

Endpoint : http://localhost:1880/customer/feedback
Method : POST
Content-Type : application/json
Body : {
"rating" : "2",
"comment" : "The chicken curry is too salty. Would have been better if less spicy as well"
}

You will get the response below. The response shows that the Anthropic AI has extracted the item and feedback and identified the sentiment on the user feedback comment. These data can be seen in the DynamoDB table as well.

{
"item":"chicken curry",
"comment":"too salty and spicy",
"sentiment":"negative"
}

--

--

Kumologica
Kumologica

Written by Kumologica

Kumologica is the first low-code development solution that makes your integration services run on serverless compute regardless the cloud provider.

No responses yet