aloof-airport-60870
08/07/2025, 11:12 AMtall-airline-16756
08/07/2025, 11:12 AMtall-airline-16756
08/07/2025, 11:12 AMprewarm
function to preload models like VAD (Voice Activity Detection). For example:
def prewarm(proc: JobProcess):
proc.userdata["vad"] = silero.VAD.load()
2. Initialize STT, LLM, and TTS with Specific Models: Use low-latency models from plugins like Groq. For instance:
agent = VoicePipelineAgent(
vad=ctx.proc.userdata["vad"],
stt=groq.STT(model="whisper-large-v3-turbo"),
llm=groq.LLM(model="llama-3.1-8b-instant"),
tts=groq.TTS(model="playai-tts", voice="Cheyenne-PlayAI"),
chat_ctx=initial_ctx,
)
3. Enable Preemptive Generation: Start generating responses before the user finishes speaking to reduce latency:
session = AgentSession(
preemptive_generation=True,
...
)
4. Use Efficient Models: Select models optimized for faster response times, such as Groq's llama-3.1-8b-instant
for LLM and playai-tts
for TTS.
5. Ensure Proper API Configuration: Provide necessary API keys and configurations to avoid delays in model loading and API calls.
These steps should help minimize the wait time for users when interacting with your application.
Sources: agent/main.py | agent/main.py | livekit-plugins/livekit-plugins-groq/README.mdaloof-airport-60870
08/07/2025, 11:15 AMtall-airline-16756
08/07/2025, 11:15 AMprewarm
function. Here’s a friendly walkthrough:
1. Initialize Models When Creating the Agent: Go ahead and create your VoicePipelineAgent
instance with all the models preloaded. Like this:
agent = VoicePipelineAgent(
vad=silero.VAD.load(),
stt=deepgram.STT(),
llm=openai.LLM(model="gpt-4o-mini"),
tts=openai.TTS(),
chat_ctx=initial_ctx,
)
2. Preload Your VAD Models: It’s a good idea to load the VAD model during your app’s startup phase:
vad_model = silero.VAD.load()
3. Start the Agent as Soon as the Room Connects: This way, your agent is all set to jump into action the moment the room is live:
await ctx.connect(auto_subscribe=AutoSubscribe.AUDIO_ONLY)
agent.start(ctx.room)
By doing this upfront, your models will be ready to roll and handle user interactions right away when that first user joins. Easy and smooth!
Sources: agent-examples/agent_examples/pipeline_agent.py | Silero VAD plugin | LiveKit Docs