24 lines
976 B
Rust
24 lines
976 B
Rust
//! The speech-to-text core of the swarm's `swarm-stt` service.
|
|
//!
|
|
//! [`Service::transcribe`] takes the bytes of a voice memo and answers its
|
|
//! text. Three things stand between the bytes and the engine:
|
|
//!
|
|
//! - a size cap, so one oversized file cannot occupy the engine;
|
|
//! - a cache keyed by the SHA-256 of the bytes, so the same memo sent to
|
|
//! several agents is transcribed once ([`cache`]); and
|
|
//! - an in-flight map, so two requests for one memo that arrive together share
|
|
//! one engine run instead of starting two.
|
|
//!
|
|
//! The audio comes from rooms with outside people, so [`sniff`] checks that a file
|
|
//! starts like an audio container before any decoder sees it.
|
|
//!
|
|
//! The engine is behind the [`Engine`] trait. [`engine::Whisper`] decodes with
|
|
//! `ffmpeg` and transcribes with `whisper-cli`; the tests use a fake.
|
|
|
|
pub mod cache;
|
|
pub mod engine;
|
|
mod service;
|
|
pub mod sniff;
|
|
|
|
pub use engine::Engine;
|
|
pub use service::{Config, Error, Reply, Service};
|