Skip to main content
If you want a Quickstart, see Apply LLMs to audio files.
Before you startTo use LeMUR, you need an AssemblyAI account with a credit card set up.

Custom prompt example

If you want to send a custom prompt to the LLM, you can use the LeMUR Task and apply the model to your transcribed audio files.
import assemblyai as aai

aai.settings.api_key = "YOUR_API_KEY"

# Step 1: Transcribe an audio file.
# audio_file = "./local_file.mp4"
audio_file = "https://assembly.ai/call.mp4"

transcriber = aai.Transcriber()
transcript = transcriber.transcribe(audio_file)

# Step 2: Define your prompt.
prompt = "What was the emotional sentiment of the phone call?"

# Step 3: Apply LeMUR.
result = transcript.lemur.task(
    prompt, final_model=aai.LemurModel.claude3_5_sonnet
)

print(result.response)
import { AssemblyAI } from 'assemblyai'

const client = new AssemblyAI({
  apiKey: 'YOUR_API_KEY'
})

const run = async () => {
  // Step 1: Transcribe an audio file.
  // const audioFile = './local_file.mp4'
  const audioFile = 'https://assembly.ai/call.mp4'
  const transcript = await client.transcripts.transcribe({ audio: audioFile })

  // Step 2: Define your prompt.
  const prompt = 'What was the emotional sentiment of the phone call?'

  // Step 3: Apply LeMUR.
  const { response } = await client.lemur.task({
    transcript_ids: [transcript.id],
    prompt,
    final_model: 'anthropic/claude-3-5-sonnet'
  })

  console.log(response)
}

run()
package main

import (
    "context"
    "fmt"

    aai "github.com/AssemblyAI/assemblyai-go-sdk"
)

func main() {
    ctx := context.Background()

    client := aai.NewClient("YOUR_API_KEY")

    // Step 1: Transcribe an audio file. For local files see our Getting Started guides.
    audioURL := "https://assembly.ai/call.mp4"
    transcript, _ := client.Transcripts.TranscribeFromURL(ctx, audioURL, nil)

    // Step 2: Define your prompt.
    prompt := "What was the emotional sentiment of the phone call?"

    // Step 3: Apply LeMUR.
    var params aai.LeMURTaskParams
    params.Prompt = aai.String(prompt)
    params.TranscriptIDs = []string{aai.ToString(transcript.ID)}
    params.FinalModel = "anthropic/claude-3-5-sonnet"

    result, _ := client.LeMUR.Task(ctx, params)

    fmt.Println(*result.Response)
}
import com.assemblyai.api.AssemblyAI;
import com.assemblyai.api.resources.transcripts.types.*;
import com.assemblyai.api.resources.lemur.requests.*;
import java.util.List;

public final class App {
    public static void main(String[] args) {

        AssemblyAI client = AssemblyAI.builder()
                .apiKey("YOUR_API_KEY")
                .build();

        // Step 1: Transcribe an audio file. For local files see our Getting Started guides.
        String audioUrl = "https://assembly.ai/call.mp4";
        Transcript transcript = client.transcripts().transcribe(audioUrl);

        // Step 2: Define your prompt.
        String prompt = "What was the emotional sentiment of the phone call?";

        // Step 3: Apply LeMUR.
        var params = LemurTaskParams.builder()
                .prompt(prompt)
                .transcriptIds(List.of(transcript.getId()))
                .finalModel(LemurModel.ANTHROPIC_CLAUDE3_5_SONNET)
                .build();

        var response = client.lemur().task(params);

        System.out.println(response.getResponse());
    }
}
using AssemblyAI;
using AssemblyAI.Lemur;
using AssemblyAI.Transcripts;

var client = new AssemblyAIClient("YOUR_API_KEY");

// Step 1: Transcribe an audio file. For local files see our Getting Started guides.
var transcript = await client.Transcripts.TranscribeAsync(new TranscriptParams
{
    AudioUrl = "https://assembly.ai/call.mp4"
});

// Step 2: Define your prompt.
const string prompt = "What was the emotional sentiment of the phone call?";

// Step 3: Apply LeMUR.
var lemurTaskParams = new LemurTaskParams
{
    Prompt = prompt,
    TranscriptIds = [transcript.Id],
    FinalModel = LemurModel.AnthropicClaude3_5_Sonnet
};

var response = await client.Lemur.TaskAsync(lemurTaskParams);

Console.WriteLine(response.Response);
require 'assemblyai'

client = AssemblyAI::Client.new(api_key: 'YOUR_API_KEY')

# Step 1: Transcribe audio file. For local files see our Getting Started guides.
audio_url = 'https://assembly.ai/call.mp4'
transcript = client.transcripts.transcribe(audio_url: audio_url)

# Step 2: Define your prompt.
prompt = "What was the emotional sentiment of the phone call?"

# Step 3: Apply LeMUR.
response = client.lemur.task(
  prompt: prompt,
  transcript_ids: [transcript.id],
  final_model: AssemblyAI::Lemur::LemurModel::ANTHROPIC_CLAUDE3_5_SONNET
)

puts response.response

Ideas to get you started

Use caseExample prompt
Question & Answer”Identify any patterns or trends based on the transcript”
Quote or Citation”List the timestamp X topic was discussed, provide specific citations”
Closed-ended questions”Did the customer express a positive sentiment in the phone call?”
Sentiment analysis”What was the emotional sentiment of the phone call?”
Summaries”Summarize key decisions and important points from the phone call transcript”
Summarize audio segments”Summarize the key events of each chapter”
Generate titles and descriptions”Generate an attention-grabbing YouTube title based on the video transcript”
Generate tags”Generate keywords that can be used to describe the key themes of the conversation”
Action items”What action items were assigned to each participant?”
Generate content”Generate a blog post with key information presented in bullet points from the transcript”
Paraphrasing”Rephrase X segment from the transcript in a different way”
You can find more ideas and code examples in the AssemblyAI Cookbook repo on Github.