0
Summarize a transcript using LeMUR
One script reply has been approved by the moderators Verified

Custom Summary allows you to distill a piece of audio into a few impactful sentences. You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.

Created by hugo697 32 days ago Viewed 2785 times
0
Submitted by hugo697 Bun
Verified 32 days ago
1
//native
2
type Assemblyai = {
3
  apiKey: string;
4
};
5
/**
6
 * Summarize a transcript using LeMUR
7
 * Custom Summary allows you to distill a piece of audio into a few impactful sentences.
8
You can give the model context to obtain more targeted results while outputting the results in a variety of formats described in human language.
9

10
 */
11
export async function main(
12
  auth: Assemblyai,
13
  body: {
14
    transcript_ids?: string[];
15
    input_text?: string;
16
    context?: string | {};
17
    final_model?: string;
18
    max_output_size?: number;
19
    temperature?: number;
20
  } & { answer_format?: string },
21
) {
22
  const url = new URL(`https://api.assemblyai.com/lemur/v3/generate/summary`);
23

24
  const response = await fetch(url, {
25
    method: "POST",
26
    headers: {
27
      "Content-Type": "application/json",
28
      Authorization: "Bearer " + auth.apiKey,
29
    },
30
    body: JSON.stringify(body),
31
  });
32
  if (!response.ok) {
33
    const text = await response.text();
34
    throw new Error(`${response.status} ${text}`);
35
  }
36
  return await response.json();
37
}
38