Skip to main content

AudioTranscriber

Trait AudioTranscriber 

Source
pub trait AudioTranscriber {
    type Error: Error + Send + Sync + 'static;

    // Required method
    fn transcribe(
        &self,
        audio: &[u8],
    ) -> impl Stream<Item = Result<String, Self::Error>> + Send;
}
Expand description

Transcribes audio to text.

§Example

use aither::AudioTranscriber;
use futures_core::Stream;

struct MyTranscriber;

impl AudioTranscriber for MyTranscriber {
    fn transcribe(&self, audio: &[u8]) -> impl Stream<Item = String> + Send {
        futures_lite::stream::iter(vec!["Hello world".to_string()])
    }
}

Required Associated Types§

Source

type Error: Error + Send + Sync + 'static

The error type returned by this transcriber.

Required Methods§

Source

fn transcribe( &self, audio: &[u8], ) -> impl Stream<Item = Result<String, Self::Error>> + Send

Transcribes audio data to text.

Returns a Stream of transcribed text chunks. Transcription can fail part-way through, so each chunk is fallible rather than silently returning a partial transcript.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§