Skip to main content

Crate ryu_stt

Crate ryu_stt 

Source
Expand description

Speech-to-text (STT) modality primitive: transcribe(audio) -> text behind a swappable engine seam.

Three engines, one dispatch (transcribe_wav_detailed):

  • parakeet (default where the voice-parakeet feature is compiled): the in-process ONNX engine — the genuinely in-process hot path, never IPC (see parakeet).
  • whisper: forwarded to a local whisper.cpp voice server’s /inference (a thin HTTP proxy).
  • gateway: the swappable cloud STT slot, routed through the Gateway’s /v1/audio/transcriptions with the per-attribute x-ryu-slot-stt-* headers (a thin HTTP proxy).

Per the Core-vs-Gateway rule the dispatch is a Core concern (it decides what runs — which local voice engine handles the audio); this crate owns the reusable transcription logic + result types, while the host couplings it cannot own — the whisper base-url, the Gateway url/bearer, and the parakeet model directory — are injected via the narrow SttHost trait. The crate has ZERO dependency on apps/core (mirrors ryu-search’s SearchEmbedder seam).

Modules§

parakeet
Parakeet v3 voice (STT) engine — ONNX-based, runs alongside whisper.cpp.

Structs§

TranscriptSegment
One timestamped transcript segment. Serialized camelCase (startMs/endMs/text) so it matches the cross-surface clip contract.
Transcription
A transcription result: the full text plus optional timestamped segments. Segments are populated whenever the engine returns them (Whisper verbose_json via the Gateway or local whisper.cpp); parakeet returns text only, so its segments is empty.

Traits§

SttHost
Narrow host seam for the STT dispatch: the couplings the crate cannot own because they read Core config/paths (the whisper sidecar base-url, the Gateway url + bearer, and the extracted parakeet model directory). Core implements this in apps/core/src/stt_host.rs.

Functions§

default_stt_engine
The cross-surface default STT engine, resolved as a swappable default (never a hardcoded literal). Parakeet v3 (in-process ONNX) is the default whenever this build compiled the voice-parakeet feature. Lean builds omit the feature and default to whisper.cpp so transcription still works there. RYU_STT_ENGINE overrides both, so one env var re-points every surface.
transcribe_wav
Transcribe raw audio bytes to text. Routes to the in-process parakeet engine (the default — see default_stt_engine) or the whisper.cpp voice server (engine == Some("whisper")).
transcribe_wav_detailed
Like transcribe_wav but also returns timestamped segments when the engine provides them (Whisper verbose_json via the Gateway or local whisper.cpp). Parakeet (the in-process default) returns text only, so its segments are empty.