This feature is on Alpha state.

We’re looking for feedbacks to improve this feature, share yours here.

The Summarization model generates a summary of your transcript.

You choose one of our summary type to customize the summarization based on your preference.

3 summarization types are available:

  • general : A regular summary of the transcription
  • concise : A shorter summary for quick overview
  • bullet_points : Retrieve the key points in a list

If no summarization_config is provided, general type will be used by default. Find all this information in the API Reference (see summarization_config).

In the following examples, we’re using concise type.

async function makeFetchRequest(url: string, options: any) {
  const response = await fetch(url, options);
  return response.json();
}

async function pollForResult(resultUrl: string, headers: any) {
  while (true) {
    console.log("Polling for results...");
    const pollResponse = await makeFetchRequest(resultUrl, { headers });

    if (pollResponse.status === "done") {
      console.log("- Transcription done: \n");
      const summarization = pollResponse.result.summarization;
      console.log(summarization);
      break;
    } else {
      console.log("Transcription status : ", pollResponse.status);
      await new Promise((resolve) => setTimeout(resolve, 1000));
    }
  }
}

async function startTranscription() {
  const gladiaKey = "YOUR_GLADIA_API_TOKEN";
  const requestData = {
    audio_url:
      "YOUR_AUDIO_URL",
    summarization: true,
    summarization_config: { 
      type: "concise" // can be 'general', 'concise' or 'bullet_points'
      // use 'general' if no summarization_config is provided
    }
  };
  const gladiaUrl = "https://api.gladia.io/v2/transcription/";
  const headers = {
    "x-gladia-key": gladiaKey,
    "Content-Type": "application/json",
  };

  console.log("- Sending initial request to Gladia API...");
  const initialResponse = await makeFetchRequest(gladiaUrl, {
    method: "POST",
    headers,
    body: JSON.stringify(requestData),
  });

  console.log("Initial response with Transcription ID :", initialResponse);

  if (initialResponse.result_url) {
    await pollForResult(initialResponse.result_url, headers);
  }
}

startTranscription();

With this code, your output will look like this:

{
  success: true,
  is_empty: false,
  results: 'This transcription suggests that...',
  exec_time: 1.5126123428344727,
  error: null
}

You’ll find the summarization of your audio under the results key.