fresh-telephone-307
12/02/2025, 10:17 PMtall-airline-16756
12/02/2025, 10:17 PMtall-airline-16756
12/02/2025, 10:17 PMashley, james)
◦ elevenlabs/eleven_turbo_v2_5
◦ rime family (e.g., rime/arcana, rime/mistv2)
◦ Choose voices with streaming chunk output and minimal TTFB.
Architecture & pipeline best practices
• Use LiveKit Inference (edge co-location) so STT, LLM, TTS and your agent run in same region to remove inter-region RTT.
• Fully stream the pipeline:
◦ STT: send small frames (e.g., 20 ms) and emit partial transcripts immediately.
◦ LLM: stream tokens as generated; start downstream processing on first tokens.
◦ TTS: synthesize audio incrementally from partial tokens/phrases rather than waiting for full reply.
• Turn-taking & VAD:
◦ Use aggressive VAD/short end-of-utterance detection to avoid long silence waits.
◦ Start LLM generation on short end-of-utterance triggers or on partial transcripts when possible.
• SIP/codec tuning:
◦ Keep G.711 passthrough (no extra transcoding) and locate SIP trunking edge near agent.
◦ Minimize jitter buffer sizes consistent with voice quality constraints.
• Model/use-case tuning:
◦ Use smaller, low-latency LLM variants for routine conversational responses; fall back to larger models only when needed.
◦ Keep prompts short and structured to reduce LLM generation time.
• Observability and routing:
◦ Measure STT transcription_delay, LLM ttft, TTS ttfb per session.
◦ Route to faster models or provision capacity during high load.
• Optional performance improvements:
◦ Host lightweight STT/LLM/TTS models locally (self-host) if you can run them on nearby inference hardware to shave network hops.
◦ Use real‑time inference APIs (OpenAI Realtime or similar) if they reduce handshake/queue latency.
Concrete implementation notes
• Start streaming TTS as soon as first LLM tokens arrive (don’t wait for full completion).
• Use incremental TTS chunking sized for SIP-friendly packets to keep mouth-to-ear latency low.
• Prefer model providers via LiveKit Inference to avoid public API queueing and get provisioned capacity.
If you’d like, I can:
• Propose a concrete streaming flow diagram and pseudocode for STT→LLM→TTS with VAD triggers.
• Recommend specific VAD settings, buffer sizes, and chunk sizes for SIP/G.711 to target 500 ms.
Which follow-up would you prefer? (flow pseudocode / VAD & buffer settings / example model config)
Sources: Introducing LiveKit Inference: A unified model interface for voice AI | Speech-to-text (STT) models | LiveKit Docs | Large language models (LLM) | LiveKit Docs | OpenAI LLM models | LiveKit Docs | Text-to-speech (TTS) models | LiveKit Docs