smart-turn-livekit
Run Smart Turn end-of-turn models on LiveKit Agents. Given the last 8 seconds of a speaker's audio, the model predicts whether they have finished talking — from prosody, without waiting for STT.
pip install 'smart-turn-livekit[livekit]'
from livekit.agents import AgentSession
from livekit.plugins import silero
from smart_turn_livekit import SmartTurnDetector
session = AgentSession(
vad=silero.VAD.load(min_silence_duration=0.25), # must be >= 0.25
turn_handling={
"turn_detection": SmartTurnDetector(model="smart-turn-tamil-tiny"),
"endpointing": {"min_delay": 0.3, "max_delay": 2.5},
},
)
Weights download from HuggingFace on first use and are cached. Nothing to configure, nothing bundled in the wheel.
Models
SmartTurnDetector() # smart-turn-tamil-tiny
SmartTurnDetector(model="smart-turn-tamil-base")
SmartTurnDetector(model="smart-turn-v3")
| key | languages | size | accuracy | on |
|---|---|---|---|---|
smart-turn-tamil-tiny |
ta | 8.7 MB | 83.71% | 4,168 real Tamil telephone clips |
smart-turn-tamil-base |
ta | 21 MB | 86.13% | same |
smart-turn-v3 |
23 | 8.7 MB | 92.63% | upstream's benchmark, mostly TTS audio |
Note: Accuracies are not directly comparable as they use different data sources and test sets.
Every Smart Turn checkpoint shares one ONNX signature — input_features (batch, 80, 800) in, a logits output that is already a sigmoid out —
which is why one code path runs all of them.
Tamil
End-of-turn detection for Tamil, expanding the languages supported by Smart Turn. These two models are fine-tuned specifically for Tamil from real Tamil telephone conversations.
| accuracy | ROC-AUC | FP/N | p50 | |
|---|---|---|---|---|
smart-turn-v3 zero-shot |
70.30% | 0.751 | – | – |
smart-turn-tamil-tiny |
83.71% | 0.905 | 7.94% | 83 ms |
smart-turn-tamil-base |
86.13% | 0.921 | 9.17% | 143 ms |
tiny is the same architecture as v3, so it is a true drop-in. FP/N is Smart
Turn's convention (FP/N + FN/N = error rate), not FP/(FP+TN) — they differ by
~3×. Latency is 1 thread, batch 1, idle i5-12450H, inference only.
Replayed through the real Silero VAD and this adapter, the model gives the identical verdict on 90.9% of boundaries and costs 2.6 accuracy points against scoring the pre-cut clips.
Method and ablations: https://github.com/santhosh-005/tamil-eot
Two things that break it
min_silence_duration >= 0.25. LiveKit will not request a prediction belowMIN_SILENCE_DURATION_MS + 50ms and raises at session start if the VAD is faster. A floor, not a ceiling — it fails loudly.- The language must be one the model claims, or unknown.
supports_language()returnsFalseotherwise, using the languages the model was benchmarked on. This one fails silently — the detector is skipped and the agent falls back to fixed timing.
Under LiveKit the threshold picks how long to wait — below it the session
takes max_delay instead of min_delay — so a false complete costs a shorter
pause, not an interruption.
Threshold
0.5 is what every number above is quoted at. The Tamil models also ship two
tuned operating points, both picked on a held-out dev split:
| operating point | tiny | base | effect |
|---|---|---|---|
inherited (default) |
0.50 | 0.50 | tables above |
polite |
0.75 | 0.92 | FP/N roughly halves, costs ~3 points |
balanced |
0.34 | 0.24 | maximises dev accuracy |
SmartTurnDetector(operating_point="polite")
SmartTurnDetector(threshold=0.72)
Tuning for accuracy did not transfer: base's dev-argmax scores 85.10% on test
against 86.23% at plain 0.5. That is why 0.5 is the default. smart-turn-v3
offers only inherited — there is no dev split of its data to pick one on.
Other uses
from smart_turn_livekit import SmartTurn
st = SmartTurn("smart-turn-tamil-tiny")
st.probability(wave_16k) # P(speaker has finished), 0.0 .. 1.0
st.is_complete(wave_16k) # bool, against st.threshold
16 kHz mono float, last 8 seconds only. Other rates need soxr.
Pipecat needs no adapter — its built-in analyzer takes any Smart Turn ONNX:
from smart_turn_livekit import resolve_model
from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
analyzer = LocalSmartTurnAnalyzerV3(
smart_turn_model_path=str(resolve_model("smart-turn-tamil-tiny")), # the file
)
Pipecat hardcodes the 0.5 threshold, and there the decision ends the turn.
Pinned or air-gapped:
SmartTurnDetector(model_path="/opt/models/smart-turn-tamil.onnx")
SmartTurnDetector(local_only=True) # cached weights only
or SMART_TURN_MODEL=/path/to.onnx, or HF_HUB_OFFLINE=1. An explicit
model_path claims no language until you pass languages=(...).
Tests
pip install -e '.[dev,livekit]'
pytest # 22 tests
python -m smart_turn_livekit.bench
Checks features against Pipecat's own extractor (<1e-3), the LiveKit Protocols
by isinstance, and that every registered model loads and returns a
probability — including upstream's, which we do not control.
Limitations
- The Tamil models are narrowband telephony. Wideband or close-mic speech is out of distribution.
- Not a VAD. It answers "did they finish?", not "is anyone talking?" You still need Silero upstream.
- Audio-only, no language token. Nothing stops any of these models running
on any language —
supports_language()reflects what was measured. - Run-to-run spread at identical config is ~0.9 points; treat smaller differences as noise.
Author
Built and maintained by Santhosh (@santhosh-005).
Licence
This package is BSD-2-Clause. It bundles Whisper's mel filterbank (MIT, OpenAI); nothing else in it is third-party.
The weights are downloaded, not distributed here, and licensed separately —
smart-turn-v3 is BSD-2-Clause by Daily; the Tamil models are BSD-2-Clause,
trained on data derived from SPRING_INX Tamil R1 (CC BY 4.0), SPRING Lab, IIT
Madras.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_turn_livekit-0.1.0.tar.gz.
File metadata
- Download URL: smart_turn_livekit-0.1.0.tar.gz
- Upload date:
- Size: 26.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68dff15cb35b1953e47682f55b82ea61efe1b47207285b65df51bbb63df7b4ef
|
|
| MD5 |
3e158141b5007a4d626ae77fec381f35
|
|
| BLAKE2b-256 |
0d3c1f9598d1a97460fb989076f31d4452d326de2bf88a9323de033ca01b8b87
|
File details
Details for the file smart_turn_livekit-0.1.0-py3-none-any.whl.
File metadata
- Download URL: smart_turn_livekit-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.14.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3d907732fb80f6c08a4ff6add4a59700bd67867e1c36b7e2b271885fbc37c5c
|
|
| MD5 |
ba8fc71c498c18e21a560d2e114faff3
|
|
| BLAKE2b-256 |
57424d1e9bf4e2bc3621a7b014ee354609c4575f897930809c4693b88b540ec0
|