mirror of
https://github.com/bitbaum/ai-kit.git
synced 2026-12-04 05:48:21 +01:00
`transcribe({ words: true })` asks for `verbose_json` with word granularity
and returns normalised `words: [{ word, start, end }]`.
Why: Heidi measures HOW somebody spoke — speech rate, pauses between words,
length of run — and the text alone says which words, never when. The call
belongs here, not in Heidi: ai-kit owns every vendor request, and a second
hand-rolled Whisper call is the drift transcribe() was written to end.
The contract is absent-is-not-empty. `words` is omitted when timings were not
asked for or the vendor ignored the granularity ("not measured"), and is `[]`
only for a recording that was measured and contained nothing. A caller reading
absence as zero words would report a fluent speaker as silent. Missing timings
never fail the link — walking the chain would re-upload the audio to every
vendor for a nice-to-have. Impossible timings (end before start, NaN, empty
word) are dropped, not trusted.
Opt-in because dictation, the common caller, needs only the text and the
verbose body is several times larger. Proven by mutation: removing the
granularity request fails the request-shape test.
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>