i'm thinking of sending audio to deepgram by passi...
# agents
a
i'm thinking of sending audio to deepgram by passing VAD and turn detector? is this okay?
i got this response from AI
Copy code
I'm glad you're exploring how to configure LiveKit to send all audio directly to Deepgram and handle chunking without needing an external VAD like Silero. You can achieve this smoothly using the deepgram.STT() plugin, which takes care of audio segmentation in 50ms chunks and streams it to Deepgram via WebSocket. This means you don't have to worry about external VAD for basic transcription—it's all handled for you!
Here's a friendly step-by-step to get you started:
Install the Plugin: Simply run pip install livekit-plugins-deepgram to add the Deepgram plugin.
Authentication: Make sure to set your Deepgram API key in the environment variable DEEPGRAM_API_KEY. This keeps things secure and ready to go.
Configure and Stream Audio: Use the deepgram.STT() plugin to stream audio directly. It smartly handles chunking and endpointing for you. Here's an example to illustrate:
import asyncio
from livekit import rtc
from livekit.plugins import deepgram

async def entrypoint(ctx):
    stt = deepgram.STT(interim_results=True, endpointing_ms=3000)
    audio_stream = rtc.AudioStream(ctx.track)
    stt_stream = stt.stream()

    asyncio.create_task(recognize_task(stt_stream))

    async for frame in audio_stream:
        stt_stream.push_frame(frame)

async def recognize_task(stt_stream):
    async for event in stt_stream:
        if event.is_final:
            print("Final Transcript:", event.alternatives[0].text)
    await stt_stream.aclose()
One of the great features here is Deepgram's built-in endpointing (like endpointing_ms=3000), which detects silence for you. This means you can simplify your setup by removing the external VAD, making your pipeline cleaner and more efficient.
If you'd like, I'm here to help you with any part of this setup or answer any questions you might have. Just let me know!
e
You should try Deepgram Flux, it can fully replace the VAD and EOT models. We've had good results with this!
Copy code
stt=deepgram.STTv2(),
        # Disable VAD and strictly rely on Flux for detecting interruptions
        # vad=silero.VAD.load(),
        turn_detection="stt",
        # Use Flux eager turn detection for quick responses
        preemptive_generation=True,
a
thanks, Dennis, could you share your full agentsession?
e
Copy code
session = AgentSession(
        stt=deepgram.STTv2(),
        llm=openai.LLM(
            model="gpt-4.1-2025-04-14",
            temperature=0,
            service_tier="priority",
        ),
        tts=deepgram.TTS(
            model="aura-2-thalia-en",
        ),
        # Disable VAD and strictly rely on Flux for detecting interruptions
        # vad=silero.VAD.load(),
        turn_detection="stt",
        # Use Flux eager turn detection for quick responses
        preemptive_generation=True,
    )
a
let me try thanks!!
@early-fall-57331 one qq, why do you use default (nova-3) instead of flux-general-en?
e
STTv2 uses Flux
a
e
@refined-appointment-81829 👋 ☝️
p
@early-fall-57331 when using the flux model the transcription delay and end of utterance delay become 0. How are you handling the transcription latency numbers on your end?
r
Thanks will let docs team know
👍 1
e
@proud-match-31207 I think it's hard to get accurate latency metrics with Flux, because it doesn't give you precise audio timestamps for when the user started/stopped speaking, and I've asked people at Deepgram about this. But for us it's been more important to have good turn taking and interruption handling.
p
Thanks Dennis for the response