Skip to main content

Entity tracking recipe

Persist report.entity?.id from the first analysis, then use target.strategy = "entity_id" on future recordings.

First session

import { Conduit } from "@mappa-ai/conduit"

const conduitClient = new Conduit({ apiKey: process.env.CONDUIT_API_KEY! })

const firstReceipt = await conduitClient.reports.create({
source: { url: "https://example.com/interview-round-1.mp3" },
output: { template: "general_report" },
target: { strategy: "magic_hint", hint: "the job candidate" },
})

const first = await firstReceipt.handle?.wait()
const entityId = first?.entity?.id
if (!entityId) throw new Error("Entity was not resolved")

await db.candidates.update({ id: "cand_123", conduitEntityId: entityId })

Future sessions

const entityId = await db.candidates.getEntityId("cand_123")

const receipt = await conduitClient.reports.create({
source: { url: "https://example.com/interview-round-2.mp3" },
output: { template: "general_report" },
target: { strategy: "entity_id", entityId },
})

const report = await receipt.handle?.wait()
console.info(report?.id)