Create Custom LLM Prompts

Learn about different use cases for LeMUR with these examples.

If you want a Quickstart, see Apply LLMs to audio files.

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.

1import requests
2import time
3
4base_url = "https://api.assemblyai.com"
5
6headers = {
7 "authorization": "<YOUR_API_KEY>"
8}
9
10# Step 1: Transcribe an audio file.
11# You can use a local filepath:
12# with open("./my-audio.mp3", "rb") as f:
13# response = requests.post(base_url + "/v2/upload",
14# headers=headers,
15# data=f)
16# upload_url = response.json()["upload_url"]
17
18# Or use a publicly-accessible URL:
19upload_url = "https://assembly.ai/call.mp4"
20
21data = {
22 "audio_url": upload_url
23}
24
25response = requests.post(base_url + "/v2/transcript", headers=headers, json=data)
26
27transcript_id = response.json()["id"]
28polling_endpoint = base_url + f"/v2/transcript/{transcript_id}"
29
30while True:
31 transcript = requests.get(polling_endpoint, headers=headers).json()
32
33 if transcript["status"] == "completed":
34 break
35
36 elif transcript["status"] == "error":
37 raise RuntimeError(f"Transcription failed: {transcript['error']}")
38
39 else:
40 time.sleep(3)
41
42# Step 2: Define your prompt.
43prompt = "What was the emotional sentiment of the phone call?"
44
45# Step 3: Apply LeMUR.
46lemur_data = {
47 "prompt": prompt,
48 "transcript_ids": [transcript_id],
49 "final_model": "anthropic/claude-sonnet-4-20250514",
50}
51
52result = requests.post(base_url + "/lemur/v3/generate/task", headers=headers, json=lemur_data)
53print(result.json()["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 our Cookbooks.