pub struct Transcriber { /* private fields */ }Expand description
Transcribes audio by POSTing it to a configured Endpoint.
Implementations§
Source§impl Transcriber
impl Transcriber
Sourcepub fn new(endpoint: Endpoint) -> Result<Self>
pub fn new(endpoint: Endpoint) -> Result<Self>
Build a transcriber for the given endpoint, defaulting to Arabic and a
DEFAULT_TIMEOUT_SECS total-request timeout.
Sourcepub fn with_timeout(endpoint: Endpoint, timeout: Duration) -> Result<Self>
pub fn with_timeout(endpoint: Endpoint, timeout: Duration) -> Result<Self>
Like new but with an explicit total-request timeout — raise it
for slow CPU inference or large files, lower it to fail faster. The timeout
spans the whole round-trip (connect + upload + inference + download).
Fails only if the HTTP client cannot be built, which in practice means the TLS
backend would not initialize. This used to fall back to Client::new() on
error, which is not a fallback at all: that constructor panics on the very same
failure, and had it succeeded it would have installed reqwest’s default 30s
timeout — silently truncating exactly the slow inference this parameter exists
to accommodate.
Sourcepub fn language(self, lang: impl Into<String>) -> Self
pub fn language(self, lang: impl Into<String>) -> Self
Override the transcription language (ISO-639-1).
Sourcepub fn transcribe(&self, audio: &Path) -> Result<Transcript>
pub fn transcribe(&self, audio: &Path) -> Result<Transcript>
Stream audio to the endpoint and return the transcript.