> ## 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.

<Tabs groupId="language">
  <Tab language="python-sdk" title="Python SDK" default>
    ```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"],
        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>

  <Tab language="python" title="Python">
    ```python expandable theme={null}
    import json
    import requests

    config = {
        "stt_prompt": "A doctor dictating a patient visit note.",
        "keyterms_prompt": ["amoxicillin", "lisinopril", "metoprolol"],
        "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>

  <Tab language="javascript" title="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"],
      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>

  <Tab language="curl" title="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"], "llm_instruction": "Remove filler words and rewrite as a concise clinical chart note."};type=application/json' \
      -F 'audio=@clip.wav;type=audio/wav'
    ```
  </Tab>
</Tabs>

## 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.

<Tabs groupId="language">
  <Tab language="python-sdk" title="Python SDK" default>
    ```python expandable theme={null}
    import assemblyai as aai

    aai.settings.api_key = "<YOUR_API_KEY>"

    config = aai.DictationConfig(
        keyterms_prompt=["Reykjavik", "Cancun", "Lufthansa"],
        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>

  <Tab language="python" title="Python">
    ```python expandable theme={null}
    import json
    import requests

    config = {
        "keyterms_prompt": ["Reykjavik", "Cancun", "Lufthansa"],
        "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>

  <Tab language="javascript" title="JavaScript">
    ```javascript expandable theme={null}
    import { readFileSync } from "fs";

    const config = {
      keyterms_prompt: ["Reykjavik", "Cancun", "Lufthansa"],
      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>

  <Tab language="curl" title="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"], "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'
    ```
  </Tab>
</Tabs>

## Related pages

* [Prompting and keyterms](/docs/dictation/prompting-and-keyterms) — what `stt_prompt` and `keyterms_prompt` each steer
* [Transcript rewriting](/docs/dictation/transcript-rewriting) — writing a good `llm_instruction`
* [Quickstart](/docs/dictation) — the config reference these examples draw on
