Skip to content

feat(normalize): allow a separate model/endpoint for normalization - #26

Open
fede-ciliberti wants to merge 1 commit into
renjfk:mainfrom
fede-ciliberti:pr/normalize-model
Open

fede-ciliberti wants to merge 1 commit into
renjfk:mainfrom
fede-ciliberti:pr/normalize-model

Conversation

@fede-ciliberti

Copy link
Copy Markdown

What

Normalization (STT cleanup after transcription, and markdown -> spoken text
before TTS) always used the same endpoint/model as everything else, so a
large answering model was also doing the cheap normalization pass.

This routes both normalization stages through a new createNormalizer() that
reads three optional settings, each defaulting to its main counterpart:

Option Default
normalizeModel model
normalizeEndpoint endpoint
normalizeApiKeyEnv apiKeyEnv

normalize: false skips the pass entirely. The STT pipeline already falls back
to 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 as
before: the default path is unchanged.

Verification

  • lib/normalize.js with createNormalizer(); the single call site in
    index.js uses it
  • 4 new tests in test/normalize.test.js: override of model, default to
    model, override of endpoint and the disabled path (no request issued)
  • npm test 24/24, npx oxlint . clean, npx oxfmt --check . clean

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant