pub trait TranscriptionModel: ModelInfo {
// Required methods
fn transcribe<'life0, 'async_trait>(
&'life0 self,
audios: Vec<AudioInput>,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<TranscribeResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn supported_languages(&self) -> &[String];
// Provided methods
fn transcribe_one<'life0, 'async_trait>(
&'life0 self,
audio: AudioInput,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<TranscribeResult>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
fn warmup<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
A model that transcribes speech audio into text with timing information.
Targets whisper.cpp / whisper-rs, OpenAI Whisper API, AssemblyAI, and
similar ASR engines. The primary method is batch (matching the
batch-in/batch-out convention of the other tasks); use
transcribe_one for the single-stream
convenience.
Required Methods§
Sourcefn transcribe<'life0, 'async_trait>(
&'life0 self,
audios: Vec<AudioInput>,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<TranscribeResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn transcribe<'life0, 'async_trait>(
&'life0 self,
audios: Vec<AudioInput>,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<Vec<TranscribeResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Transcribe a batch of audio inputs.
This is the canonical primitive every implementation provides. Results
are returned in the same order as audios; the shared options apply to
every input. Single-stream engines (whisper.cpp, remote APIs) loop or fan
out internally; GPU-batched backends batch natively.
§Errors
Returns an error if the provider cannot decode an input or fails internally.
Sourcefn supported_languages(&self) -> &[String]
fn supported_languages(&self) -> &[String]
ISO 639-1 language codes the model can handle. May be empty for providers that report language only at runtime via auto-detection.
Provided Methods§
Sourcefn transcribe_one<'life0, 'async_trait>(
&'life0 self,
audio: AudioInput,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<TranscribeResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn transcribe_one<'life0, 'async_trait>(
&'life0 self,
audio: AudioInput,
options: TranscribeOptions,
) -> Pin<Box<dyn Future<Output = Result<TranscribeResult>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Transcribe a single audio stream — convenience over
transcribe.
§Errors
Returns an error if transcription fails, or (a provider contract violation) if no result is returned for the single input.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".