Skip to content

fix(assemblyai): honor the language passed to STT.stream() - #8472

Open
anubhavlal07 wants to merge 1 commit into
livekit:mainfrom
anubhavlal07:fix/assemblyai-stream-language
Open

anubhavlal07 wants to merge 1 commit into
livekit:mainfrom
anubhavlal07:fix/assemblyai-stream-language

Conversation

@anubhavlal07

Copy link
Copy Markdown

STT.stream(language=...) in livekit-plugins-assemblyai accepted language but ignored it. The stream was always built from the plugin-level language_codes, so a per-stream language never reached AssemblyAI's language steering.

Fix: on the Universal-3 Pro family (_U3_PRO_MODELS, the models that accept language_codes), stream() sets that stream's language_codes from language. It goes through the existing _normalize_language_codes, so "es-ES" becomes ["es"]. The override is on the dataclasses.replace copy the stream already takes, so the provider's options and other streams are unchanged. An empty language means no override.

On other models, which reject language_codes at construction, the override is logged and skipped rather than sent, matching the constructor's restriction.

This is the same gap #8374 fixed for AWS.

Test: two cases.

  • test_stream_language_steers_that_stream_only: an override stream gets ["es"], while a default stream and an empty override keep ["en"], and the provider keeps ["en"]. This fails on main.
  • test_stream_language_ignored_without_language_steering_support: on universal-streaming-english, nothing is set.

All of tests/test_plugin_assemblyai_stt.py passes (127 tests), and ruff check and ruff format --check are clean.

This change was prepared with the help of an AI assistant (Claude), and I reviewed and tested it.

@anubhavlal07
anubhavlal07 requested a review from a team as a code owner November 9, 2026 15:50
@CLAassistant

CLAassistant commented Nov 9, 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.

Devin Review

This branch has not been deployed

No deployments
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.

2 participants