base

Deepgram Flux STT base class shared across transports (WebSocket, SageMaker, etc.).

pipecat.services.deepgram.flux.base.language_to_deepgram_flux_language(language: Language) str | None[source]

Convert a Pipecat Language to a Deepgram Flux language code.

Only honored by the flux-general-multi model. Locale variants (e.g. Language.EN_GB) fall back to the base code.

class pipecat.services.deepgram.flux.base.FluxMessageType(*values)[source]

Bases: StrEnum

Deepgram Flux WebSocket message types.

These are the top-level message types that can be received from the Deepgram Flux WebSocket connection.

RECEIVE_CONNECTED = 'Connected'
RECEIVE_FATAL_ERROR = 'Error'
TURN_INFO = 'TurnInfo'
CONFIGURE_SUCCESS = 'ConfigureSuccess'
CONFIGURE_FAILURE = 'ConfigureFailure'
class pipecat.services.deepgram.flux.base.FluxEventType(*values)[source]

Bases: StrEnum

Deepgram Flux TurnInfo event types.

These events are contained within TurnInfo messages and indicate different stages of speech processing and turn detection.

START_OF_TURN = 'StartOfTurn'
TURN_RESUMED = 'TurnResumed'
END_OF_TURN = 'EndOfTurn'
EAGER_END_OF_TURN = 'EagerEndOfTurn'
UPDATE = 'Update'
class pipecat.services.deepgram.flux.base.DeepgramFluxSTTSettings(model: str | None | _NotGiven = <factory>, extra: dict[str, ~typing.Any]=<factory>, language: Language | str | None | _NotGiven = <factory>, eager_eot_threshold: float | None | _NotGiven = <factory>, eot_threshold: float | None | _NotGiven = <factory>, eot_timeout_ms: int | None | _NotGiven = <factory>, keyterm: list | _NotGiven = <factory>, min_confidence: float | None | _NotGiven = <factory>, language_hints: list[Language] | None | _NotGiven = <factory>)[source]

Bases: STTSettings

Settings for DeepgramFluxSTTService.

Parameters:
  • eager_eot_threshold – EagerEndOfTurn/TurnResumed threshold. Off by default. Lower values = more aggressive (faster response, more LLM calls). Higher values = more conservative (slower response, fewer LLM calls).

  • eot_threshold – End-of-turn confidence required to finish a turn (default 0.7).

  • eot_timeout_ms – Time in ms after speech to finish a turn regardless of EOT confidence (default 5000).

  • keyterm – Keyterms to boost recognition accuracy for specialized terminology.

  • min_confidence – Minimum confidence required to create a TranscriptionFrame.

  • language_hints – Languages to bias transcription toward. Only honored by the flux-general-multi model. An empty list clears any active hints; None/NOT_GIVEN means no hints (auto-detect). Can be updated mid-stream via STTUpdateSettingsFrame.

eager_eot_threshold: float | None | _NotGiven
eot_threshold: float | None | _NotGiven
eot_timeout_ms: int | None | _NotGiven
keyterm: list | _NotGiven
min_confidence: float | None | _NotGiven
language_hints: list[Language] | None | _NotGiven
class pipecat.services.deepgram.flux.base.DeepgramFluxSTTBase(*, encoding: str = 'linear16', mip_opt_out: bool | None = None, tag: list | None = None, should_interrupt: bool = True, settings: DeepgramFluxSTTSettings, **kwargs)[source]

Bases: STTService

Base class for Deepgram Flux STT services across transports.

Contains all shared Flux protocol logic (message handling, turn detection, metrics, settings). Concrete subclasses implement the transport layer by providing three abstract primitives: _transport_send_audio, _transport_send_json, and _transport_is_active.

Settings

alias of DeepgramFluxSTTSettings

__init__(*, encoding: str = 'linear16', mip_opt_out: bool | None = None, tag: list | None = None, should_interrupt: bool = True, settings: DeepgramFluxSTTSettings, **kwargs)[source]

Initialize the Deepgram Flux STT base service.

Parameters:
  • encoding – Audio encoding format. Must be “linear16”.

  • mip_opt_out – Opt out of the Deepgram Model Improvement Program.

  • tag – Tags to label requests for identification during usage reporting.

  • should_interrupt – Whether to interrupt the bot when Flux detects that the user is speaking.

  • settings – Fully resolved settings instance (built by concrete subclass).

  • **kwargs – Additional arguments passed to the parent STTService (e.g. sample_rate, reconnect_on_error).

can_generate_metrics() bool[source]

Check if this service can generate processing metrics.

Returns:

True, as Deepgram Flux service supports metrics generation.

async start(frame: StartFrame)[source]

Start the Deepgram Flux STT service.

Parameters:

frame – The start frame containing initialization parameters and metadata.

async stop(frame: EndFrame)[source]

Stop the Deepgram Flux STT service.

Parameters:

frame – The end frame.

async cancel(frame: CancelFrame)[source]

Cancel the Deepgram Flux STT service.

Parameters:

frame – The cancel frame.

async start_metrics()[source]

Start TTFB and processing metrics collection.