hallowed-sunset-72621
08/21/2025, 11:46 AMtall-airline-16756
08/21/2025, 11:46 AMtall-airline-16756
08/21/2025, 11:48 AMtranscription_enabled=False in RoomOutputOptions.
• For JavaScript/Node.js agents, you can enable and tweak agent transcription using AgentTranscriptionOptions. This lets you adjust things like speed and tokenization to fit your needs.
Frontend Integration:
• On the frontend side, the LiveKit SDK has your back. You can listen for transcription events—like in JavaScript, just listen for RoomEvent.TranscriptionReceived to grab and work with transcription segments.
Need some code snippets or want me to dive deeper? Just give me a shout—I’m here to help!
Sources: Text and transcriptions | LiveKit Docs | AgentTranscriptionOptions | LiveKit Agents | Transcriptions | LiveKit Docs | examples/voice_agents/timed_agent_transcript.pyhallowed-sunset-72621
08/21/2025, 11:51 AMtall-airline-16756
08/21/2025, 11:52 AMRoomEvent.TranscriptionReceived events.
• Handle the transcription pieces and update the UI on the fly.
2. Example Implementation:
• Make a React component to show the transcriptions. Use a hook to keep track of the transcription data and refresh the display in real-time.
• Make sure the UI clearly shows who’s talking—agent or user—for easy reading.
• Add auto-scrolling so the newest transcription always appears at the bottom.
If you want me to share some code examples or help you out with anything else, just give me a shout!
Sources: lib/screens/agent_screen.dart | Text and transcriptions | LiveKit Docs | web/src/hooks/use-agent.tsx | src/transcriptions/TranscriptionTile.tsx | complex-agents/shopify-voice-shopper/shopify-voice-frontend/components/Tran...hallowed-sunset-72621
08/21/2025, 11:53 AMtall-airline-16756
08/21/2025, 11:54 AMuser_input_transcribed event to grab transcription data as it happens.
• Keep updating a variable to hold both the interim and final transcriptions.
2. Display Transcriptions:
• Create a handy function to show the transcription right in the console. You can use textwrap to neatly format the text and print it out in a clean layout.
• If you want, clear the console before each update so it looks tidy and fresh.
Here’s an example to get you started:
from livekit.agents import AgentSession
import os, textwrap
async def entrypoint(ctx):
session = AgentSession()
current_transcript = ""
@session.on("user_input_transcribed")
def on_transcript(transcript):
nonlocal current_transcript
if transcript.is_final:
current_transcript += " " + transcript.transcript
display_transcription(current_transcript)
await session.start(agent=MyAgent(), room=ctx.room)
def display_transcription(text):
os.system('clear')
print("=" * 50)
print("TRANSCRIPTION CONSOLE")
print("=" * 50)
print("\n".join(textwrap.wrap(text, width=80)))
print("=" * 50)
If you’d like me to walk you through anything else or want more examples, just let me know—I’m here to help!
Sources: Transcriptions | LiveKit Docs | Text and transcriptions | LiveKit Docs | complex-agents/shopify-voice-shopper/README.mdhallowed-sunset-72621
08/21/2025, 11:55 AMtall-airline-16756
08/21/2025, 11:56 AMSTTSegmentsForwarder class to catch transcription events from the agent.
• Handle both interim and final transcriptions so you get real-time updates.
2. Display Transcription:
• Print the transcription right to the console or create a custom display function if you want it to look nicer.
• You can also save the transcription to a file if you want to keep a record.
Example:
from livekit.agents import stt, transcription
from livekit.plugins.deepgram import STT
async def _forward_transcription(stt_stream: stt.SpeechStream, stt_forwarder: transcription.STTSegmentsForwarder):
async for ev in stt_stream:
stt_forwarder.update(ev)
if ev.type == stt.SpeechEventType.INTERIM_TRANSCRIPT:
print(ev.alternatives[0].text, end="")
elif ev.type == stt.SpeechEventType.FINAL_TRANSCRIPT:
print("\n")
print(" -> ", ev.alternatives[0].text)
If you have any questions or want me to walk you through more examples, just let me know—I’m here to help!
Sources: complex-agents/teleprompter/cartesia-ink.py | Transcriptions | LiveKit Docs | examples/voice_agents/timed_agent_transcript.pysparse-photographer-77518
08/21/2025, 1:46 PMtall-airline-16756
08/21/2025, 1:47 PM