Repository navigation
feat(dictation): add stt_prompt to DictationConfig - #249
Merged
Merged
Conversation
The Dictation API takes a transcription prompt describing what the audio is about, distinct from the LLM rewrite instruction. `DictationConfig` had no field for it and rejects unknown keys, so SDK callers could not send one at all. Adds `stt_prompt`, capped at 4096 characters to match the service. The server also accepts `prompt` as an alias, but the SDK exposes only the one spelling: sending both is a 400, and no SDK release has ever accepted `prompt`, so there is no compatibility reason to carry two names. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ccampbell-aai
approved these changes
Sep 10, 2026
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
ccampbell-aai
approved these changes
Sep 10, 2026
aurpsis-aai
marked this pull request as ready for review
September 10, 2026 23:39
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.
Companion to DeepLearning #20090 and docs #348. Gated on the DL PR merging — the parameter name ships there first.
Why
The Dictation API takes two prompts:
stt_prompt, which describes what the audio is about and steers the decoder, andllm_instruction, which reshapes the finished transcript.DictationConfigonly had the second, and it isextra="forbid", so an SDK caller cannot send a transcription prompt at all —DictationConfig(prompt=...)raises today.What changed
stt_prompt: Optional[str]onDictationConfig, capped at 4096 characters to match the service (_DICTATION_MAX_STT_PROMPT_LEN), with a docstring drawing the line againstllm_instruction.One spelling only. The server accepts
promptas a validation alias for compatibility with callers that integrated before the rename, but no SDK release has ever accepted it, and sending both spellings is a400. Carrying two names here would add a way to fail with nothing to gain, sopromptstays rejected — there's a test pinning that.Version
Patch bump to 1.5.1. 1.5.0 is staged in master and unreleased (latest tag is 1.3.0), so this could have ridden along in it, but a separate patch version keeps the field's arrival visible in the version history.
Not in this PR
prompt— the rename is dictation-only, since sync has no rewrite instruction to be ambiguous against.Tests
pytest tests/unit— 646 pass. Three new tests:stt_promptreaches the wire in the config part, over-cap is rejected, and thepromptspelling is refused.ruff check/ruff format --checkclean.mypy --follow-imports=silent --ignore-missing-importson the changed files reports one error attests/unit/test_dictation.py:198that is present on master unmodified (a Liskov complaint about a fake'sread()signature, from #247) — not introduced here.🤖 Generated with Claude Code