i'm tracking stt usage for agent, it's giving mult...
# ask-ai
e
i'm tracking stt usage for agent, it's giving multiple records for stt, do i have to pick the last one?
t
Thanks for reaching out, Aman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
You're seeing multiple STT records because each speech segment/utterance produces its own
STTMetrics
event. Do not pick only the last record — aggregate them. What to do: • Sum
audio_duration
across all
STTMetrics
to get total transcribed seconds. • Sum character/word counts (or whichever counters your pipeline emits) to get total transcription volume. • Count records if you need number of speech turns. • Use
speech_id
to group segments belonging to the same user turn when needed. If you want, tell me which fields your events include (example:
audio_duration
, character count,
speech_id
) and I’ll suggest a specific aggregation snippet for your stack (Python/JS/etc.). Sources: Observability data hooks | LiveKit docs
e
do audio_duration return seconds , because i spoke for around 1-2 seconds and have following { "_id": { "$oid": "69302c86d7d26928bbc3fc45" }, "conversationId": { "$oid": "69302be3d7d26928bbc3fc2a" }, "senderType": "user", "message": "Do you have a best service?", "timeStamp": 1764745006620, "usage": { "tts": [], "stt": [ { "type": "stt_metrics", "duration": 0, "label": "livekit.plugins.deepgram.stt_v2.STTv2", "request_id": "7ff64bcc-608e-4cdb-95f1-a4a26896bd57", "timestamp": 1764764655.9858177, "audio_duration": 5.04999999999999, "streamed": true, "metadata": { "model_name": "flux-general-en", "model_provider": "Deepgram" } }, { "type": "stt_metrics", "duration": 0, "label": "livekit.plugins.deepgram.stt_v2.STTv2", "request_id": "7ff64bcc-608e-4cdb-95f1-a4a26896bd57", "timestamp": 1764764660.9864786, "audio_duration": 4.99999999999999, "streamed": true, "metadata": { "model_name": "flux-general-en", "model_provider": "Deepgram" } }, }
t
You're seeing expected behavior:
audio_duration
is reported in seconds. Why it can be larger than the 1–2s you spoke: • VAD buffering and warm-up can include a bit of pre-roll before speech and trailing silence after the turn is closed. • Streaming STT can emit multiple incremental/overlapping segments for the same utterance (you have two ~5s entries), so individual records may overlap or reflect total frames sent to the STT engine rather than the audible speech length alone. What to do: • Aggregate
audio_duration
across
stt
records to measure total audio processed. • If you want "spoken-only" time, consider subtracting estimated silence by post-processing audio or grouping by
speech_id
and deduplicating overlapping segments before summing. If you want, tell me which stack (Python/JS) you use and I’ll provide a short snippet to group/deduplicate and sum
audio_duration
. Sources: Observability data hooks | LiveKit docs