//native
type Assemblyai = {
  apiKey: string;
};
/**
 * Summarize a transcript using LeMUR
 * 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.
 */
export async function main(
  auth: Assemblyai,
  body: {
    transcript_ids?: string[];
    input_text?: string;
    context?: string | {};
    final_model?: string;
    max_output_size?: number;
    temperature?: number;
  } & { answer_format?: string },
) {
  const url = new URL(`https://api.assemblyai.com/lemur/v3/generate/summary`);
  const response = await fetch(url, {
    method: "POST",
    headers: {
      "Content-Type": "application/json",
      Authorization: "Bearer " + auth.apiKey,
    },
    body: JSON.stringify(body),
  });
  if (!response.ok) {
    const text = await response.text();
    throw new Error(`${response.status} ${text}`);
  }
  return await response.json();
}
Submitted by hugo697 206 days ago