vllm_mlx.audio.stt¶
Speech-to-Text (STT) engine using mlx-audio.
View the complete module source at #L1-L160.
API details¶
Each callable below includes its exact signature, type annotations, inputs, defaults, return contract, documented exceptions, implementation source, and parsed docstring sections when the source provides them.
vllm_mlx.audio.stt
¶
Speech-to-Text (STT) engine using mlx-audio.
Supports: - Whisper (multilingual, 99+ languages) - Parakeet (English-focused, fast)
vllm_mlx.audio.stt.DEFAULT_WHISPER_MODEL
module-attribute
¶
vllm_mlx.audio.stt.DEFAULT_PARAKEET_MODEL
module-attribute
¶
vllm_mlx.audio.stt.TranscriptionResult
dataclass
¶
TranscriptionResult(text: str, language: Optional[str] = None, duration: Optional[float] = None, segments: Optional[list] = None)
vllm_mlx.audio.stt.STTEngine
¶
STTEngine(model_name: str = DEFAULT_WHISPER_MODEL)
Speech-to-Text engine supporting Whisper and Parakeet models.
Usage
engine = STTEngine("mlx-community/whisper-large-v3-mlx") engine.load() result = engine.transcribe("audio.mp3") print(result.text)
Initialize STT engine.
Parameters:
-
model_name(str, default:DEFAULT_WHISPER_MODEL) –HuggingFace model name. Supported: - mlx-community/whisper-large-v3-mlx (multilingual) - mlx-community/whisper-large-v3-turbo (fast) - mlx-community/whisper-medium-mlx - mlx-community/whisper-small-mlx - mlx-community/parakeet-tdt-0.6b-v2 (English, fastest) - mlx-community/parakeet-tdt-0.6b-v3
Source code in vllm_mlx/audio/stt.py
vllm_mlx.audio.stt.STTEngine._is_parakeet
instance-attribute
¶
vllm_mlx.audio.stt.STTEngine.load
¶
Load the STT model.
Source code in vllm_mlx/audio/stt.py
vllm_mlx.audio.stt.STTEngine.transcribe
¶
transcribe(audio_path: Union[str, Path], language: Optional[str] = None, task: str = 'transcribe') -> TranscriptionResult
Transcribe audio file to text.
Parameters:
-
audio_path(Union[str, Path]) –Path to audio file (mp3, wav, m4a, etc.)
-
language(Optional[str], default:None) –Language code (e.g., "en", "es"). Auto-detected if None.
-
task(str, default:'transcribe') –"transcribe" or "translate" (translate to English)
Returns:
-
TranscriptionResult–TranscriptionResult with text and metadata
Source code in vllm_mlx/audio/stt.py
vllm_mlx.audio.stt.transcribe_audio
¶
transcribe_audio(audio_path: Union[str, Path], model_name: str = DEFAULT_WHISPER_MODEL, language: Optional[str] = None) -> TranscriptionResult
Convenience function to transcribe audio without managing engine.
Parameters:
-
audio_path(Union[str, Path]) –Path to audio file
-
model_name(str, default:DEFAULT_WHISPER_MODEL) –Model to use
-
language(Optional[str], default:None) –Language code (optional)
Returns:
-
TranscriptionResult–TranscriptionResult
Source code in vllm_mlx/audio/stt.py
Complete contract reference¶
Expand any definition for its exact inputs, annotations, defaults, return contract, directly raised exceptions, source-grounded behavior, and immutable line link. This section includes private and nested definitions that ordinary API generators omit.
vllm_mlx.audio.stt.TranscriptionResult · class
vllm_mlx.audio.stt.TranscriptionResult(text: str, language: Optional[str] = None, duration: Optional[float] = None, segments: Optional[list] = None)
Result from audio transcription.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
text |
str |
yes |
none |
Required constructor field. |
language |
Optional[str] |
no |
None |
Optional constructor field; defaults to None. |
duration |
Optional[float] |
no |
None |
Optional constructor field; defaults to None. |
segments |
Optional[list] |
no |
None |
Optional constructor field; defaults to None. |
Returns
- Constructs:
vllm_mlx.audio.stt.TranscriptionResult
Exceptions and behavior
Class TranscriptionResult declares 0 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.audio.stt.STTEngine · class
Speech-to-Text engine supporting Whisper and Parakeet models.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model_name |
str |
no |
DEFAULT_WHISPER_MODEL |
HuggingFace model name. Supported: - mlx-community/whisper-large-v3-mlx (multilingual) - mlx-community/whisper-large-v3-turbo (fast) - mlx-community/whisper-medium-mlx - mlx-community/whisper-small-mlx - mlx-community/parakeet-tdt-0.6b-v2 (English, fastest) - mlx-community/parakeet-tdt-0.6b-v3 |
Returns
- Constructs:
vllm_mlx.audio.stt.STTEngine
Exceptions and behavior
Class STTEngine declares 4 direct member(s).
No direct raise statement appears in this definition.
vllm_mlx.audio.stt.STTEngine.__init__ · method
Initialize STT engine.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
model_name |
str |
no |
DEFAULT_WHISPER_MODEL |
HuggingFace model name. Supported: - mlx-community/whisper-large-v3-mlx (multilingual) - mlx-community/whisper-large-v3-turbo (fast) - mlx-community/whisper-medium-mlx - mlx-community/whisper-small-mlx - mlx-community/parakeet-tdt-0.6b-v2 (English, fastest) - mlx-community/parakeet-tdt-0.6b-v3 |
Returns
- Type:
not annotated
Exceptions and behavior
Method STTEngine.__init__ updates self.model_name, self.model, self._loaded, self._is_parakeet; calls model_name.lower.
No direct raise statement appears in this definition.
vllm_mlx.audio.stt.STTEngine.load · method
Load the STT model.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None - Direct return expressions:
None
Exceptions and behavior
Method STTEngine.load updates self.model, self._loaded; calls load_model, logger.info, logger.error, ImportError; can raise ImportError; returns None.
Directly raised exceptions: ImportError.
vllm_mlx.audio.stt.STTEngine.transcribe · method
vllm_mlx.audio.stt.STTEngine.transcribe(audio_path: Union[str, Path], language: Optional[str] = None, task: str = 'transcribe') -> TranscriptionResult
Transcribe audio file to text.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
audio_path |
Union[str, Path] |
yes |
none |
Path to audio file (mp3, wav, m4a, etc.) |
language |
Optional[str] |
no |
None |
Language code (e.g., "en", "es"). Auto-detected if None. |
task |
str |
no |
'transcribe' |
"transcribe" or "translate" (translate to English) |
Returns
- Type:
TranscriptionResult - Direct return expressions:
TranscriptionResult(text=text.strip() if isinstance(text, str) else str(text), language=detected_lang, duration=duratio…
Exceptions and behavior
Method STTEngine.transcribe calls self.load, str, self.model.generate, getattr; returns TranscriptionResult(text=text.strip() if isinstance(text, str) else str(text), language=detected_lang, duration=duratio….
No direct raise statement appears in this definition.
vllm_mlx.audio.stt.STTEngine.unload · method
Unload model to free memory.
Parameters
This callable has no explicit inputs.
Returns
- Type:
None
Exceptions and behavior
Method STTEngine.unload updates self.model, self._loaded; calls logger.info.
No direct raise statement appears in this definition.
vllm_mlx.audio.stt.transcribe_audio · function
vllm_mlx.audio.stt.transcribe_audio(audio_path: Union[str, Path], model_name: str = DEFAULT_WHISPER_MODEL, language: Optional[str] = None) -> TranscriptionResult
Convenience function to transcribe audio without managing engine.
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
audio_path |
Union[str, Path] |
yes |
none |
Path to audio file |
model_name |
str |
no |
DEFAULT_WHISPER_MODEL |
Model to use |
language |
Optional[str] |
no |
None |
Language code (optional) |
Returns
- Type:
TranscriptionResult - Direct return expressions:
engine.transcribe(audio_path, language=language)
Exceptions and behavior
Function transcribe_audio calls STTEngine, engine.load, engine.transcribe; returns engine.transcribe(audio_path, language=language).
No direct raise statement appears in this definition.
Complete symbol map¶
This map also includes private definitions and nested helpers. The signature column exposes every explicit input even when an internal helper has no dedicated parameter prose.
| Symbol | Kind | Signature and inputs | What it does | Source |
|---|---|---|---|---|
TranscriptionResult |
class | TranscriptionResult(text: str, language: Optional[str] = None, duration: Optional[float] = None, segments: Optional[list] = None) |
Result from audio transcription. | #L23-L29 |
STTEngine |
class | STTEngine(model_name: str = DEFAULT_WHISPER_MODEL) |
Speech-to-Text engine supporting Whisper and Parakeet models. | #L32-L139 |
STTEngine.__init__ |
method | STTEngine.__init__(model_name: str = DEFAULT_WHISPER_MODEL) -> not annotated |
Initialize STT engine. | #L43-L62 |
STTEngine.load |
method | STTEngine.load() -> None |
Load the STT model. | #L64-L79 |
STTEngine.transcribe |
method | STTEngine.transcribe(audio_path: Union[str, Path], language: Optional[str] = None, task: str = 'transcribe') -> TranscriptionResult |
Transcribe audio file to text. | #L81-L133 |
STTEngine.unload |
method | STTEngine.unload() -> None |
Unload model to free memory. | #L135-L139 |
transcribe_audio |
function | transcribe_audio(audio_path: Union[str, Path], model_name: str = DEFAULT_WHISPER_MODEL, language: Optional[str] = None) -> TranscriptionResult |
Convenience function to transcribe audio without managing engine. | #L142-L160 |