pub mod tool;
pub mod transcribe;
use std::path::PathBuf;
use thiserror::Error;
pub use tool::InboundTransformHandler;
pub use transcribe::transcribe_file;
pub type Result<T> = std::result::Result<T, SttError>;
#[non_exhaustive]
#[derive(Debug, Error)]
pub enum SttError {
#[error("io: {0}")]
Io(#[from] std::io::Error),
#[deprecated(note = "ffmpeg is no longer used; map to Decode/UnsupportedFormat")]
#[error("ffmpeg: {0}")]
Ffmpeg(String),
#[error("decode: {0}")]
Decode(String),
#[error("unsupported audio format: {0}")]
UnsupportedFormat(String),
#[error("whisper: {0}")]
Whisper(String),
#[error("model not found: {0}")]
ModelMissing(String),
#[error("decoded audio is empty")]
EmptyAudio,
#[error("whisper produced empty transcript")]
EmptyTranscript,
}
#[derive(Debug, Clone)]
pub struct TranscribeConfig {
pub model_path: PathBuf,
pub lang_hint: Option<String>,
#[deprecated(note = "ignored — the SDK decodes ogg-opus in pure Rust now")]
pub ffmpeg_path: PathBuf,
pub target_sample_rate: u32,
}
impl Default for TranscribeConfig {
#[allow(deprecated)] fn default() -> Self {
Self {
model_path: PathBuf::from("./data/whisper/ggml-tiny-q5_1.bin"),
lang_hint: None,
ffmpeg_path: PathBuf::from("ffmpeg"),
target_sample_rate: 16_000,
}
}
}