stt
Fal speech-to-text service implementation.
This module provides integration with Fal’s Wizper API for speech-to-text transcription using segmented audio processing.
- pipecat.services.fal.stt.language_to_fal_language(language: Language) str[source]
Convert a Language enum to Fal’s Wizper language code.
- Parameters:
language – The Language enum value to convert.
- Returns:
The corresponding service language code. If
languageis not in the verified mapping, falls back to the base language code (e.g.,enfromen-US) and logs a warning (viaresolve_language(..., use_base_code=True)).
- class pipecat.services.fal.stt.FalSTTSettings(model: str | None | NotGiven = <factory>, extra: dict[str, Any]=<factory>, language: Language | str | None | NotGiven = <factory>)[source]
Bases:
STTSettingsSettings for FalSTTService.
- class pipecat.services.fal.stt.FalSTTService(*, api_key: str | None = None, aiohttp_session: ClientSession | None = None, task: str = 'transcribe', chunk_level: str = 'segment', version: str = '3', sample_rate: int | None = None, params: InputParams | None = None, settings: FalSTTSettings | None = None, ttfs_p99_latency: float | None = 2.07, **kwargs)[source]
Bases:
SegmentedSTTServiceSpeech-to-text service using Fal’s Wizper API.
This service uses Fal’s Wizper API to perform speech-to-text transcription on audio segments. It inherits from SegmentedSTTService to handle audio buffering and speech detection.
- Settings
alias of
FalSTTSettings
- class InputParams(*, language: Language | None = Language.EN, task: str = 'transcribe', chunk_level: str = 'segment', version: str = '3')[source]
Bases:
BaseModelConfiguration parameters for Fal’s Wizper API.
Deprecated since version 0.0.105: Use
settings=FalSTTService.Settings(...)instead. Will be removed in 2.0.0.- Parameters:
language – Language of the audio input. Defaults to English.
task – Task to perform (‘transcribe’ or ‘translate’). Defaults to ‘transcribe’.
chunk_level – Level of chunking (‘segment’). Defaults to ‘segment’.
version – Version of Wizper model to use. Defaults to ‘3’.
- __init__(*, api_key: str | None = None, aiohttp_session: ClientSession | None = None, task: str = 'transcribe', chunk_level: str = 'segment', version: str = '3', sample_rate: int | None = None, params: InputParams | None = None, settings: FalSTTSettings | None = None, ttfs_p99_latency: float | None = 2.07, **kwargs)[source]
Initialize the FalSTTService with API key and parameters.
- Parameters:
api_key – Fal API key. If not provided, will check FAL_KEY environment variable.
aiohttp_session – Optional aiohttp ClientSession for HTTP requests. If not provided, a session will be created and managed internally.
task – Task to perform (
"transcribe"or"translate"). Defaults to"transcribe".chunk_level – Level of chunking (
"segment"). Defaults to"segment".version – Version of Wizper model to use. Defaults to
"3".sample_rate – Audio sample rate in Hz. If not provided, uses the pipeline’s rate.
params –
Configuration parameters for the Wizper API.
Deprecated since version 0.0.105: Use
settings=FalSTTService.Settings(...)for model/language and direct init parameters for task/chunk_level/version instead. Will be removed in 2.0.0.settings – Runtime-updatable settings. When provided alongside deprecated parameters,
settingsvalues take precedence.ttfs_p99_latency – P99 latency from speech end to final transcript in seconds. Override for your deployment. See https://github.com/pipecat-ai/stt-benchmark
**kwargs – Additional arguments passed to SegmentedSTTService.
- can_generate_metrics() bool[source]
Check if the service can generate processing metrics.
- Returns:
True, as Fal STT service supports metrics generation.
- language_to_service_language(language: Language) str | None[source]
Convert a Language enum to Fal’s service-specific language code.
- Parameters:
language – The language to convert.
- Returns:
The Fal-specific language code, or None if not supported.
- async run_stt(audio: bytes) AsyncGenerator[Frame, None][source]
Transcribes an audio segment using Fal’s Wizper API.
- Parameters:
audio – Raw audio bytes in WAV format (already converted by base class).
- Yields:
Frame – TranscriptionFrame containing the transcribed text, or ErrorFrame on failure.
Note
The audio is already in WAV format from the SegmentedSTTService. Only non-empty transcriptions are yielded.
- async push_frame(frame: Frame, direction: FrameDirection = FrameDirection.DOWNSTREAM)
Push a frame, marking a TranscriptionFrame finalized when its segment is the latest.
Once the user speaks again, the transcript of an earlier segment covers only the words before they resumed, so it isn’t finalized, the same way
STTServicedrops a pending finalize when the user starts speaking. When a segment’s transcript arrives as several diarized TranscriptionFrames (one per speaker run), only the last one can be.- Parameters:
frame – The frame to push.
direction – The direction of frame flow in the pipeline.