Repository navigation
feat(normalize): allow a separate model/endpoint for normalization - #26
Open
fede-ciliberti wants to merge 1 commit into
Open
fede-ciliberti wants to merge 1 commit into
fede-ciliberti wants to merge 1 commit into
Conversation
Normalization is the cheap pass: STT cleanup after transcription and markdown -> spoken text before TTS. It reused the main endpoint/model, so a large answering model was also doing the normalization. Route both stages through a new createNormalizer() that reads normalizeModel, normalizeEndpoint and normalizeApiKeyEnv, each defaulting to its main counterpart, and expose normalize: false to skip the pass entirely (the STT pipeline already falls back to the raw transcript when normalization fails). Default behaviour is unchanged when no normalize* option is set.
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.
What
Normalization (STT cleanup after transcription, and markdown -> spoken text
before TTS) always used the same
endpoint/modelas everything else, so alarge answering model was also doing the cheap normalization pass.
This routes both normalization stages through a new
createNormalizer()thatreads three optional settings, each defaulting to its main counterpart:
normalizeModelmodelnormalizeEndpointendpointnormalizeApiKeyEnvapiKeyEnvnormalize: falseskips the pass entirely. The STT pipeline already falls backto the raw transcript when normalization fails, so nothing is lost.
Why
Normalization is a short, mechanical rewrite. Pointing it at a small/cheap model
while a bigger one answers is a common setup, and today it is not expressible
without duplicating endpoints.
Compatibility
No
normalize*option set means the exact same client, model and endpoint asbefore: the default path is unchanged.
Verification
lib/normalize.jswithcreateNormalizer(); the single call site inindex.jsuses ittest/normalize.test.js: override of model, default tomodel, override of endpoint and the disabled path (no request issued)npm test24/24,npx oxlint .clean,npx oxfmt --check .clean