//native
type Assemblyai = {
apiKey: string;
};
/**
* Ask questions using LeMUR
* Question & Answer allows you to ask free-form questions about a single transcript or a group of transcripts.
The questions can be any whose answers you find useful, such as judging whether a caller is likely to become a customer or whether all items on a meeting's agenda were covered.
*/
export async function main(
auth: Assemblyai,
body: {
transcript_ids?: string[];
input_text?: string;
context?: string | {};
final_model?: string;
max_output_size?: number;
temperature?: number;
} & {
questions: {
question: string;
context?: string | {};
answer_format?: string;
answer_options?: string[];
}[];
},
) {
const url = new URL(
`https://api.assemblyai.com/lemur/v3/generate/question-answer`,
);
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 24 days ago