can we get speech_id for transcriptions as well?
# ask-ai
b
can we get speech_id for transcriptions as well?
t
Thanks for reaching out, Sandeep. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
LiveKit gives you unique identifiers for transcription segments, but it doesn’t include a specific
speech_id
in the transcription data. Instead, each segment has its own unique
id
, which ties back to particular participants and tracks. If you’re looking for a specific identifier for a speech session, you might need to create one yourself. Just let me know if you’d like some help figuring out how to do that for your setup—I’m happy to guide you through it! Sources: Transcriptions | LiveKit Docs | livekit-agents/livekit/agents/voice/transcription/_utils.py
b
how can I map speech_ids to a turn transcript
t
Here’s a friendly guide to help you map
speech_ids
to a turn transcript in LiveKit: 1. Create a Unique
speech_id
for Each Turn:
You can use a unique ID generator like
shortuuid
within your agent to assign a distinct
speech_id
to every turn. 2. Attach the
speech_id
to Transcription Segments:
Update your agent so that each
SpeechEvent
sent to the frontend includes the corresponding
speech_id
. 3. Group Segments by
speech_id
on the Frontend:
When you receive a
RoomEvent.TranscriptionReceived
, make sure to organize each transcription segment under its matching
speech_id
. 4. Handle Final Segments: Keep an eye on the
final
property to know when a segment is complete, then wrap up the transcript for that turn. If you want, I’m here to help with any part of the implementation or share some code examples—just let me know!