Skip to content

fix(voice): retain concrete language for turn detection - #6531

Merged
chenghao-mou merged 1 commit into
livekit:mainfrom
Oxygen56:fix/turn-detector-ignore-multi-language
Jul 28, 2026
Merged

fix(voice): retain concrete language for turn detection#6531
chenghao-mou merged 1 commit into
livekit:mainfrom
Oxygen56:fix/turn-detector-ignore-multi-language

Conversation

@Oxygen56

Copy link
Copy Markdown
Contributor

Fixes #6530

Summary

  • keep multi and auto language-detection modes from replacing the last concrete language
  • share the same language-tracking logic across final and preflight transcripts
  • add regression coverage for ambiguous multilingual results and later concrete-language updates

Root Cause

AudioRecognition stored every initial STT language value in _last_language. When a multilingual STT provider returned the mode value multi for an ambiguous utterance, the turn detector treated it as a concrete language code, could not find a matching threshold, and skipped end-of-turn prediction.

The STT event still retains the provider's original language value. Only the language tracked for language-specific turn-detection behavior ignores non-specific detection modes.

Verification

  • uv run --no-sync pytest tests/test_audio_recognition_turn_detection.py::TestLanguageTracking --audio_eot -q -> 3 passed
  • uv run --no-sync ruff check livekit-agents/livekit/agents/voice/audio_recognition.py tests/test_audio_recognition_turn_detection.py -> passed
  • uv run --no-sync ruff format --check livekit-agents/livekit/agents/voice/audio_recognition.py tests/test_audio_recognition_turn_detection.py -> passed
  • uv run --group typing mypy -p livekit.agents -> passed (205 source files)
  • uv run --no-sync pytest --unit -q -> 1142 passed, 4 skipped before the repository's concurrent-test runner stopped with 9 event-loop errors on Python 3.13

Notes for Reviewers

  • If no concrete language has been detected yet, multi leaves the tracked language unset and the existing endpointing fallback remains unchanged.
  • No public API or STT event payload is changed.

@Oxygen56
Oxygen56 requested a review from a team as a code owner July 23, 2026 21:42
@CLAassistant

CLAassistant commented Jul 23, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@longcw

longcw commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

could you sign the CLA before we merge?

@chenghao-mou
chenghao-mou merged commit d6aa46d into livekit:main Jul 28, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MutlilingualModel Turn Detector model does not support "multi" language code

4 participants