How to analyze chat sentiment using Amazon Lex and OpenAI-GPT-3 API: Deploy using Terraform and Github Actions

Amlan Chakladar
1 min readFeb 11, 2023

--

ChatGPT is the most hot topic now in the tech community. Its growth in popularity in a short time has solidified its position among other similar solutions. I decided to have a go at learning the workings of the underlying API (not the exact ChatGPT API but the previous version of it). What best way to lean than use it in an usable use case.

The simplest use case I could think of using the AI to analyze the sentiment of a text. In this post I am using GPT-3 API to analyze the sentiment of a sentence. For an usable use case, the sentence is a chat typed on Amazon Lex, which can be a customer typing a feedback to an agent on the other side. Based on what the customer is typing on the chat via Lex, the GPT-3 API analyzes the sentiment and Lex responds according to the sentiment of the chat text. I am training a custom model using some sample data to tune the analysis based on my use case.

For demo video: https://youtube.com/shorts/HTtwq-QFeQ8

For more details about the post: https://amlanscloud.com/lexgptchat/

--

--

Amlan Chakladar

Cloud architect and DevOps engineer. Love to code and develop new stuff. A nerd by nature.