Skip to content

fix(transcription): omit unset ElevenLabs language - #1429

Open
bhavya70020 wants to merge 1 commit into
fossasia:devfrom
bhavya70020:fix/1415-elevenlabs-language-detection
Open

bhavya70020 wants to merge 1 commit into
fossasia:devfrom
bhavya70020:fix/1415-elevenlabs-language-detection

Conversation

@bhavya70020

@bhavya70020 bhavya70020 commented Nov 30, 2026 •

Copy link
Copy Markdown

Description

Fixes an issue where ElevenLabs receives an empty language_code query parameter when no transcription language is selected, preventing automatic language detection.

This change ensures the parameter is omitted when the language is unset.

Related Issue

Closes #1415

Changes Made

  • Extracted ElevenLabs realtime WebSocket URL construction into a build_realtime_url() helper.
  • Omitted language_code when its value is None, empty, or "floor".
  • Preserved explicitly provided language codes.
  • Added unit tests and run_stream() integration-level tests covering automatic detection and explicit language selection.

Testing

  • Tested locally
  • Existing tests pass
  • Added/updated tests (if applicable)

Test results:

  • 58 tests passed across test_transcription_providers.py and test_demo_stream_finalization.py.
  • Ruff lint checks passed.
  • Ruff formatting checks passed.
  • git diff --check passed.

Screenshots (if applicable)

Not applicable. This is a backend change.

Checklist

  • My code follows the project's coding standards
  • I have tested my changes
  • I have updated documentation where necessary
  • My changes do not introduce new warnings or errors

Additional Notes

PR #1413 also modifies the ElevenLabs realtime URL builder. This PR addresses the separate automatic language detection issue and may require coordination when both changes are integrated.

Created with Gemini 4 Hydrogen in Antigravity.

Summary by Sourcery

Allow ElevenLabs to detect the transcription language automatically when no language is selected.

Bug Fixes:

  • Omit the ElevenLabs language_code parameter when the transcription language is unset, empty, or floor, allowing automatic language detection.

Tests:

  • Add URL-construction and stream-level tests for omitted and explicitly provided language codes.

Summary by CodeRabbit

  • Bug Fixes
    • Improved reliability when connecting to ElevenLabs realtime transcription by correctly encoding connection settings in the request URL.
    • Unsupported or unset language values are no longer sent as language settings, while explicitly selected languages are preserved.

@sourcery-ai

sourcery-ai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

Implementation

Build the ElevenLabs realtime URL with the language parameter omitted for unset values while preserving explicit language codes.

  • portal/transcription/providers/elevenlabs.py L6, L23-37, L104

Tests

Test URL construction and verify run_stream passes the expected language query parameter for automatic detection and explicit language selection.

  • tests/test_transcription_providers.py L4-14, L714-801

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The ElevenLabs provider now URL-encodes realtime query parameters and omits language_code when it is unset, empty, or floor. Tests cover URL construction and the URL used by streaming.

Changes: ElevenLabs realtime URL handling

Layer / File(s) Summary
Build and verify realtime URLs
portal/transcription/providers/elevenlabs.py, tests/test_transcription_providers.py
The new builder encodes the model and fixed realtime parameters. It includes language_code only when the value is truthy and not floor. Tests cover omitted and explicit language values.
Use the builder in streaming
portal/transcription/providers/elevenlabs.py, tests/test_transcription_providers.py
run_stream uses the builder for its connection URL. A streaming test checks the captured URL and required query parameters.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested labels: ai-assisted

Suggested reviewers: arnavballincode, nirupon123

Merge Risk: Minimal · up to ee392

Caption sessions with no spoken language selected should now start, because the empty language parameter is no longer sent. Explicit language codes behave as before. No merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title "fix(transcription): omit unset ElevenLabs language" matches the main change. The PR stops sending language_code to the ElevenLabs realtime WebSocket URL when the language is None, empty, or…
Linked Issues check Passed [#1415] requires that the ElevenLabs realtime URL omit language_code when no spoken language is set. At the reviewed head, build_realtime_url() in portal/transcription/providers/elevenlabs.py ap…
Out of Scope Changes check Passed The whole-PR diff against the merge base touches portal/transcription/providers/elevenlabs.py and tests/test_transcription_providers.py. The provider change is the fix for [#1415]. It also moves t…
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Full details: Title check

Explanation

The title "fix(transcription): omit unset ElevenLabs language" matches the main change. The PR stops sending language_code to the ElevenLabs realtime WebSocket URL when the language is None, empty, or "floor", and keeps explicit language codes. The title names the component (transcription), the provider (ElevenLabs), and the behavior change. It follows a conventional-commit style and stays short.

Full details: Linked Issues check

Explanation

[#1415] requires that the ElevenLabs realtime URL omit language_code when no spoken language is set. At the reviewed head, build_realtime_url() in portal/transcription/providers/elevenlabs.py appends language_code only when the value is truthy and not "floor". run_stream() now calls this helper (line 104 replaces the f-string that emitted language_code=). An empty or None language therefore produces no language_code parameter. Explicit codes such as en are still sent. The PR also adds unit and run_stream() tests for both cases, as described in the PR description. I did not run the tests. The result rests on the source diff and the PR description.

Full details: Out of Scope Changes check

Explanation

The whole-PR diff against the merge base touches portal/transcription/providers/elevenlabs.py and tests/test_transcription_providers.py. The provider change is the fix for [#1415]. It also moves the URL into build_realtime_url() and sets REALTIME_URL, as the issue and PR description request. The urlencode use produces the same query parameters as before. The added tests cover the same behavior. No unrelated functional change was found in the reviewed diff. The PR description notes a possible merge conflict with #1413, which is a coordination concern and not a scope issue.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eb874758-5ebe-4590-9f7c-c4d848831031
Commits

Reviewing files that changed from the base of the PR and between fb83f2e and ee39256.

Files selected for processing: 2

  • portal/transcription/providers/elevenlabs.py
  • tests/test_transcription_providers.py

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

@sourcery-ai

sourcery-ai Bot commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Linked issues

Checked at commit ee39256

#1415 ElevenLabs room captions never start when the room's spoken language isn't set · 1 of 1 met

# Requirement Status Notes
1 When no transcription language is set, omit language_code from the ElevenLabs realtime URL so it can auto-detect the language. ✅ Met build_realtime_url() omits the parameter for None, empty string, and the floor sentinel; tests check both URL construction and the URL passed by run_stream(). The helper still includes explicitly provided language codes.

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Approved.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@github-actions github-actions Bot added new-contributor ai-assisted PR created or assisted with an AI coding agent labels Nov 30, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi @bhavya70020, thanks for your contribution!

Before we can review this PR, please add a short screencast video showing the change working (before/after where relevant).

If no video is added within 72 hours, this PR will be closed automatically. You are welcome to reopen it or submit a new PR once you have the screencast.

@bhavya70020

Copy link
Copy Markdown
Author

Hi! I've added the requested screencast demonstrating the ElevenLabs language detection fix, including the URL behavior for unset and explicitly selected languages, along with the passing test results.

Thank you for reviewing my contribution!

voxbento.mp4

@github-actions

Copy link
Copy Markdown
Contributor

Thank you @bhavya70020 for adding a screencast! The needs-screencast label has been removed and this PR is ready for maintainer 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

ai-assisted PR created or assisted with an AI coding agent new-contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ElevenLabs room captions never start when the room's spoken language isn't set

1 participant