Which STT provider works better with LiveKit? I no...
# ask-ai
n
Which STT provider works better with LiveKit? I noticed openai as STT messes up a lot, it sometimes hear wrong things and also transcode english words into other languages when there's background noise or user is elderly or have some atypical accent
t
Thanks for reaching out, Nikhil. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Choosing the best STT provider for LiveKit really depends on your unique needs, like how well it handles accents, background noise, and the speech patterns of elderly users. Here are a few friendly recommendations to help you out: • Background Noise: If you’re using LiveKit Cloud, turning on LiveKit’s Background Voice Cancellation (BVC) can make a big difference in improving transcription quality, especially in noisy settings. • Accents: Providers like Cartesia (which supports 98 languages) or Deepgram (with its multilingual models) could be great options to better capture different accents. • Elderly Users: Deepgram’s phonecall or conversational AI models might work better for natural, slower speech patterns often found with elderly users. If you’d like, I’d be happy to guide you through setting up a comparative test using sample audio with different STT plugins. Just let me know if there are particular languages, accents, or conditions you want to focus on, and I’m here to help every step of the way. Sources: Live Conversations with AI using ChatGPT and WebRTC | Community & Support | livekit/livekit_composite | DeepWiki | Speech-to-text (STT) models | LiveKit Docs | Enhanced noise cancellation | LiveKit Docs | agent.py
n
can you give me sample code for deepgram?
t
I'm happy to share some sample code to help you integrate Deepgram with LiveKit! Let's walk through it together: Python Integration
Copy code
# First, install the plugin
pip install livekit-plugins-deepgram

from livekit.plugins import deepgram

# Initialize Deepgram STT
stt = deepgram.STT(
    model="nova-3",
    language="en-US",
    interim_results=True,
    punctuate=True,
)

# Use in a streaming context
stream = stt.stream()
# You can send audio frames to stream.input
# And get transcription results from stream.output
Node.js Integration
Copy code
// Start by installing the plugin
npm install @livekit/agents-plugin-deepgram

import { STT } from '@livekit/agents-plugin-deepgram';

const stt = new STT({
  apiKey: process.env.DEEPGRAM_API_KEY,
  model: 'nova-3',
  language: 'en-US',
  interimResults: true,
});

const stream = stt.stream();
// Just write audio frames to stream.input
// And you’ll receive transcription results via stream.output
Don’t forget to set your Deepgram API key in your environment like this:
Copy code
export DEEPGRAM_API_KEY=your_api_key_here
If you have any questions or would like me to provide more examples, please feel free to ask—I’m here to help! Sources: Deepgram STT plugin guide | LiveKit Docs | Deepgram TTS plugin guide | LiveKit Docs | livekit-plugins/livekit-plugins-deepgram/livekit/plugins/deepgram/stt_v2.py | plugins/deepgram/README.md
n
i want to use it for a voice agent i built
t
To get started with Deepgram STT for your voice agent in LiveKit, here’s a simple guide to help you along the way: 1. Install the Plugin:
Copy code
# Python
pip install livekit-plugins-deepgram

# Node.js
npm install @livekit/agents-plugin-deepgram
2. Set Up Authentication: First, you’ll want to grab your Deepgram API key and set it as an environment variable like this:
export DEEPGRAM_API_KEY=your_api_key_here
3. Integrate with Your Voice Agent: Here’s a friendly Python example to get you going: `from livekit.agents import AgentSession from livekit.plugins import deepgram, silero, openai, cartesia from livekit.plugins.turn_detector import MultilingualModel # Load VAD model vad = silero.VAD.load() # Create STT instance stt = deepgram.STT() # Create TTS and LLM instances tts = cartesia.TTS() llm = openai.LLM() # Initialize turn detector turn_detector = MultilingualModel() # Start agent session session = AgentSession( vad=vad, stt=stt, tts=tts, llm=llm, turn_detection=turn_detector, ) await session.start(room=your_room, agent=your_agent)`If you’re working with Node.js, the process is quite similar using the Deepgram STT plugin. 4. Customize Parameters: Feel free to tailor the Deepgram STT settings to your needs, like choosing the model, language, or key terms to listen for:
Copy code
stt = deepgram.STT(
    model="nova-3",
    language="en-US",
    punctuate=True,
    keyterms=["pizza", "reservation", "menu"],
)
If you have any questions or would like more examples, just let me know—I’m here to help! Sources: Deepgram STT | LiveKit Docs | examples/voice_agents/realtime_turn_detector.py | Deepgram STT plugin guide | LiveKit Docs | agent.py | examples/src/cartersia_tts.ts