Skip to content

fix(stt): pass language parameter to Groq Whisper API - #55713

Closed
alaamohanad169-ship-it wants to merge 3 commits into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/55551-groq-stt-language
Closed

fix(stt): pass language parameter to Groq Whisper API#55713
alaamohanad169-ship-it wants to merge 3 commits into
NousResearch:mainfrom
alaamohanad169-ship-it:fix/55551-groq-stt-language

Conversation

@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor

The Groq STT provider ignored stt.groq.language and stt.local.language from config.yaml, forcing auto-detection. This garbled non-English audio (e.g. Hebrew detected as English).

Read language from config (stt.groq.language > stt.local.language) and pass it to client.audio.transcriptions.create() when set.

Fixes #55551

@rodriguez46p-ui

Copy link
Copy Markdown

Hermes Agent Review — PR #55713

Verdict: no blocking issues found.

Scope reviewed: tools/transcription_tools.py change that passes configured stt.groq.language, falling back to stt.local.language, into the Groq/OpenAI-compatible transcription request.

Checks performed:

  • Reviewed PR metadata and diff (gh pr view, gh pr diff --name-only, git diff origin/main...HEAD).
  • Ran an ad-hoc isolated Python probe with a fake OpenAI client to verify:
    • stt.groq.language wins over stt.local.language.
    • stt.local.language is used as fallback.
    • no language kwarg is sent when neither config value is set.
  • Ran git diff --check origin/main...HEAD.
  • Rechecked hosted CI: all required checks are passing; Docker image builds remain in progress/non-required at review time.

Notes:

  • The behavior looks correct and low-risk.
  • A focused regression test for _transcribe_groq language propagation would be useful, but I do not consider it blocking given the small diff and passing ad-hoc probe/CI.

Ad-hoc probe result:
AD_HOC_GROQ_LANGUAGE_PASS calls= 3 last_keys= ['file', 'model', 'response_format']

Reviewed by Hermes Agent hourly commander.

@alt-glitch alt-glitch added type/bug Something isn't working tool/tts Text-to-speech and transcription provider/openai OpenAI / Codex Responses API P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 30, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.
Duplicate of #55608 — same fix (pass stt.groq.language / stt.local.language to the Groq Whisper transcription call in tools/transcription_tools.py), both targeting #55551. #55608 is the earlier open PR and is the canonical one.

@alt-glitch alt-glitch added P2 Medium — degraded but workaround exists and removed duplicate This issue or pull request already exists provider/openai OpenAI / Codex Responses API P3 Low — cosmetic, nice to have labels Jul 4, 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 fix. Current main still lacks language in the Groq request at tools/transcription_tools.py:1297-1301, so the reported behavior remains reproducible by code inspection.

Problems

  • tools/transcription_tools.py:1294 in this PR is not null-safe: stt.groq: null makes .get("groq", {}) return None, then .get("language") raises before the function's try block. Current main's provider reads use .get("section") or {} after null-guard hardening in 3a394210ffae0358100e9d14cf1639f764d7eab7.
  • The PR changes only tools/transcription_tools.py; no regression test covers this new configuration-resolution behavior.

Suggested changes

  • Load the STT config once and use null-safe groq and local section lookups.
  • Add tests for Groq override, local fallback, no configured language, and stt.groq: null.

Automated hermes-sweeper review.

Comment thread tools/transcription_tools.py Outdated

# Language: config.yaml (stt.groq.language > stt.local.language) > auto-detect.
language = (
_load_stt_config().get("groq", {}).get("language")

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.

stt.groq has no default subsection, so a user configuration containing stt.groq: null makes this expression call .get() on None before the surrounding try block. Please match current main's null-safe provider pattern: (stt_config.get("groq") or {}).get("language").

@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
The Groq STT provider ignored stt.groq.language and stt.local.language
from config.yaml, forcing auto-detection. This garbled non-English audio
(e.g. Hebrew detected as English).

Read language from config (stt.groq.language > stt.local.language) and
pass it to client.audio.transcriptions.create() when set.

Fixes #55551
… lookup

stt_config.get("groq", {}).get("language") crashes when stt.groq is
explicitly null in config because .get(key, {}) only returns {} when the
key is MISSING, not when it's present-but-None. The or {} pattern matches
commit 3a39421 which fixed sibling sites throughout the file but
missed the groq lookup.

Also caches the _load_stt_config() call to a local var instead of calling
it twice.

Tests: Groq override present, local fallback, no language configured, and
stt.groq: null (the crash case).
@alaamohanad169-ship-it
alaamohanad169-ship-it force-pushed the fix/55551-groq-stt-language branch from 52c49f7 to 258586d Compare July 25, 2026 22:47
…+ mock file I/O

The test was patching 'tools.transcription_tools.OpenAI' but the code imports
OpenAI from 'openai' module inside the function. Fixed by patching 'openai.OpenAI'
instead. Also added mock for file I/O since the function actually tries to open
the audio file.
@alaamohanad169-ship-it

Copy link
Copy Markdown
Contributor Author

👋 All CI checks are passing (fixed test mocking for Groq STT language config). Could a maintainer merge this when you have a moment? Thanks!

@alt-glitch alt-glitch added needs-decision Awaiting maintainer decision before any implementation and removed sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades labels Jul 26, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Resolved by PR #73067, which unified language resolution across all STT providers (stt..language > global stt.language > env > auto-detect). The Groq language parameter fix from #23161 (earliest submitter, credited) plus the OpenAI/local halves were salvaged there with authorship preserved. Your analysis of the Groq auto-detect failure was spot on — thanks for the work, and sorry we couldn't take both duplicate implementations.

@teknium1 teknium1 closed this Jul 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-decision Awaiting maintainer decision before any implementation P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform tool/tts Text-to-speech and transcription type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Groq STT missing language parameter — poor non-English transcription

4 participants