Skip to main content

TranscriptionModel

Trait TranscriptionModel 

Source
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§

Source

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.

Source

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§

Source

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.

Source

fn warmup<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Optional warmup hook. The default is a no-op.

§Errors

Returns an error if the underlying model fails to initialize.

Implementors§