API backend: word-level timestamps - #13
Merged
Merged
Conversation
For response_format='verbose_json', .via_api now sends timestamp_granularities[]=word and parses the response's words array into result$words (word/start/end), matching the native whisper backend. Works against OpenAI and a self-hosted whisper::serve(). Verified end-to-end against a whisper serve (48 words returned). Bumps to 0.2.1.3.
OpenAI treats timestamp_granularities[] values as separate; requesting word alone can suppress segments and break the verbose_json segment contract. Send both segment and word (two array-style fields) so segments are preserved and words added. Verified against the whisper serve: 2 segments + 48 words.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With
response_format = "verbose_json",.via_apinow sendstimestamp_granularities[]=wordand parses the response'swordsarray intoresult$words(word/start/end) — matching the native whisper backend, which always returns word timings. Works against OpenAI and a self-hostedwhisper::serve().This completes the word-timestamp chain so lc40's
make_srtgets per-word timing through the serve path (it previously fell back to segment-level because the API path never carried words).Additive —
result$wordsis new; existing code is unchanged. Verified end-to-end against the troy-g5:7809 serve (48 words). Version 0.2.1.2 -> 0.2.1.3.Depends on a whisper serve that honors word granularity (whisper >= 0.3.0.4, cornball-ai/whisper#15).