Create Chapter Summaries with LeMURs Custom Text Input Parameter
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 summarize it into chapters by sending in the timestamped transcript via LeMUR’s input_text
parameter.
Calling LeMUR using transcript_ids
is preferred as default. Depending on
your use case, you can alternatively use the input_text
parameter to call
LeMUR with custom formatted transcript data including edited transcripts,
speaker-labelled transcripts and more.
Quickstart
Get Started
Before we begin, make sure you have an AssemblyAI account and an API key. You can sign up for an 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 details.
Step-by-Step Instructions
First, let’s install the AssemblyAI SDK.
Import the assemblyai
package and set your API key.
Use the Transcriber
object’s transcribe
method and parse the audio file URL path as a parameter. The transcribe
method will save the results of the transcription to the Transcriber
object’s transcript
attribute.
Next we’ll use the SDK to fetch all of the paragraphs generated out of this transcript and combine them into groups. We set a step
variable that controls how many paragraphs we combine into one overall paragraph to help LeMUR have more context to create better summaries.
We also extract the appropriate start
and end
timestamps, and save all of our combined paragraphs in string form to send into LeMUR in a later step.
Now we’ll use LeMUR’s task endpoint in conjuction with the input_text
parameter to send in all of our combined_paragraphs
to create summaries for each one.
The summary for each paragraph then gets saved to a results
array so we can output all of them at the same time.
The output will look similar to the example below.