0
Purge LeMUR request data
One script reply has been approved by the moderators Verified

Delete the data for a previously submitted LeMUR request. The LLM response data, as well as any context provided in the original request will be removed.

Created by hugo697 32 days ago Viewed 2789 times
0
Submitted by hugo697 Bun
Verified 32 days ago
1
//native
2
type Assemblyai = {
3
  apiKey: string;
4
};
5
/**
6
 * Purge LeMUR request data
7
 * Delete the data for a previously submitted LeMUR request.
8
The LLM response data, as well as any context provided in the original request will be removed.
9

10
 */
11
export async function main(auth: Assemblyai, request_id: string) {
12
  const url = new URL(`https://api.assemblyai.com/lemur/v3/${request_id}`);
13

14
  const response = await fetch(url, {
15
    method: "DELETE",
16
    headers: {
17
      Authorization: "Bearer " + auth.apiKey,
18
    },
19
    body: undefined,
20
  });
21
  if (!response.ok) {
22
    const text = await response.text();
23
    throw new Error(`${response.status} ${text}`);
24
  }
25
  return await response.json();
26
}
27