infrastructure tier

infrastructure-transcription

Provider-agnostic local speech-to-text (ASR): a Transcriber trait, a deterministic dev stub (zero native deps), and (feature-gated) an in-process whisper.cpp engine. Local-only by default — privileged audio never leaves the process.

Provider-agnostic local speech-to-text (ASR): a Transcriber trait, a deterministic dev stub (zero native deps), and (feature-gated) an in-process whisper.cpp engine. Local-only by default — privileged audio never leaves the process.

Tierinfrastructure
Roleport
Pathcrates/infrastructure/transcription
Edition2021
Targetsinfrastructure_transcription, whisper_smoke
Public items10 across 0 modules
Tests20

What it is for

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

The surface is deliberately small: one Transcriber trait, plain input/output types (TranscriptionInput, Transcript), and a dependency-free StubTranscriber so the full ingest → transcribe → store → index pipeline builds and tests with zero native deps. The real in-process whisper.cpp impl lands behind the whisper-rs feature (WhisperRsTranscriber) and drops in behind the same trait; a faster-whisper subprocess escape hatch is reserved behind faster-whisper but is NOT the default.

Design + rationale: ADR 0019. Like the embedding surface, the default path performs NO external network egress — privileged audio stays local, which the legal consumer mandates (sending evidence audio to an external ASR API risks privilege waiver + confidentiality breach).

use infrastructure_transcription::{AudioSource, StubTranscriber, TranscribeOptions,
Transcriber, TranscriptionInput};
# async fn demo() -> Result<(), infrastructure_transcription::TranscriptionError> {
let t = StubTranscriber::new("es");
let input = TranscriptionInput::from_bytes(b"fake audio".to_vec());
let out = t.transcribe(&input, &TranscribeOptions::default()).await?;
assert!(!out.text.is_empty());
assert_eq!(out.language, "es");
# Ok(()) }

Capabilities

AudioSource

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub enum AudioSource

Segment

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub struct Segment

TranscribeOptions

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub struct TranscribeOptions
TranscribeOptions :: fn default() -> Self

Transcriber

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub trait Transcriber

Transcript

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub struct Transcript

TranscriptionInput

infrastructure-transcription — provider-agnostic local speech-to-text (ASR).

Item
pub struct TranscriptionInput
TranscriptionInput :: fn from_path(path : impl Into <PathBuf>) -> Self
TranscriptionInput :: fn from_bytes(bytes : Vec <u8>) -> Self
TranscriptionInput :: fn with_hint(mut self, hint : impl Into <String>) -> Self

How to use it

From this crate's own rustdoc:

use infrastructure_transcription::{AudioSource, StubTranscriber, TranscribeOptions,
    Transcriber, TranscriptionInput};
# async fn demo() -> Result<(), infrastructure_transcription::TranscriptionError> {
let t = StubTranscriber::new("es");
let input = TranscriptionInput::from_bytes(b"fake audio".to_vec());
let out = t.transcribe(&input, &TranscribeOptions::default()).await?;
assert!(!out.text.is_empty());
assert_eq!(out.language, "es");
# Ok(()) }

Module structure

No public modules: the crate root is its whole surface.

Public surface

`crate root`

ItemWhat it is
pub enum AudioSourceWhere the audio bytes come from
pub struct TranscriptionInputOne transcription request: the audio plus an optional container/codec hint.
TranscriptionInput :: fn from_path(path : impl Into <PathBuf>) -> SelfBuild an input from a filesystem path.
TranscriptionInput :: fn from_bytes(bytes : Vec <u8>) -> SelfBuild an input from in-memory bytes.
TranscriptionInput :: fn with_hint(mut self, hint : impl Into <String>) -> SelfAttach a container/codec hint.
pub struct TranscribeOptionsKnobs for a transcription run
TranscribeOptions :: fn default() -> Self
pub struct SegmentA single time-coded span of transcript text.
pub struct TranscriptThe result of a transcription: the full text, detected/forced language, and (optionally) time-coded segments.
pub trait TranscriberAn audio → text transcriber

Re-exports. Exported here, defined elsewhere.

ExportDefined in
StubTranscriberdev::StubTranscriber
TranscriptionErrorerror::TranscriptionError
{WhisperRsConfig,WhisperRsTranscriber}whisper_rs::{WhisperRsConfig,WhisperRsTranscriber}
{detect_repetition_loop,RepetitionLoop}repetition::{detect_repetition_loop,RepetitionLoop}
{find_chunks,ChunkPolicy,ChunkRange}chunk::{find_chunks,ChunkPolicy,ChunkRange}

Boundary

Depends on no other workspace tier.

Shares tier infrastructure with 82 other crates: infrastructure-acquire, infrastructure-adapters-google-calendar, infrastructure-adapters-google-gmail, infrastructure-adapters-google-places, infrastructure-adapters-google-trends, infrastructure-adapters-shodan, infrastructure-adapters-yelp, infrastructure-agent, … (82 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)infrastructure
Architectural role (taxonomy)port
Locationcrates/infrastructure/transcription
Vocabulary in force (lexicon)current

Dependencies

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
async-trait^0.1noalways
hound^3yesalways
ogg^0.9yesalways
opus^0.3yesalways
serde^1derive, derivenoalways
thiserror^2noalways
tokio^1full, rtyesalways
whisper-rs^0.14yesalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
tokio^1full, macros, rt-multi-threadnoalways

Build. None.

Depended on by. 1 workspace crate.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  n_application_transcription["application-transcription"] -->|uses| SELF
  SELF["infrastructure-transcription"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

FeatureEnablesOn by default
cudawhisper-rs, whisper-rs/cudano
defaultyes
faster-whisperno
whisper-rsdep:whisper-rs, dep:ogg, dep:opus, dep:hound, dep:tokiono
flowchart LR
  n_cuda["cuda"] --> n_whisper_rs["whisper-rs"]
  n_cuda["cuda"] --> n_whisper_rs_cuda["whisper-rs/cuda"]
  n_default["default"]
  n_faster_whisper["faster-whisper"]
  n_whisper_rs["whisper-rs"] --> n_dep_whisper_rs["dep:whisper-rs"]
  n_whisper_rs["whisper-rs"] --> n_dep_ogg["dep:ogg"]
  n_whisper_rs["whisper-rs"] --> n_dep_opus["dep:opus"]
  n_whisper_rs["whisper-rs"] --> n_dep_hound["dep:hound"]
  n_whisper_rs["whisper-rs"] --> n_dep_tokio["dep:tokio"]

Targets

KindNameSource
libinfrastructure_transcription`src/lib.rs`
testwhisper_smoke`tests/whisper_smoke.rs`

Error model

No public error type was detected: no public item declares a type named *Error, and no public signature returns one.

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimeyes
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

1 workspace crate depends on this one: application-transcription.

Verification

KindCount
Unit tests19
Integration tests1
Examples0
Doctests1

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
crate root603

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc910
Public modules with a //! block00
pie showData
    title Public items with rustdoc
    "Documented" : 9
    "No rustdoc detected" : 1

Metrics

MetricValue
Rust source files6
Source lines1206
Code lines867
Public API items10
Public modules0
Tests20
Examples0
Cargo features4
Direct runtime dependencies8
Workspace reverse dependencies1
pie showData
    title Public API by kind
    "enum" : 1
    "method" : 4
    "struct" : 4
    "trait" : 1
pie showData
    title Rust source composition
    "Code" : 867
    "Blank or comment" : 339

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

All infrastructure · Manual