Skip to content

feat(dictation): add stt_prompt to DictationConfig - #249

Merged
aurpsis-aai merged 2 commits into
masterfrom
aurpsis/dictation-stt-prompt
Sep 10, 2026
Merged

aurpsis-aai merged 2 commits into
masterfrom
aurpsis/dictation-stt-prompt

Conversation

@aurpsis-aai

@aurpsis-aai aurpsis-aai commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

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, and llm_instruction, which reshapes the finished transcript. DictationConfig only had the second, and it is extra="forbid", so an SDK caller cannot send a transcription prompt at all — DictationConfig(prompt=...) raises today.

What changed

  • stt_prompt: Optional[str] on DictationConfig, capped at 4096 characters to match the service (_DICTATION_MAX_STT_PROMPT_LEN), with a docstring drawing the line against llm_instruction.
  • README — the field in the "Configure the dictation" example, and a sentence on which prompt does what.

One spelling only. The server accepts prompt as 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 a 400. Carrying two names here would add a way to fail with nothing to gain, so prompt stays 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

  • The Node SDK needs nothing. It has no dictation surface at all; nothing to add a field to.
  • Sync STT is unaffected. Its parameter is still 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_prompt reaches the wire in the config part, over-cap is rejected, and the prompt spelling is refused.

ruff check / ruff format --check clean. mypy --follow-imports=silent --ignore-missing-imports on the changed files reports one error at tests/unit/test_dictation.py:198 that is present on master unmodified (a Liskov complaint about a fake's read() signature, from #247) — not introduced here.

🤖 Generated with Claude Code

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>
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@aurpsis-aai
aurpsis-aai marked this pull request as ready for review September 10, 2026 23:39
@aurpsis-aai
aurpsis-aai merged commit 754d98e into master Sep 10, 2026
8 checks passed
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.

2 participants