Skip to content

Send custom vocabulary as biasing prompt to custom transcription endpoints - #849

Open
tejadhith wants to merge 1 commit into
Beingpax:mainfrom
tejadhith:feature/custom-endpoint-vocabulary
Open

tejadhith wants to merge 1 commit into
Beingpax:mainfrom
tejadhith:feature/custom-endpoint-vocabulary

Conversation

@tejadhith

@tejadhith tejadhith commented Jul 30, 2026 •

Copy link
Copy Markdown

Problem

The custom dictionary (Vocabulary) is passed to the built-in cloud providers, but the custom OpenAI-compatible path never receives it. Users running models like gpt-4o-transcribe on custom or Azure OpenAI endpoints get no transcription-time term biasing — every technical term, product name, or proper noun in their dictionary is ignored until post-hoc word replacement, which can't fix words the model never produced.

Change

  • New shared helper VocabularyBiasingPrompt builds a framed instruction from the vocabulary — "The audio may reference the following names, products, and technical terms — transcribe any occurrences using these exact spellings: …" — rather than a bare comma list (a bare list gives instruction-following transcription models no guidance on what to do with it). Terms are trimmed, case-insensitively deduped, and capped at 200 to stay inside prompt budgets.
  • OpenAICompatibleTranscriptionService emits the result as the multipart prompt field — only when there is something to send.
  • CloudTranscriptionService passes the dictionary terms into the custom-model path (it already fetched them for built-in providers).

The helper is deliberately shared so other providers can adopt the same biasing format.

Relationship to the prompt-scoping change

This intentionally does not reintroduce the user's free-form TranscriptionPrompt on custom endpoints: cde93d3 ("Scope transcription prompts to Whisper models") nils context.prompt at the source for non-Whisper models, and that stays exactly as is. What's sent here is a different, narrower thing — a short app-constructed instruction derived only from the user's Vocabulary entries; with an empty dictionary the field is not sent and the request is byte-identical to today's.

prompt is part of the OpenAI transcription API spec, so OpenAI-compatible endpoints are expected to accept (or ignore) the field; if you'd rather make this opt-in per custom model, happy to add a toggle.

Testing

Verified against an Azure OpenAI gpt-4o-transcribe deployment: a product name the model consistently mis-heard is transcribed with the exact expected spelling once added to the Vocabulary, and the empty-dictionary case was confirmed to send no prompt field.


Summary by cubic

Pass custom vocabulary to OpenAI-compatible transcription endpoints as a biasing prompt so custom models like gpt-4o-transcribe use exact term spellings during transcription. No prompt is sent when the dictionary is empty.

  • New Features
    • Added VocabularyBiasingPrompt to build a short instruction from trimmed, deduped terms (max 200).
    • OpenAICompatibleTranscriptionService sends it as the multipart prompt when non-empty; otherwise unchanged.
    • CloudTranscriptionService now forwards vocabulary to custom models; this does not re-enable free-form user prompts for non-Whisper models.

Written for commit 92c5d98. Summary will update on new commits.

Review in cubic

…oints

The Vocabulary is sent to built-in cloud providers but never reaches the
custom OpenAI-compatible path, so models like gpt-4o-transcribe on custom or
Azure endpoints get no term biasing. Build a framed instruction from the
deduped terms (capped at 200) and emit it as the multipart prompt field.
The prompt builder is a shared helper so other providers can reuse it.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 3 files

Re-trigger cubic

This branch has not been deployed

No deployments
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