limited-planet-15554
10/14/2025, 1:32 PMtall-airline-16756
10/14/2025, 1:32 PMtall-airline-16756
10/14/2025, 1:33 PMuse_tts_aligned_transcript=True in your AgentSession configuration. For example:
session = AgentSession(
stt=deepgram.STT(),
llm=openai.LLM(),
tts=cartesia.TTS(),
use_tts_aligned_transcript=True,
)
1. Implement the transcription_node Method: In your agent class, define this method to capture the start time of each utterance. The iterator will yield a TimedString object, which includes both start_time and end_time for every word or segment.
async def transcription_node(
self, text: AsyncIterable[str | TimedString], model_settings: ModelSettings
) -> AsyncGenerator[str | TimedString, None]:
async for chunk in text:
if isinstance(chunk, TimedString):
print(f"Utterance: '{chunk.text}', Start Time: {chunk.start_time}")
yield chunk
This method will help you get precise timing for each transcribed utterance effortlessly.
If you have any questions or need help tailoring this to your specific needs, please don’t hesitate to reach out. I’m here to support you!
Sources: Text and transcriptions | LiveKit Docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/realtime/real...limited-planet-15554
10/14/2025, 1:38 PMtall-airline-16756
10/14/2025, 1:39 PMresponse.audio_transcript.delta events, which nicely provide timing details for each segment.
Here’s a simple way to get this up and running:
1. Handle Transcript Delta Events: You can use the _handle_response_audio_transcript_delta method to process the timing info. For example:
def _handle_response_audio_transcript_delta(self, event: dict[str, Any]) -> None:
if (start_time := event.get("start_time")) is not None:
delta = io.TimedString(event["delta"], start_time=start_time)
print(f"Utterance: '{delta.text}', Start Time: {delta.start_time}")
1. Configure the RealtimeModel: Just make sure to enable input audio transcription in your model configuration like this:
from livekit.plugins.openai.realtime import RealtimeModel
from openai.types import realtime
model = RealtimeModel(
voice="marin",
modalities=["audio", "text"],
input_audio_transcription=realtime.AudioTranscription(
model="gpt-4o-transcribe",
),
)
This setup will include timing information in the transcription events, so you'll be able to capture the start time for each utterance easily.
If anything feels unclear or you want to dive deeper, just let me know—I’m here to help!
Sources: plugins/openai/src/realtime/api_proto.ts | livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt_v2.py | Understanding Transcript Timing in Voice Conversations | Text and transcriptions | LiveKit Docs