Skip to main content

Transcriber

Trait Transcriber 

Source
pub trait Transcriber: Send + Sync {
    // Required methods
    fn transcribe_audio<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        audio: &'life1 [u8],
        format: &'life2 str,
        language_hint: Option<&'life3 str>,
        prompt_hint: Option<&'life4 str>,
    ) -> Pin<Box<dyn Future<Output = Result<TranscriptionOutput, LlmError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait,
             Self: 'async_trait;
    fn transcription_model(&self) -> &str;
}
Expand description

Trait for audio transcription backends.

Separate from crate::Llm because the Whisper endpoint uses a different request shape (multipart upload), response shape, and error semantics.

Required Methods§

Source

fn transcribe_audio<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, audio: &'life1 [u8], format: &'life2 str, language_hint: Option<&'life3 str>, prompt_hint: Option<&'life4 str>, ) -> Pin<Box<dyn Future<Output = Result<TranscriptionOutput, LlmError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait, Self: 'async_trait,

Transcribe audio bytes to text.

§Arguments
  • audio - Raw audio file bytes (must be < 25 MB for OpenAI Whisper).
  • format - File extension without the dot: "mp3", "wav", etc.
  • language_hint - Optional ISO-639-1 language code (e.g. "en").
  • prompt_hint - Optional vocabulary/context hint for the model.
Source

fn transcription_model(&self) -> &str

Return the name of the transcription model in use.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§