Speaker targeting
Use target in report requests to choose which speaker is analyzed.
Strategies​
| Strategy | Use when | Key fields |
|---|---|---|
dominant | one clear primary speaker | strategy |
magic_hint | role known in natural language | hint, optional onMiss |
entity_id | same speaker tracked across sessions | entityId, optional onMiss |
timerange | speaker in specific segment | timeRange, optional onMiss |
Dominant speaker​
const receipt = await mappa.reports.createJob({
media: { mediaId: "media_abc123" },
output: { template: "general_report" },
target: { strategy: "dominant" },
});
Magic hint (recommended for multi-speaker)​
const report = await mappa.reports.generateFromUrl({
url: "https://example.com/interview.mp3",
output: {
template: "hiring_report",
templateParams: {
roleTitle: "Senior Software Engineer",
roleDescription: "Backend development",
companyCulture: "Collaborative",
},
},
target: {
strategy: "magic_hint",
hint: "the job candidate being interviewed",
onMiss: "fallback_dominant",
},
});
Entity ID (best for continuity)​
const round1 = await mappa.reports.generateFromUrl({
url: "https://example.com/round-1.mp3",
output: { template: "general_report" },
target: { strategy: "magic_hint", hint: "the candidate" },
});
const entityId = round1.entity?.id;
if (!entityId) throw new Error("Entity not found");
const round2 = await mappa.reports.generateFromUrl({
url: "https://example.com/round-2.mp3",
output: { template: "hiring_report" },
target: { strategy: "entity_id", entityId },
});
Time range​
const report = await mappa.reports.generate({
media: { mediaId: "media_meeting789" },
output: { template: "general_report" },
target: {
strategy: "timerange",
timeRange: {
startSeconds: 0,
endSeconds: 300,
},
onMiss: "fallback_dominant",
},
});
Hint quality​
- Good:
"the interviewer asking questions" - Good:
"the potential customer or prospect" - Avoid:
"speaker 1","the loud one"
Best practices​
- Default to
magic_hintfor multi-speaker calls. - Store
report.entity?.idand switch toentity_idin future sessions. - Use
onMiss: "fallback_dominant"in production to reduce hard failures.