A speech-to-text request. Layer A serializable data.
iex> req = ALLM.TranscriptionRequest.new(audio: ALLM.Audio.from_file("clip.mp3"), language: "en")
iex> ALLM.Validate.transcription_request(req)
:okFields
:audio: the clip to transcribe, anALLM.Audio.t/0.nilis constructible, andALLM.Validate.transcription_request/1is what rejects it. The validator checks the value's shape only. Whether a file exists, how large it is, and whether its type is accepted are checked by the adapter, because the limits differ per provider.:model:nilmeans late-resolved (the engine's transcription model, then the adapter's default).:language: an optional hint for the spoken language, as a string (for example"en").:prompt: optional context to guide the transcript, such as spellings of names or the previous sentence.:timestamps:trueasks for per-word start and end times on the response's:spans(seeALLM.TranscriptSpan). Defaults tofalse.:logprobs:trueasks for per-word or per-token log-probabilities on the response's:spans. Defaults tofalse.The two flags are separate because providers support them separately: some return both, some only log-probabilities. An adapter that cannot honour a flag that is
truerefuses the request with:unsupported_featurebefore sending anything. If the provider accepted the request but its response carries no span data, a blank transcript succeeds withspans: [], and any other transcript fails with:unsupported_featurewhosemetadata.causeis:absent_from_responseand whosemetadata.textholds the transcript. With both flagsfalse, the response's:spansisnil.:options: a raw provider-body passthrough for fields ALLM does not model. An adapter merges it under the fields it sets itself, so an option can never override a structural field, and fields that would change the response shape are dropped.:metadata: caller-owned. Use string keys when it will round-trip through JSON.
Construction
new/1 is a bare struct!/2 pass-through: unknown keys raise
KeyError, and nothing else is checked.
Summary
Functions
Build a %TranscriptionRequest{} from keyword opts.
Types
Functions
Build a %TranscriptionRequest{} from keyword opts.
Unknown keys raise KeyError via struct!/2. Call
ALLM.Validate.transcription_request/1 to check the field rules.
Examples
iex> req = ALLM.TranscriptionRequest.new()
iex> {req.audio, req.model, req.options}
{nil, nil, %{}}