Skip to content

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

Draft
dnaumenko wants to merge 1 commit into
livekit:mainfrom
dnaumenko:codex/deepgram-flux-chunk-size
Draft

feat(deepgram): make Flux audio chunk duration configurable#7205
dnaumenko wants to merge 1 commit 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

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.

1 similar comment
@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.

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