is there a way to get the agent's current speech w...
# ask-ai
b
is there a way to get the agent's current speech when it got interrupted like what part of speech has been said and what was remaining, i am using azure realtime model.
t
Thanks for reaching out, Siddharth. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'm happy to guide you through retrieving the agent's interrupted speech and the remaining speech when using the Azure real-time model. Here's how you can do it: Interrupted Speech: To get the portion of speech that was played, you can use these helpful properties: • Transcript: Check out the
playback_ev.synchronized_transcript
property. • Timing: The
playback_position
property gives you the playback position in seconds. • Audio End Point: Use
audio_end_ms
to find the endpoint in milliseconds. Remaining Speech: While LiveKit doesn’t directly provide the unplayed portion of the speech, you can work around this by caching the full response before the audio starts playing. Then, by comparing the interrupted part with your cached full response, you can figure out what’s left to be played. If you'd like, I’m here to help with detailed steps or any other questions you might have—just let me know! Sources: livekit-plugins/livekit-plugins-ultravox/livekit/plugins/ultravox/realtime/... | Azure AI Services and LiveKit | LiveKit Docs
b
synchornised_transcript etc works with azure realtime api??
t
Absolutely,
synchronized_transcript
works seamlessly with the Azure real-time API in LiveKit. This wonderful feature is supported through the Azure OpenAI Realtime API integration, which automatically provides synchronized transcription. What this means is that the agent's spoken audio is perfectly aligned with its text output in real time, making things much smoother for you. Here’s how you can get started with this feature: • Make sure you’re using the Azure OpenAI Realtime API plugin in your
AgentSession
. • Set
transcription_enabled=True
and
sync_transcription=True
in `RoomOutputOptions`—these are actually enabled by default to make things easier! If you have any questions or need a hand with configuration or testing, please don’t hesitate to reach out. I’m here to help! Sources: livekit-agents/livekit/agents/inference/stt.py | Text and transcriptions | LiveKit Docs | Azure Speech TTS plugin guide | LiveKit Docs | Azure OpenAI Realtime API and LiveKit | LiveKit Docs | Azure AI Services and LiveKit | LiveKit Docs
b
Here’s how you can get started with this feature: • Make sure you’re using the Azure OpenAI Realtime API plugin in your
AgentSession
. • Set
transcription_enabled=True
and
sync_transcription=True
in
RoomOutputOptions
where to look for this RoomOutputOptions , where it is passed
t
Thanks for your question! The
RoomOutputOptions
is usually set up and passed when you're creating the agent's session or room in LiveKit. It helps define how the room behaves in terms of output, like transcription and synchronization settings. Here’s a friendly guide on where you might use it: • When you’re initializing the agent session, you can include
RoomOutputOptions
as part of the room or agent context configuration. • It’s commonly part of setting up the
AgentSession
or when you’re adding text output to the room. If you’d like, I’d be happy to share some specific code examples or explain anything in more detail—just let me know!