Multi-speaker analysis recipe
Generate one report per speaker while reusing the same uploaded media.
Basic flow
import { Mappa } from "@mappa-ai/mappa-node";
const mappa = new Mappa({ apiKey: process.env.MAPPA_API_KEY! });
const media = await mappa.files.upload({ file: await Bun.file("./interview.mp4").arrayBuffer() });
const [candidate, interviewer] = await Promise.all([
mappa.reports.generate({
media: { mediaId: media.mediaId },
output: {
template: "hiring_report",
templateParams: {
roleTitle: "Senior Software Engineer",
roleDescription: "Backend systems",
companyCulture: "Collaborative and fast-paced",
},
},
target: {
strategy: "magic_hint",
hint: "the job candidate being interviewed",
onMiss: "fallback_dominant",
},
}),
mappa.reports.generate({
media: { mediaId: media.mediaId },
output: { template: "general_report" },
target: {
strategy: "magic_hint",
hint: "the interviewer asking questions",
onMiss: "fallback_dominant",
},
}),
]);
console.info(candidate.id, interviewer.id);
Production async variant
const [a, b] = await Promise.all([
mappa.reports.createJob({
media: { mediaId: "media_123" },
output: { template: "sales_playbook" },
target: { strategy: "magic_hint", hint: "the prospect" },
}),
mappa.reports.createJob({
media: { mediaId: "media_123" },
output: { template: "general_report" },
target: { strategy: "magic_hint", hint: "the account executive" },
}),
]);
const [prospect, salesRep] = await Promise.all([
(a.handle ?? mappa.reports.makeHandle(a.jobId)).wait(),
(b.handle ?? mappa.reports.makeHandle(b.jobId)).wait(),
]);
Submit feedback for each report
for (const report of [candidate, interviewer]) {
await mappa.feedback.create({
reportId: report.id,
rating: "thumbs_up",
comment: "Helpful analysis",
});
}