Using the whisper initial_prompt field for custom words#1035
Merged
cjpais merged 1 commit intocjpais:mainfrom Mar 14, 2026
Merged
Using the whisper initial_prompt field for custom words#1035cjpais merged 1 commit intocjpais:mainfrom
initial_prompt field for custom words#1035cjpais merged 1 commit intocjpais:mainfrom
Conversation
…rection Whisper supports an `initial_prompt` parameter that biases the model's vocabulary during transcription. For Whisper models, we now join the user's custom words list into a comma-separated string and pass it as the initial_prompt. This guides the model to prefer those spellings during decoding rather than relying solely on fuzzy post-correction. For non-Whisper engines (Parakeet, Moonshine, SenseVoice, GigaAM), the existing apply_custom_words post-correction continues to apply since those engines don't support prompt-based vocabulary biasing. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Owner
|
This looks good to me. Thank you. Approved and merged. |
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.
Whisper supports an
initial_promptparameter that biases the model's vocabulary during transcription. For Whisper models, we now join the user's custom words list into a comma-separated string and pass it as the initial_prompt. This guides the model to prefer those spellings during decoding rather than relying solely on fuzzy post-correction.For non-Whisper engines (Parakeet, Moonshine, SenseVoice, GigaAM), the existing apply_custom_words post-correction continues to apply since those engines don't support prompt-based vocabulary biasing.
Before Submitting This PR
Please confirm you have done the following:
If this is a feature or change that was previously closed/rejected:
Human Written Description
From the discussion:
I've encountered an issue with custom vocabulary/custom words in Handy. The current bigram replacement mechanism can be overly aggressive - it sometimes replaces words that shouldn't be replaced. However, removing those entries from the custom words list means the desired words never appear at all.
I know that Whisper supports an "initial prompt" concept, which biases the model toward producing specific words without forcefully replacing output. While looking through the codebase, I noticed there appears to be a way to use custom words to generate an initial prompt, and I wanted to ask whether a pull request for this would be welcome.
Related Issues/Discussions
Fixes #
Discussion: #1009
Community Feedback
Testing
No unit tests for this. I built and used this on my machine. The use case I was working on was "CLI" and "call" - that was fun to see in transcripts once I noticed it :)
Screenshots/Videos (if applicable)
AI Assistance
If AI was used: