crooked-dawn-90821
11/01/2025, 10:07 AMtall-airline-16756
11/01/2025, 10:07 AMtall-airline-16756
11/01/2025, 10:08 AMcrooked-dawn-90821
11/01/2025, 10:09 AMtall-airline-16756
11/01/2025, 10:09 AMfrom livekit.agents.voice import Agent
from livekit.plugins import speechmatics
class DiarizationAgent(Agent):
def __init__(self):
super().__init__(
instructions="""
You are a helpful assistant communicating through voice. Transcripts will come in with speaker IDs.
Just have a natural conversation with the user. You can also help set names for different speakers.
""",
stt=speechmatics.STT(
transcription_config=speechmatics.types.TranscriptionConfig(
operating_point="enhanced",
enable_partials=True,
language="en",
diarization="speaker",
),
audio_settings=speechmatics.types.AudioSettings(
encoding="pcm_s16le",
sample_rate=16000,
)
)
)
async def on_enter(self):
await self.session.say("Hi there! Is there anything I can help you with?")
This example shows how to set up the Speechmatics STT model with diarization in a LiveKit voice agent. By using the diarization="speaker" setting, it can detect and label different speakers during a conversation, making interactions clearer and more natural.
If you'd like, I’m here to walk you through any part of this or help you implement it in your project. Just let me know how I can assist!
Sources: docs/index.yaml | livekit-plugins/livekit-plugins-speechmatics/README.mdcrooked-dawn-90821
11/01/2025, 10:11 AMtall-airline-16756
11/01/2025, 10:12 AMcrooked-dawn-90821
11/01/2025, 12:23 PMtall-airline-16756
11/01/2025, 12:24 PMTranscriptionConfig and AudioSettings are now deprecated in LiveKit's Speechmatics STT integration. Instead, it's best to use individual parameters directly in the STT constructor, like these:
• operating_point
• language
• enable_partials
• enable_diarization
• sample_rate
• audio_encoding
These older configurations still work for now to keep things running smoothly, but moving to the new method will really help keep your setup up-to-date and ready for the future. If you'd like, I’m here to help you update your code—just let me know!
Sources: livekit-plugins/livekit-plugins-speechmatics/livekit/plugins/speechmatics/s...