Setup An AI Coach With LeMUR

This tutorial will demonstrate how to use AssemblyAI’s LeMUR (Leveraging Large Language Models to Understand Recognized Speech) framework to get AI coaching using the Task endpoint.

Quickstart

1import assemblyai as aai
2
3aai.settings.api_key = "YOUR_API_KEY"
4audio_url = "https://storage.googleapis.com/aai-web-samples/meeting.mp4"
5
6transcript = aai.Transcriber().transcribe(audio_url)
7
8prompt = f"""
9- You are an expert at providing valuable feedback to individuals.
10- You possess exceptionally high emotional intelligence.
11- You excel at analyzing the behavior of individuals in the given transcript and providing insights on how they could improve.
12- You emphasize constructive criticism in your feedback.
13- The feedback focuses on how people can better achieve their objectives.
14- You avoid providing unjustified or unfounded feedback.
15- Your communication is clear, accurate and concise, and you write with perfect English.
16- Directly start with the feedback without any preamble or introduction.
17"""
18
19result = transcript.lemur.task(
20 prompt,
21 final_model=aai.LemurModel.claude3_5_sonnet
22)
23
24response = result.response
25print(response)

Getting 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. You will need to upgrade your account by adding a credit card to have access to LeMUR.

Find more details on the current LeMUR pricing in the AssemblyAI pricing page.

Step-by-Step Instructions

In this guide, we’ll prompt LeMUR to perform some AI coaching.

First, let’s install the AssemblyAI SDK.

$pip install -U assemblyai

Then we’ll import the SDK and set our AssemblyAI API key.

1import assemblyai as aai
2
3aai.settings.api_key = "API_KEY"

Next, we’ll use AssemblyAI to transcribe a file and save our transcript.

1audio_url = "https://storage.googleapis.com/aai-web-samples/meeting.mp4"
2
3transcript = aai.Transcriber().transcribe(audio_url)

Provide detailed instructions to prompt LeMUR to provide feedback on your sales call, meeting, or other content.

1prompt = f"""
2- You are an expert at providing valuable feedback to individuals.
3- You possess exceptionally high emotional intelligence.
4- You excel at analyzing the behavior of individuals in the given transcript and providing insights on how they could improve.
5- You emphasize constructive criticism in your feedback.
6- The feedback focuses on how people can better achieve their objectives.
7- You avoid providing unjustified or unfounded feedback.
8- Your communication is clear, accurate and concise, and you write with perfect English.
9- Directly start with the feedback without any preamble or introduction.
10"""

Prompt the LeMUR model using the Task Endpoint and return the response.

1result = transcript.lemur.task(
2 prompt,
3 final_model=aai.LemurModel.claude3_5_sonnet
4)
5
6response = result.response
7print(response)