```room.registerTextStreamHandler('lk.transcriptio...
# ask-ai
b
Copy code
room.registerTextStreamHandler('lk.transcription', async (reader, participantInfo) => {
  const message = await reader.readAll();
  if (reader.info.attributes['lk.transcribed_track_id']) {
    console.log(`New transcription from ${participantInfo.identity}: ${message}`);
  } else {
    console.log(`New message from ${participantInfo.identity}: ${message}`);
  }
});
とした時にmessageが読み取れるのが遅く、sttが喋り出した後に表示されてしまう
t
Thanks for reaching out, RikuKomiya. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Could you please share a bit more about how you’re implementing this? I’d love to understand better so I can help you out! Specifically: • Are you using
readAll()
,
readNext()
, or streaming with
for await
? • Is the delay happening all the time, or just in certain situations (like with large messages or network issues)? • Which LiveKit SDK and version are you working with? • Have you noticed any errors or exceptions popping up when you receive messages? Looking forward to your details so we can get this sorted together! Sources: packages/livekit-rtc/src/room.ts | livekit-android-test/src/test/java/io/livekit/android/room/datastream/RoomI... | test/core/data_stream_test.dart | packages/core/src/components/chat.ts | examples/demo/demo.ts
b
Can I fire lk.transcription when llm phage done
t
It’s definitely possible to trigger transcription events once an LLM phase wraps up in LiveKit. For example, events like input_audio_transcription_completed are sent out when the LLM generation phase finishes. These events come with a handy property, is_final=True, which tells you the transcription is fully complete. If you’d like to customize or do some post-processing on the transcriptions, the transcription_node() method in the agent logic is a great tool to use. Plus, you can listen for these transcription events right in the frontend to kick off any actions you want as soon as the transcription is done. Feel free to reach out if you’d like me to share more details or some examples to help you get started! Sources: plugins/openai/src/realtime/realtime_model.ts | Pipeline nodes and hooks | LiveKit Docs | Transcriptions | LiveKit Docs | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/stt.py