Skip to main content

SttProvider

Trait SttProvider 

Source
pub trait SttProvider: Send + Sync {
    // Required methods
    fn transcribe<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        audio: &'life1 AudioFrame,
        opts: &'life2 SttOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Transcript, AudioError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn transcribe_stream<'life0, 'life1, 'async_trait>(
        &'life0 self,
        audio: Pin<Box<dyn Stream<Item = AudioFrame> + Send>>,
        opts: &'life1 SttOptions,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Transcript, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
}
Available on crate feature audio only.
Expand description

Unified trait for speech-to-text providers.

Implementors include cloud services (Whisper API, Deepgram, AssemblyAI) and local models (MLX Whisper).

Required Methods§

Source

fn transcribe<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, audio: &'life1 AudioFrame, opts: &'life2 SttOptions, ) -> Pin<Box<dyn Future<Output = Result<Transcript, AudioError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Transcribe a single audio frame (batch mode).

Source

fn transcribe_stream<'life0, 'life1, 'async_trait>( &'life0 self, audio: Pin<Box<dyn Stream<Item = AudioFrame> + Send>>, opts: &'life1 SttOptions, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Transcript, AudioError>> + Send>>, AudioError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Transcribe a stream of audio frames (streaming mode).

Implementors§