Skip to main content

Scenario

Transcribe customer calls with diarization and per-utterance sentiment. Separate customer from agent speech and mine the customer’s exact language — how they describe problems, what words they use for pain points — to build a messaging playbook in the customer’s own voice. Flow: Deepgram POST /v1/listen?model=nova-3&diarize=true&sentiment=true&utterances=true → speaker-separated transcript with sentiment → Mavera POST /mave/chat → Messaging playbook

Code

Example Output

Error Handling

Deepgram assigns IDs (0, 1, 2…) without labeling customer vs. agent. The code assumes the speaker with the most words is the customer. For inbound support calls, flip the logic or detect based on a known agent greeting.
Sentiment is segment-level (5-15 seconds), not per-word. Values are positive, neutral, or negative — no numeric scores.
Processing 5+ calls sequentially takes time. Parallelize with asyncio or Promise.all, limiting to 5 concurrent requests.