The shared half of the bundled ALLM.TranscriptionAdapter implementations.
Layer B helper. Every bundled transcription adapter follows the same contract around its provider-specific request building and decoding:
- The test-injection hand-off: under
opts[:adapter_opts][:transcription_script]the call goes toALLM.Providers.FakeTranscriptionbefore any gate runs, withadapter_opts[:max_audio_bytes]set to the adapter's own cap. - Gate order: audio that cannot be resolved, then audio over the
adapter's byte cap, both before
ALLM.Keys.fetch!/2. - One HTTP attempt per call, with no retry loop.
Jason.DecodeErrorcauses are sanitised before they reach an error.- Span flags:
gate_flags/4refuses atimestamps: trueorlogprobs: truethe adapter cannot honour with:unsupported_feature,with_span_flags/2carries the supported list into the Fake hand-off,span_from/6drops every attribute the request did not ask for,decode_span_list/3walks a provider's span list, andabsent_spans/5applies the one rule for a response that carries no span data ([]on a blank transcript, else:unsupported_feature).
The functions are @doc false seams parameterised by the provider atom
(the :provider of every error built here). Where the flow needs the
adapter's own steps, the adapter module is an argument and these
callbacks are invoked on it: gate_audio/2, build_request/2,
decode_response/4, to_transcription_adapter_error/4 and
malformed_error/2. They are declared as this module's callbacks, so an
adapter that uses it declares @behaviour for this module alongside
ALLM.TranscriptionAdapter and marks each one @impl; the compiler then
reports a missing or misnamed callback.