DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • MCP Elicitation: Human-in-the-Loop for MCP Servers
  • Logging MCP Protocol When Using stdio, Part II
  • Unlocking Oracle 23 AI's JSON Relational Duality
  • Fresh Data for AI With Spring AI Function Calls

Trending

  • Data Contracts as the "Circuit Breaker" for Model Reliability
  • Dear Micromanager: Your Distrust Has a Job; It’s Just Not the One You’re Doing
  • Why Your DLP Policies Fall Short the Moment AI Agents Enter the Picture
  • Exactly-Once Processing: Myth vs Reality
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. Low Code AI Agent Using Kumologica and Anthropic AI for Customer Feedback Sentiment Analysis

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

The article covers the design and implementation of a low code AI agent developed using Kumologica and Anthropic AI for customer feedback sentiment analysis.

By 
Pranav K user avatar
Pranav K
DZone Core CORE ·
Oct. 07, 24 · Tutorial
Likes (2)
Comment
Save
Tweet
Share
2.8K Views

Join the DZone community and get the full member experience.

Join For Free

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.

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.  

Feedback form

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.

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


The response from Anthropic AI will be as follows:

JSON
 
 {
"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 i @kumologica/sdk 


2. Install the OpenAI node in the Kumologica project package.

 
 npm i @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. 

Step 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.  New project option

Figure 3: New project option (Image source: author)

Step 2

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

Plain Text
 
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.

Step 3

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

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


Step 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.

Plain Text
 
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.


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


Step 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.

Plain Text
 
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


Step 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.

Customer feedback flow

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

Try It

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

Plain Text
 
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.

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


AI Amazon DynamoDB JSON Plain text low code

Opinions expressed by DZone contributors are their own.

Related

  • MCP Elicitation: Human-in-the-Loop for MCP Servers
  • Logging MCP Protocol When Using stdio, Part II
  • Unlocking Oracle 23 AI's JSON Relational Duality
  • Fresh Data for AI With Spring AI Function Calls

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook