Analyze The Sentiment Of A Customer Call using LeMUR
In this guide, we’ll show you how to use AssemblyAI’s LeMUR (Leveraging Large Language Models to Understand Recognized Speech) framework to process an audio file and then use LeMUR’s Question & Answer feature to automatically detect sentiment analysis from customer calls as “positive”, “negative”, or “neutral”. In addition, we will glean additional insights beyond these three sentiments and learn the reasoning behind these detected sentiments.
Quickstart
Get Started
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an AssemblyAI account and get your API key from your dashboard.
LeMUR features are currently only available to paid users at two pricing tiers: LeMUR and LeMUR Basic. See pricing for more detail.
Step-by-Step Instructions
In this guide, we will ask five questions to learn about the sentiment of the customer and agent. You can adjust the questions to suit your project’s needs.
Import the assemblyai
package and set your API key.
Use the Transcriber
object’s transcribe
method and pass in the audio file’s path as a parameter. The transcribe
method will save the results of the transcription to the Transcriber
object’s transcript
attribute.
Define your LeMUR request context
parameters for the Question & Answer feature.
Define your answer_format
and questions
parameters for the Question & Answer feature.
Run the question
method on transcript
and print the result to your terminal.
The output will look similar to the example below.