Skip to content

feat(deepgram): make Flux audio chunk duration configurable - #7205

Open
dnaumenko wants to merge 2 commits into
livekit:mainfrom
dnaumenko:codex/deepgram-flux-chunk-size
Open

dnaumenko wants to merge 2 commits into
livekit:mainfrom
dnaumenko:codex/deepgram-flux-chunk-size

Conversation

@dnaumenko

@dnaumenko dnaumenko commented Sep 10, 2026

Copy link
Copy Markdown

Applications currently have to replace or patch SpeechStreamv2._run to evaluate Flux with an outgoing audio chunk size other than the hardcoded 50 ms. This adds a constructor-only chunk_size_ms option to deepgram.STTv2, retaining 50 ms as the default.

from livekit.plugins import deepgram

stt = deepgram.STTv2(
    model="flux-general-multi",
    chunk_size_ms=80,
)

Deepgram recommends 80 ms audio chunks for Flux. The setting controls outgoing mono PCM WebSocket batching.

The constructor rejects non-positive/non-integer durations and durations that yield fewer than one sample. The existing send loop still handles partial-chunk flushing and stream closure.

Validation

  • uv run --no-sync pytest tests/test_plugin_deepgram_stt.py -q: 38 passed.
  • New fake-WebSocket tests exercise the real public stream/send loop at 8/16/48 kHz, default 50 ms and explicit 20/80 ms chunks, byte-for-byte PCM preservation, partial tails, and closure ordering. Constructor validation is also covered.
  • make fix and make check passed with UV_NO_SYNC=1: repository formatting/lint and mypy over 657 source files. The isolated environment includes the locked dev/typing groups plus optional boto3 and missing types-jsonschema/types-nanoid stubs.
  • git diff --check passed. No live-provider performance test was run against this new patch.

Related proposal: #7204. Opening as a draft for API feedback.

@CLAassistant

CLAassistant commented Sep 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@rchengLK

Copy link
Copy Markdown

@dnaumenko could you resolve the merge conflicts first please?

@dnaumenko
dnaumenko marked this pull request as ready for review September 24, 2026 10:32
@dnaumenko
dnaumenko requested a review from a team as a code owner September 24, 2026 10:32

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

3 participants