, Im currently using the openai.realtime.RealtimeM...
# ask-ai
h
, Im currently using the openai.realtime.RealtimeModel pipeline. It works great apart from the converting the input speech to text. It even responds correctly, but the transcript it generates tends to have incorrect words. For example: User audio input: "Let me think" The transcript the realtime modal generates: "Leurchink" This usually happens if the user interrupts the agent when its speaking, user speaks quickly or with an accent. I have been trying to find a fix to this but I'm really stuck on this. I want to keep using the realtime pipeline. Can someone please recommend a solution? Ideally within the pipeline. Worst case, recommend a different pipeline approach.
t
Thanks for reaching out, Ahmed. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd love to help you out! Could you share a bit more about your current setup? Specifically: • Are you using any particular configurations or customizations in the
openai.realtime.RealtimeModel
pipeline? • Which language or languages are you mainly working with in the speech-to-text process? • Are there certain accents or speech patterns that seem to be causing the most challenges? Knowing these details will really help us find the best solutions or tweaks to improve accuracy for you.
h
this is my setup: session = AgentSession( llm=openai.realtime.RealtimeModel( voice="alloy", modalities=["text", "audio"], turn_detection=TurnDetection( type="semantic_vad", eagerness="high", create_response=True, interrupt_response=True, ) ), )
t
To help improve the speech-to-text accuracy in your current setup, here are a few friendly suggestions you might find useful: 1. Reduce Eagerness: Sometimes, a high eagerness setting in
semantic_vad
can cause the transcript to break up too soon. You might want to try setting it to
medium
or
low
to capture more complete utterances. Here’s an example:
Copy code
session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        turn_detection=TurnDetection(
            type="semantic_vad",
            eagerness="medium",  # or "low"
            create_response=True,
            interrupt_response=True,
        ),
    ),
)
1. Optimize End-of-Utterance (EOU) Detection: Tweaking the
min_endpointing_delay
and
max_endpointing_delay
can help the system wait just the right amount of time before finalizing transcripts. The defaults are 0.5s and 6.0s, but feel free to adjust as needed. 2. Use High-Accuracy STT Providers: Pairing with reliable STT services like Speechmatics, and adding language hints or custom vocabulary, can really boost transcription accuracy. 3. Combine Detection Modes: For the best results, consider using
semantic_vad
together with
realtime_llm
. This combo offers great accuracy with minimal delay in turn detection. I hope these tips help reduce any inaccuracies you’re experiencing due to fast speech, accents, or interruptions. Please don’t hesitate to reach out if you’d like a hand implementing these changes—I’m here to help! Sources: OpenAI Realtime API integration guide | LiveKit Docs | Docs::Agents | Speech & Audio Processing | livekit/livekit_composite | DeepWiki | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | LiveKit Docs
h
im interested in these two: 1. Use High-Accuracy STT Providers: Pairing with reliable STT services like Speechmatics, and adding language hints or custom vocabulary, can really boost transcription accuracy. 2. Combine Detection Modes: For the best results, consider using
semantic_vad
together with
realtime_llm
. This combo offers great accuracy with minimal delay in turn detection.
t
I'm happy to guide you through how to implement the two approaches you're interested in: 1. Use High-Accuracy STT Providers: To integrate Speechmatics for improved transcription accuracy, here's an example you can follow:
Copy code
from livekit.plugins import speechmatics

stt = speechmatics.STT(
    language="en",
    operating_point="enhanced",
    enable_partials=True,
    additional_vocab=[
        {"content": "financial crisis"},
        {"content": "gnocchi", "sounds_like": ["nyohki", "nokey", "nochi"]},
        {"content": "CEO", "sounds_like": ["C.E.O."]}
    ],
    diarization="speaker",
    max_delay=0.7,
    max_delay_mode="flexible"
)

session = AgentSession(
    stt=stt,
    # Add other components like llm, tts, etc.
)
This setup uses enhanced accuracy, custom vocabulary, and speaker diarization to help improve transcription quality. It’s a great way to get more precise results. 1. Combine Detection Modes: To use
semantic_vad
alongside
realtime_llm
, you’ll want to configure your turn detection to utilize both modes. Here’s an example for you:
Copy code
session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        turn_detection=TurnDetection(
            type="semantic_vad",
            eagerness="medium",  # Adjust as needed
            create_response=True,
            interrupt_response=True,
        ),
    ),
)
This combination helps ensure accurate turn detection while keeping latency low. If you have any questions or need a hand with these configurations, please don’t hesitate to reach out—I’m here to help! Sources: Speechmatics integration guide | LiveKit Docs | livekit-plugins/livekit-plugins-speechmatics/livekit/plugins/speechmatics/_... | Docs::Agents
h
is a silero VAD better then this setup or not?
t
I'm glad you asked about Silero VAD and
semantic_vad
! They actually complement each other beautifully, and using them together can really enhance your results: • Silero VAD: This is a local, audio-based voice activity detector that picks up when speech starts and stops by detecting silence. It’s great for managing interruptions and works well with any STT provider you choose. • semantic_vad: This one works server-side and uses context to understand when a user has finished their thought. It helps reduce false interruptions and shines when paired with real-time LLMs like OpenAI's Realtime API. While Silero VAD does a solid job with basic speech detection,
semantic_vad
brings even more accuracy and quicker turn detection, especially in conversational AI scenarios. When you combine both, you get: 1. Precise turn detection thanks to
semantic_vad
. 2. Quick and smooth handling of interruptions with Silero VAD. If you'd like, I’d be happy to guide you through setting up this hybrid approach. Just let me know! Sources: Docs::Agents | Improving voice AI's turn detection with transformers | How does end-of-utterance detection work in conversations? | OpenAI Realtime API integration guide | LiveKit Docs | Turn detection and interruptions | LiveKit Docs
h
can I use speechmatics with my current realtime setup?
t
I'm happy to help you integrate Speechmatics STT with your current
openai.realtime.RealtimeModel
setup in LiveKit pipelines. While the OpenAI Realtime API does a great job handling audio directly and includes built-in turn detection, adding Speechmatics STT brings some wonderful benefits like real-time interim transcripts, speaker diarization, and the option for custom vocabulary. Here’s a friendly example configuration to get you started:
Copy code
from livekit.agents import AgentSession
from livekit.plugins import openai, speechmatics, silero

session = AgentSession(
    llm=openai.realtime.RealtimeModel(
        voice="alloy",
        turn_detection=None  # Disable OpenAI's VAD to use LiveKit's turn detector
    ),
    stt=speechmatics.STT(
        enable_partials=True  # Enable interim transcripts
    ),
    turn_detection=silero.turn_detector.MultilingualModel(),  # Text-based turn detection
    vad=silero.VAD.load(),  # For energy-based voice activity detection
)
This setup beautifully combines Speechmatics for transcription with OpenAI Realtime for conversational logic. Please feel free to reach out if you'd like any more help with the implementation — I'm here to support you every step of the way! Sources: Docs::Agents | examples/voice_agents/realtime_turn_detector.py | Docs::Agents | Speech-to-text (STT) integrations | LiveKit Docs