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

# Formatting

export const ModelBadges = ({models}) => {
  return <div className="flex flex-wrap gap-2 -mt-3 mb-3 not-prose">
      {models.map(model => <span key={model} className="inline-flex items-center rounded-full bg-green-500/15 px-2.5 py-0.5 text-xs font-mono text-green-700 dark:text-green-400 ring-1 ring-inset ring-green-500/30">
          {model}
        </span>)}
    </div>;
};

<ModelBadges models={["universal-3-5-pro", "universal-2"]} />

`format_text` lets you control how numbers and other entities in your transcript are formatted. By default, `format_text` is `true`, so numbers, dates, and similar entities are formatted for readability.

When `format_text` is set to `false`, the transcript reflects exactly what was said instead — a speaker saying "one hundred" comes back as "one hundred" rather than `100`, useful for verbatim workflows, like medical dictation.

<Tabs groupId="language">
  <Tab language="python" title="Python" default>
    To enable text formatting, set `format_text` to `True` in the POST request body:

    ```python {10}  expandable theme={null}
    import requests
    import time

    base_url = "https://api.assemblyai.com"
    headers = {"authorization": "<YOUR_API_KEY>"}

    data = {
        "audio_url": "https://assemblyaiassets.com/8e23e453-format_text.m4a",
        "language_detection": True,
        "format_text": True
    }

    response = requests.post(base_url + "/v2/transcript", headers=headers, json=data)

    if response.status_code != 200:
        print(f"Error: {response.status_code}, Response: {response.text}")
        response.raise_for_status()

    transcript_response = response.json()
    transcript_id = transcript_response["id"]
    polling_endpoint = f"{base_url}/v2/transcript/{transcript_id}"

    while True:
        transcript = requests.get(polling_endpoint, headers=headers).json()
        if transcript["status"] == "completed":
            print(transcript["text"])
            break
        elif transcript["status"] == "error":
            raise RuntimeError(f"Transcription failed: {transcript['error']}")
        else:
            time.sleep(3)
    ```
  </Tab>

  <Tab language="python-sdk" title="Python SDK">
    To enable text formatting, set `format_text` to `True` in the transcription config.

    ```python {11}  theme={null}
    from assemblyai.prerecorded.v2 import Transcriber, TranscriptionConfig

    # You can use a local filepath:
    # audio_file = "./example.mp3"

    # Or use a publicly-accessible URL:
    audio_file = "https://assemblyaiassets.com/8e23e453-format_text.m4a"

    config = TranscriptionConfig(
        language_detection=True,
        format_text=True,
    )

    transcriber = Transcriber(api_key="<YOUR_API_KEY>")
    transcript = transcriber.transcribe(audio_file, config)

    print(transcript.text)
    ```
  </Tab>

  <Tab language="javascript" title="JavaScript">
    To enable text formatting, set `format_text` to `true` in the POST request body:

    ```javascript {9}  expandable theme={null}
    const baseUrl = "https://api.assemblyai.com";
    const headers = {
      authorization: "<YOUR_API_KEY>",
    };

    const data = {
      audio_url: "https://assemblyaiassets.com/8e23e453-format_text.m4a",
      language_detection: true,
      format_text: true,
    };

    const url = `${baseUrl}/v2/transcript`;
    let res = await fetch(url, {
      method: "POST",
      headers: { ...headers, "Content-Type": "application/json" },
      body: JSON.stringify(data),
    });
    if (!res.ok) throw new Error(`Error: ${res.status}`);
    const response = await res.json();

    const transcriptId = response.id;
    const pollingEndpoint = `${baseUrl}/v2/transcript/${transcriptId}`;

    while (true) {
      res = await fetch(pollingEndpoint, { headers });
      if (!res.ok) throw new Error(`Error: ${res.status}`);
      const transcriptionResult = await res.json();

      if (transcriptionResult.status === "completed") {
        console.log(transcriptionResult.text);
        break;
      } else if (transcriptionResult.status === "error") {
        throw new Error(`Transcription failed: ${transcriptionResult.error}`);
      } else {
        await new Promise((resolve) => setTimeout(resolve, 3000));
      }
    }
    ```
  </Tab>

  <Tab language="javascript-sdk" title="JavaScript SDK">
    To enable text formatting, set `format_text` to `true` in the transcription config.

    ```javascript {16}  expandable theme={null}
    import { AssemblyAI } from "assemblyai";

    const client = new AssemblyAI({
      apiKey: "<YOUR_API_KEY>",
    });

    // You can use a local filepath:
    // const audioFile = "./example.mp3"

    // Or use a publicly-accessible URL:
    const audioFile = "https://assemblyaiassets.com/8e23e453-format_text.m4a";

    const params = {
      audio: audioFile,
      language_detection: true,
      format_text: true,
    };

    const run = async () => {
      const transcript = await client.transcripts.transcribe(params);
      console.log(transcript.text);
    };

    run();
    ```
  </Tab>
</Tabs>
