stt_prompt and keyterms_prompt steer the ASR model while it writes the transcript down — the first describes the situation, the second lists the exact terms to expect. llm_instruction tells the LLM what to do with that transcript after it is written.
Clinical dictation
A doctor dictating a visit note.stt_prompt tells the model what kind of audio this is, keyterms_prompt pins the exact drug names, and llm_instruction turns the spoken rambling into a chart-ready note.
- Python SDK
- JavaScript SDK
- Python
- JavaScript
- cURL
import assemblyai as aai
aai.settings.api_key = "<YOUR_API_KEY>"
config = aai.DictationConfig(
stt_prompt="A doctor dictating a patient visit note.",
keyterms_prompt=["amoxicillin", "lisinopril", "metoprolol"],
rewrite_mode="smart",
llm_instruction=(
"Remove filler words and rewrite as a concise clinical chart note."
),
)
result = aai.DictationTranscriber().transcribe_live("clip.wav", config)
transcript = result.text
rewrite = result.final_text # the cleaned-up text, falling back to the transcript
import { AssemblyAI } from "assemblyai";
const client = new AssemblyAI({ apiKey: "<YOUR_API_KEY>" });
const config = {
stt_prompt: "A doctor dictating a patient visit note.",
keyterms_prompt: ["amoxicillin", "lisinopril", "metoprolol"],
rewrite_mode: "smart",
llm_instruction:
"Remove filler words and rewrite as a concise clinical chart note.",
};
const result = await client.dictation.transcribeLive("clip.wav", config);
const transcript = result.text;
const rewrite = result.final_text; // the cleaned-up text, falling back to the transcript
import json
import requests
config = {
"stt_prompt": "A doctor dictating a patient visit note.",
"keyterms_prompt": ["amoxicillin", "lisinopril", "metoprolol"],
"rewrite_mode": "smart",
"llm_instruction": (
"Remove filler words and rewrite as a concise clinical chart note."
),
}
with open("clip.wav", "rb") as f:
audio = f.read()
response = requests.post(
"https://dictation.assemblyai.com/v1/transcribe/live",
headers={"Authorization": "<YOUR_API_KEY>"},
files={
"config": (None, json.dumps(config), "application/json"),
"audio": ("clip.wav", audio, "audio/wav"),
},
timeout=90,
)
response.raise_for_status()
result = response.json()
transcript = result["text"]
rewrite = result["llm_response"] or transcript # fall back on rewrite failure
import { readFileSync } from "fs";
const config = {
stt_prompt: "A doctor dictating a patient visit note.",
keyterms_prompt: ["amoxicillin", "lisinopril", "metoprolol"],
rewrite_mode: "smart",
llm_instruction:
"Remove filler words and rewrite as a concise clinical chart note.",
};
const audio = readFileSync("clip.wav");
const form = new FormData();
form.append(
"config",
new Blob([JSON.stringify(config)], { type: "application/json" }),
);
form.append("audio", new Blob([audio], { type: "audio/wav" }), "clip.wav");
const response = await fetch("https://dictation.assemblyai.com/v1/transcribe/live", {
method: "POST",
headers: { Authorization: "<YOUR_API_KEY>" },
body: form,
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || error.detail);
}
const result = await response.json();
const transcript = result.text;
const rewrite = result.llm_response ?? transcript; // fall back on rewrite failure
curl -X POST https://dictation.assemblyai.com/v1/transcribe/live \
-H 'Authorization: <YOUR_API_KEY>' \
-F 'config={"stt_prompt": "A doctor dictating a patient visit note.", "keyterms_prompt": ["amoxicillin", "lisinopril", "metoprolol"], "rewrite_mode": "smart", "llm_instruction": "Remove filler words and rewrite as a concise clinical chart note."};type=application/json' \
-F 'audio=@clip.wav;type=audio/wav'
Travel booking summary
A travel agent dictating a client booking summary.keyterms_prompt pins the specific destination and airline names, and llm_instruction reshapes the transcript into a confirmation the client can read.
- Python SDK
- JavaScript SDK
- Python
- JavaScript
- cURL
import assemblyai as aai
aai.settings.api_key = "<YOUR_API_KEY>"
config = aai.DictationConfig(
keyterms_prompt=["Reykjavik", "Cancun", "Lufthansa"],
rewrite_mode="smart",
llm_instruction=(
"Remove filler words and rewrite as a short, friendly booking "
"confirmation addressed to the client."
),
)
result = aai.DictationTranscriber().transcribe_live("clip.wav", config)
transcript = result.text
rewrite = result.final_text # the cleaned-up text, falling back to the transcript
import { AssemblyAI } from "assemblyai";
const client = new AssemblyAI({ apiKey: "<YOUR_API_KEY>" });
const config = {
keyterms_prompt: ["Reykjavik", "Cancun", "Lufthansa"],
rewrite_mode: "smart",
llm_instruction:
"Remove filler words and rewrite as a short, friendly booking confirmation addressed to the client.",
};
const result = await client.dictation.transcribeLive("clip.wav", config);
const transcript = result.text;
const rewrite = result.final_text; // the cleaned-up text, falling back to the transcript
import json
import requests
config = {
"keyterms_prompt": ["Reykjavik", "Cancun", "Lufthansa"],
"rewrite_mode": "smart",
"llm_instruction": (
"Remove filler words and rewrite as a short, friendly booking "
"confirmation addressed to the client."
),
}
with open("clip.wav", "rb") as f:
audio = f.read()
response = requests.post(
"https://dictation.assemblyai.com/v1/transcribe/live",
headers={"Authorization": "<YOUR_API_KEY>"},
files={
"config": (None, json.dumps(config), "application/json"),
"audio": ("clip.wav", audio, "audio/wav"),
},
timeout=90,
)
response.raise_for_status()
result = response.json()
transcript = result["text"]
rewrite = result["llm_response"] or transcript
import { readFileSync } from "fs";
const config = {
keyterms_prompt: ["Reykjavik", "Cancun", "Lufthansa"],
rewrite_mode: "smart",
llm_instruction:
"Remove filler words and rewrite as a short, friendly booking confirmation addressed to the client.",
};
const audio = readFileSync("clip.wav");
const form = new FormData();
form.append(
"config",
new Blob([JSON.stringify(config)], { type: "application/json" }),
);
form.append("audio", new Blob([audio], { type: "audio/wav" }), "clip.wav");
const response = await fetch("https://dictation.assemblyai.com/v1/transcribe/live", {
method: "POST",
headers: { Authorization: "<YOUR_API_KEY>" },
body: form,
});
if (!response.ok) {
const error = await response.json();
throw new Error(error.error || error.detail);
}
const result = await response.json();
const transcript = result.text;
const rewrite = result.llm_response ?? transcript;
curl -X POST https://dictation.assemblyai.com/v1/transcribe/live \
-H 'Authorization: <YOUR_API_KEY>' \
-F 'config={"keyterms_prompt": ["Reykjavik", "Cancun", "Lufthansa"], "rewrite_mode": "smart", "llm_instruction": "Remove filler words and rewrite as a short, friendly booking confirmation addressed to the client."};type=application/json' \
-F 'audio=@clip.wav;type=audio/wav'
Related pages
- Prompting and keyterms — what
stt_promptandkeyterms_prompteach steer - Transcript rewriting — writing a good
llm_instruction - Quickstart — the config reference these examples draw on