> ## Documentation Index
> Fetch the complete documentation index at: https://assemblyai.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Examples

> End-to-end Dictation requests for a clinical note and a travel booking, showing how the config fields work together.

The knobs do different jobs. `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.

> [tab] Python SDK
>
> ```python expandable theme={null}
> 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
> ```

> [tab] JavaScript SDK
>
> ```javascript expandable theme={null}
> 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
> ```

> [tab] Python
>
> ```python expandable theme={null}
> 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
> ```

> [tab] JavaScript
>
> ```javascript expandable theme={null}
> 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
> ```

> [tab] cURL
>
> ```bash theme={null}
> 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.

> [tab] Python SDK
>
> ```python expandable theme={null}
> 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
> ```

> [tab] JavaScript SDK
>
> ```javascript expandable theme={null}
> 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
> ```

> [tab] Python
>
> ```python expandable theme={null}
> 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
> ```

> [tab] JavaScript
>
> ```javascript expandable theme={null}
> 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;
> ```

> [tab] cURL
>
> ```bash theme={null}
> 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](https://assemblyai.com/docs/dictation/prompting-and-keyterms.md) — what `stt_prompt` and `keyterms_prompt` each steer
* [Transcript rewriting](https://assemblyai.com/docs/dictation/transcript-rewriting.md) — writing a good `llm_instruction`
* [Quickstart](https://assemblyai.com/docs/dictation.md) — the config reference these examples draw on
