whispermlx.schema. Import them for type annotations or runtime isinstance checks.
TranscriptionResult
Returned byMLXWhisperPipeline.transcribe().
One segment per VAD chunk. Each segment covers a continuous span of speech.
The language code used for transcription (e.g.
"en", "fr"). Equal to the auto-detected language when no language was specified at load or call time.AlignedTranscriptionResult
Returned bywhispermlx.align().
Segments with word-level timestamps added. See
SingleAlignedSegment.Flat list of all word segments across every segment. Useful for iterating words without nesting.
SingleSegment
One segment of speech produced bytranscribe().
Average log probability across all tokens in this segment. More negative values indicate lower model confidence. Not always present.
SingleAlignedSegment
A segment after forced alignment — extendsSingleSegment with word and character timestamps.
Word-level timestamp entries for this segment. See
SingleWordSegment.Per-character timestamp entries. Only populated when
return_char_alignments=True is passed to align(). None otherwise. See SingleCharSegment.SingleWordSegment
A single word with alignment timestamps.SingleCharSegment
A single character with alignment timestamps. Only present whenreturn_char_alignments=True is passed to align().
ProgressCallback
Type alias for progress callbacks accepted bytranscribe(), align(), and DiarizationPipeline.
float argument in the range 0.0 to 100.0 representing the percentage of work completed. Passing None disables progress reporting.
Usage examples
Logging
whisper(ml)x uses a centralized logger under the"whispermlx" namespace. Two functions are exported from the top-level package for configuring and accessing it.
setup_logging
"whispermlx" logger. Call this once at the start of your application before any other whisper(ml)x calls.
Logging level. Accepted values:
"debug", "info", "warning", "error", "critical".Optional path to a log file. When set, log output is written to both the console and this file. When
None, logs only to stdout.get_logger
logging.Logger instance configured with the whisper(ml)x handler. Use this to emit log messages that follow the same format as internal whisper(ml)x logs.
The logger propagation is disabled to prevent duplicate messages in environments that configure the root logger. If you use a custom logging setup, call
setup_logging() after configuring the root logger.Related
MLXWhisperPipeline.transcribe
Returns TranscriptionResult.
Alignment
Returns AlignedTranscriptionResult.
Diarization
Adds speaker fields to segments and words.