Skip to content

feat(stt): pass local initial_prompt to faster-whisper - #50684

Closed
BlackishGreen33 wants to merge 4 commits into
NousResearch:mainfrom
BlackishGreen33:bg/stt-local-initial-prompt-50181
Closed

feat(stt): pass local initial_prompt to faster-whisper#50684
BlackishGreen33 wants to merge 4 commits into
NousResearch:mainfrom
BlackishGreen33:bg/stt-local-initial-prompt-50181

Conversation

@BlackishGreen33

@BlackishGreen33 BlackishGreen33 commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds stt.local.initial_prompt support for the local faster-whisper STT provider.

This lets users bias local transcription output, for example asking Chinese audio to be written in Simplified Chinese. The prompt is only passed when it is configured as a non-empty string, so the current default behavior stays unchanged.

Related Issue

Fixes #50181

Changes Made

  • Read initial_prompt from the existing stt.local config block.
  • Pass initial_prompt to faster-whisper only when it is a non-empty string.
  • Keep the existing language, beam size, and CUDA fallback behavior unchanged.
  • Added tests for configured and blank initial_prompt values.
  • Added the new config key to cli-config.yaml.example.

Configuration Example

stt:
  local:
    language: zh
    initial_prompt: "以下是普通话的句子,使用简体中文。"

Verification

$ ../hermes-agent/venv/bin/python -m pytest tests/tools/test_transcription.py -q
............................                                             [100%]
28 passed in 0.66s

$ git diff --check
# no output

Checklist

  • I searched for existing PRs to make sure this is not a duplicate.
  • This PR only changes local faster-whisper STT initial_prompt handling.
  • I added focused tests for the new config behavior.
  • I updated cli-config.yaml.example for the new config key.

Copilot AI review requested due to automatic review settings June 22, 2026 07:46

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@alt-glitch alt-glitch added type/feature New feature or request tool/tts Text-to-speech and transcription P3 Low — cosmetic, nice to have labels Jun 22, 2026

@teknium1 teknium1 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.

Thanks for the focused implementation. The forwarding behavior is still missing on current main: tools/transcription_tools.py:1131-1142 builds the faster-whisper kwargs with language and beam size only.

Problems

  • The PR documents stt.local.initial_prompt only in cli-config.yaml.example; it does not add the key to the runtime configuration schema at hermes_cli/config.py:2132-2135. New config options should be represented in DEFAULT_CONFIG, so config introspection and default merging know the setting exists.

Suggested changes

  • Add "initial_prompt": "" under DEFAULT_CONFIG["stt"]["local"] and cover the real config-resolution path in addition to the mocked forwarding tests.

This is an automated hermes-sweeper review.

Comment thread cli-config.yaml.example
@teknium1 teknium1 added sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 15, 2026
@BlackishGreen33

Copy link
Copy Markdown
Contributor Author

Follow-up test isolation fix in 142034a0b: test_accepts_null_local_config now removes HERMES_LOCAL_STT_LANGUAGE before asserting the exact faster-whisper kwargs. I reproduced the issue first with the env set to fr (language: fr leaked into the call), then verified the isolated test and the focused transcription/config suites pass.

teknium1 added a commit that referenced this pull request Jul 28, 2026
Class-level fix for the 'STT transcribes the wrong language' issue family
(#55551, #50181 and siblings). Previously language handling was per-provider
chaos: local honoured stt.local.language, Groq/OpenAI/Mistral/DeepInfra sent
no language hint at all, xAI silently forced 'en', ElevenLabs used its own
language_code key, and there was no global setting.

- New _resolve_stt_language() helper: stt.<provider>.language >
  stt.language (new global key) > HERMES_LOCAL_STT_LANGUAGE > auto-detect.
- Threaded through ALL providers: local, local_command, groq, openai,
  mistral, xai, elevenlabs, deepinfra (shared OpenAI handler), command
  providers, and plugin dispatch.
- xAI no longer forces English when nothing is configured (auto-detect).
- Mistral Voxtral now receives a language hint when configured.
- stt.groq.model is now honoured from config (previously env-only).
- DEFAULT_CONFIG gains stt.language, stt.groq, stt.xai, stt.mistral.language.
- Tests: tests/tools/test_stt_language_resolution.py (11 tests, sabotage-
  verified) + full transcription suite green (236 passed).

Builds on cherry-picked contributor work from #19786 (@zombopanda),
#23161 (@materemias), #50684 (@BlackishGreen33).
teknium1 added a commit that referenced this pull request Jul 28, 2026
Class-level fix for the 'STT transcribes the wrong language' issue family
(#55551, #50181 and siblings). Previously language handling was per-provider
chaos: local honoured stt.local.language, Groq/OpenAI/Mistral/DeepInfra sent
no language hint at all, xAI silently forced 'en', ElevenLabs used its own
language_code key, and there was no global setting.

- New _resolve_stt_language() helper: stt.<provider>.language >
  stt.language (new global key) > HERMES_LOCAL_STT_LANGUAGE > auto-detect.
- Threaded through ALL providers: local, local_command, groq, openai,
  mistral, xai, elevenlabs, deepinfra (shared OpenAI handler), command
  providers, and plugin dispatch.
- xAI no longer forces English when nothing is configured (auto-detect).
- Mistral Voxtral now receives a language hint when configured.
- stt.groq.model is now honoured from config (previously env-only).
- DEFAULT_CONFIG gains stt.language, stt.groq, stt.xai, stt.mistral.language.
- Tests: tests/tools/test_stt_language_resolution.py (11 tests, sabotage-
  verified) + full transcription suite green (236 passed).

Builds on cherry-picked contributor work from #19786 (@zombopanda),
#23161 (@materemias), #50684 (@BlackishGreen33).
@teknium1

Copy link
Copy Markdown
Contributor

Merged via PR #73067 — your commit was cherry-picked onto current main with your authorship preserved in git history. Thanks for the contribution! The fix is now part of a unified language resolver covering every STT provider.

@teknium1 teknium1 closed this Jul 28, 2026
@BlackishGreen33
BlackishGreen33 deleted the bg/stt-local-initial-prompt-50181 branch July 28, 2026 04:56
louisgreen0726 pushed a commit to louisgreen0726/hermes-agent that referenced this pull request Aug 7, 2026
Class-level fix for the 'STT transcribes the wrong language' issue family
(NousResearch#55551, NousResearch#50181 and siblings). Previously language handling was per-provider
chaos: local honoured stt.local.language, Groq/OpenAI/Mistral/DeepInfra sent
no language hint at all, xAI silently forced 'en', ElevenLabs used its own
language_code key, and there was no global setting.

- New _resolve_stt_language() helper: stt.<provider>.language >
  stt.language (new global key) > HERMES_LOCAL_STT_LANGUAGE > auto-detect.
- Threaded through ALL providers: local, local_command, groq, openai,
  mistral, xai, elevenlabs, deepinfra (shared OpenAI handler), command
  providers, and plugin dispatch.
- xAI no longer forces English when nothing is configured (auto-detect).
- Mistral Voxtral now receives a language hint when configured.
- stt.groq.model is now honoured from config (previously env-only).
- DEFAULT_CONFIG gains stt.language, stt.groq, stt.xai, stt.mistral.language.
- Tests: tests/tools/test_stt_language_resolution.py (11 tests, sabotage-
  verified) + full transcription suite green (236 passed).

Builds on cherry-picked contributor work from NousResearch#19786 (@zombopanda),
NousResearch#23161 (@materemias), NousResearch#50684 (@BlackishGreen33).
randlee pushed a commit to randlee/hermes-agent that referenced this pull request Aug 11, 2026
Class-level fix for the 'STT transcribes the wrong language' issue family
(NousResearch#55551, NousResearch#50181 and siblings). Previously language handling was per-provider
chaos: local honoured stt.local.language, Groq/OpenAI/Mistral/DeepInfra sent
no language hint at all, xAI silently forced 'en', ElevenLabs used its own
language_code key, and there was no global setting.

- New _resolve_stt_language() helper: stt.<provider>.language >
  stt.language (new global key) > HERMES_LOCAL_STT_LANGUAGE > auto-detect.
- Threaded through ALL providers: local, local_command, groq, openai,
  mistral, xai, elevenlabs, deepinfra (shared OpenAI handler), command
  providers, and plugin dispatch.
- xAI no longer forces English when nothing is configured (auto-detect).
- Mistral Voxtral now receives a language hint when configured.
- stt.groq.model is now honoured from config (previously env-only).
- DEFAULT_CONFIG gains stt.language, stt.groq, stt.xai, stt.mistral.language.
- Tests: tests/tools/test_stt_language_resolution.py (11 tests, sabotage-
  verified) + full transcription suite green (236 passed).

Builds on cherry-picked contributor work from NousResearch#19786 (@zombopanda),
NousResearch#23161 (@materemias), NousResearch#50684 (@BlackishGreen33).
33hodl pushed a commit to 33hodl/hermes-agent that referenced this pull request Aug 12, 2026
Class-level fix for the 'STT transcribes the wrong language' issue family
(NousResearch#55551, NousResearch#50181 and siblings). Previously language handling was per-provider
chaos: local honoured stt.local.language, Groq/OpenAI/Mistral/DeepInfra sent
no language hint at all, xAI silently forced 'en', ElevenLabs used its own
language_code key, and there was no global setting.

- New _resolve_stt_language() helper: stt.<provider>.language >
  stt.language (new global key) > HERMES_LOCAL_STT_LANGUAGE > auto-detect.
- Threaded through ALL providers: local, local_command, groq, openai,
  mistral, xai, elevenlabs, deepinfra (shared OpenAI handler), command
  providers, and plugin dispatch.
- xAI no longer forces English when nothing is configured (auto-detect).
- Mistral Voxtral now receives a language hint when configured.
- stt.groq.model is now honoured from config (previously env-only).
- DEFAULT_CONFIG gains stt.language, stt.groq, stt.xai, stt.mistral.language.
- Tests: tests/tools/test_stt_language_resolution.py (11 tests, sabotage-
  verified) + full transcription suite green (236 passed).

Builds on cherry-picked contributor work from NousResearch#19786 (@zombopanda),
NousResearch#23161 (@materemias), NousResearch#50684 (@BlackishGreen33).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades tool/tts Text-to-speech and transcription type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

STT: 支持 initial_prompt 配置以偏置简体/繁体中文输出

4 participants