Skip to content

fix(elevenlabs): don't persist the per-call language passed to recognize() - #7822

Closed
Atharvsinh-codez wants to merge 1 commit into
livekit:mainfrom
Atharvsinh-codez:fix/elevenlabs-stt-recognize-language
Closed

Atharvsinh-codez wants to merge 1 commit into
livekit:mainfrom
Atharvsinh-codez:fix/elevenlabs-stt-recognize-language

Conversation

@Atharvsinh-codez

Copy link
Copy Markdown

Summary

elevenlabs.STT._recognize_impl wrote a per-call language to self._opts.language_code. One recognize(buffer, language="fr") therefore changed three things:

  • every later batch request without a language also sent fr
  • new stream() calls started in fr, because that is their default
  • transcripts with no language_code in the response were tagged with the last override

This is reachable without calling recognize() directly, because StreamAdapter passes its stream's language on every call. A batch Scribe STT wrapped for a session stays on the last language it was asked for.

The override now applies only to the request it was passed with. #6097 made the same fix for Clova, and #7820 makes it for OpenAI.

Test plan

  • added test_recognize_language_override_applies_to_one_call. It uses the existing TestServer setup and checks the language_code form field of two consecutive requests. It fails on main (['fr', 'fr']) and passes with this change (['fr', 'en']).
  • uv run pytest tests/test_plugin_elevenlabs_stt.py --plugin elevenlabs: 109 passed.
  • ruff check, ruff format, and mypy (livekit.plugins.elevenlabs) are clean.

…ize()

STT._recognize_impl wrote a `language` override to self._opts.language_code,
so one recognize(language="fr") changed the language of every later batch
request, the default language of new streams, and the fallback language
reported on transcripts. StreamAdapter passes its stream's language on every
call, so a wrapped batch STT stayed on the last language it was asked for.

Use the override for that request only.
@Atharvsinh-codez
Atharvsinh-codez requested a review from a team as a code owner October 14, 2026 15:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T15:22:40.411789Z 20d427d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@CLAassistant

CLAassistant commented Oct 14, 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

@Atharvsinh-codez

Copy link
Copy Markdown
Author

Folded into #7828 together with the other two STT fixes and a fix for the flaky unit-tests failure. Closing this one.

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