i think im having issue with duplicate transcripti...
# ask-ai
p
i think im having issue with duplicate transcriptions. how can i check that? is there a way to print transcripts and partial transcripts? or the transcript thats sent to the llm? and what the llm responds as well?
t
Thanks for reaching out, Vaneeza. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To help you avoid duplicate transcriptions, a good approach is to filter for finalized transcriptions by using the
lk.transcription_final
flag or checking for
is_final=True
in transcription events. This way, you’ll steer clear of logging those interim updates. You can easily print transcripts and partial transcripts by listening to the
input_audio_transcription_completed
event. Here’s a simple example to guide you:
Copy code
@session.on("input_audio_transcription_completed")
async def on_transcription(event):
    if event.is_final:
        print(f"Final Transcript: {event.transcript}")
    else:
        print(f"Partial Transcript: {event.transcript}")
And if you want to capture and print LLM responses, you can use the
conversation_item_added
event or check the session’s history like this:
Copy code
@session.on("conversation_item_added")
def on_conversation_item(item):
    if item.role == "assistant":
        print(f"LLM Response: {item.content}")
Please feel free to reach out if you’d like any more help or if something isn’t quite clear. I’m here to support you! Sources: src/transcriptions/TranscriptionTile.tsx | docs/index.yaml | Text and transcriptions | LiveKit docs | livekit-plugins/livekit-plugins-google/livekit/plugins/google/realtime/real... | plugins/google/src/beta/realtime/realtime_api.ts