elegant-battery-64445
09/15/2025, 4:19 PMtall-airline-16756
09/15/2025, 4:20 PMtall-airline-16756
09/15/2025, 4:20 PMfrom livekit.plugins import openai, silero
whisper_stt = openai.STT()
vad = silero.VAD.load(min_speech_duration=0.1, min_silence_duration=0.5)
stt = agents.stt.StreamAdapter(whisper_stt, vad)
1. Make sure you pass both the STT and VAD when you initialize your agent:
agent = Agent(
stt=whisper_stt,
vad=vad,
# ... other options
)
This setup will hold onto the audio until the VAD detects the end of speech, making it easier for the STT engine to process everything smoothly. If you have any questions or want me to walk you through it, just let me know—I’m here to help!
Sources: agents/src/stt/stt.ts | Speech-to-text (STT) integrations | LiveKit Docs | Working with plugins | LiveKit Docselegant-battery-64445
09/15/2025, 4:22 PMconst vad = ctx.proc.userData.vad! as silero.VAD;
const assistant = new voice.Agent({
instructions: 'You are a helpful voice AI assistant.',
});
const session = new voice.AgentSession({
vad: await silero.VAD.load(),
stt: new openai.STT({ model: 'gpt-4o-transcribe'}),
llm: new openai.LLM({ model: 'gpt-4o-mini' }),
tts: new cartesia.TTS({
model: 'sonic-2',
voice: 'f786b574-daa5-4673-aa0c-cbe3e8534c02'
}),
turnDetection: new livekit.turnDetector.MultilingualModel(),
});
await session.start({
agent: assistant,
room: ctx.room,
inputOptions: {
// For telephony applications, use `TelephonyBackgroundVoiceCancellation` for best results
noiseCancellation: BackgroundVoiceCancellation(),
},
});
this is the codetall-airline-16756
09/15/2025, 4:22 PMvoice.AgentSession, here are a few friendly pointers:
1. First, make sure to load the Silero VAD before creating your session. Here’s a quick example:
const vad = await silero.VAD.load({
minSpeechDuration: 0.1,
minSilenceDuration: 0.5
});
1. Next, pass the loaded VAD and STT instances into your AgentSession like this:
const session = new voice.AgentSession({
vad: vad,
stt: new openai.STT({ model: 'gpt-4o-transcribe' }),
llm: new openai.LLM({ model: 'gpt-4o-mini' }),
tts: new cartesia.TTS({
model: 'sonic-2',
voice: 'f786b574-daa5-4673-aa0c-cbe3e8534c02'
}),
turnDetection: new livekit.turnDetector.MultilingualModel(),
});
1. Finally, start the session and connect it to your room like this:
await session.start({
agent: assistant,
room: ctx.room,
inputOptions: {
noiseCancellation: BackgroundVoiceCancellation(),
},
});
If you run into any bumps or have questions along the way, please don’t hesitate to reach out. I’m here to help!
Sources: plugins/silero/src/vad.ts | Silero VAD plugin | LiveKit Docs | Turn detection and interruptions | LiveKit Docs