feat(sdks/python): allow language selection for local Whisper transcription - #13076
feat(sdks/python): allow language selection for local Whisper transcription#13076Aj2280 wants to merge 1 commit into
Conversation
…iption Allow passing language (e.g. "de", "es", or None for auto-detection) to WhisperTranscriber instead of hardcoding language="en". - Update WhisperTranscriber.__init__ with language: Optional[str] = "en" - Pass language=self.language to model.transcribe() - Preserve injected runner bytes-only contract - Add unit tests verifying language forwarding and runner contract - Document local Whisper language selection in README and docs - Run hermetic SDK unit tests in Python CLI CI workflow Fixes BasedHardware#13071 Signed-off-by: Abhi <108084481+Aj2280@users.noreply.github.com> Co-authored-by: Theodor Frank <33786175+TheoFrk@users.noreply.github.com>
There was a problem hiding this comment.
2 issues found across 5 files
Confidence score: 4/5
.github/workflows/python-cli-ci.ymlinstallspytestandnumpywithout pinned versions, so SDK test outcomes can change as PyPI releases move; use a checked-in constraints or lock file..github/workflows/python-cli-ci.ymlnow triggers the fulltestsmatrix for SDK-only changes, adding unnecessary Linux and Windows CI work for a suite that does not depend onomi-sdk; narrow the path/job conditions or separate the SDK trigger.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name=".github/workflows/python-cli-ci.yml">
<violation number="1" location=".github/workflows/python-cli-ci.yml:8">
P3: Adding `sdks/python/**` to the workflow's `paths` filter makes the unrelated `tests` matrix job (the omi-cli suite across Linux 3.10/3.12 and Windows) run on every SDK-only change. omi-cli does not depend on omi-sdk, so those jobs add no signal to SDK PRs and can block them on unrelated CLI failures. Give the SDK test job its own workflow (or separate path trigger) scoped to `sdks/python/**` instead of widening the shared workflow-wide filter.</violation>
<violation number="2" location=".github/workflows/python-cli-ci.yml:37">
P2: The SDK test job is not reproducible because `pip install pytest numpy` resolves unpinned PyPI versions on every run. Install test dependencies from a checked-in, pinned constraints or lock file.</violation>
</file>
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
| with: | ||
| python-version: '3.10' | ||
| - name: Install hermetic SDK test dependencies | ||
| run: python -m pip install pytest numpy |
There was a problem hiding this comment.
P2: The SDK test job is not reproducible because pip install pytest numpy resolves unpinned PyPI versions on every run. Install test dependencies from a checked-in, pinned constraints or lock file.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/python-cli-ci.yml, line 37:
<comment>The SDK test job is not reproducible because `pip install pytest numpy` resolves unpinned PyPI versions on every run. Install test dependencies from a checked-in, pinned constraints or lock file.</comment>
<file context>
@@ -20,6 +22,24 @@ defaults:
+ with:
+ python-version: '3.10'
+ - name: Install hermetic SDK test dependencies
+ run: python -m pip install pytest numpy
+ - name: Run SDK tests without devices or model downloads
+ run: python -m pytest -q
</file context>
| branches: [main] | ||
| paths: | ||
| - 'sdks/python-cli/**' | ||
| - 'sdks/python/**' |
There was a problem hiding this comment.
P3: Adding sdks/python/** to the workflow's paths filter makes the unrelated tests matrix job (the omi-cli suite across Linux 3.10/3.12 and Windows) run on every SDK-only change. omi-cli does not depend on omi-sdk, so those jobs add no signal to SDK PRs and can block them on unrelated CLI failures. Give the SDK test job its own workflow (or separate path trigger) scoped to sdks/python/** instead of widening the shared workflow-wide filter.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/workflows/python-cli-ci.yml, line 8:
<comment>Adding `sdks/python/**` to the workflow's `paths` filter makes the unrelated `tests` matrix job (the omi-cli suite across Linux 3.10/3.12 and Windows) run on every SDK-only change. omi-cli does not depend on omi-sdk, so those jobs add no signal to SDK PRs and can block them on unrelated CLI failures. Give the SDK test job its own workflow (or separate path trigger) scoped to `sdks/python/**` instead of widening the shared workflow-wide filter.</comment>
<file context>
@@ -5,11 +5,13 @@ on:
branches: [main]
paths:
- 'sdks/python-cli/**'
+ - 'sdks/python/**'
- '.github/workflows/python-cli-ci.yml'
pull_request:
</file context>
|
Thanks for this — the core change is verified and well built. Review notes below. Verified implementation
CI status
Attribution — needs maintainer ruling before merge
Docs ( by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Hi @Git-on-my-level, thanks for the review and local verification! Regarding attribution:
I've also posted this clarification in #13071 for visibility. Thanks again! |
Summary
This PR enables language selection when using local Whisper transcription via the Python SDK, resolving #13071.
Previously,
sdks/python/omi/stt/whisper.pyhardcodedlanguage="en"in calls tomodel.transcribe(), preventing callers from selecting other languages (e.g., German, Spanish) or requesting automatic language detection (language=None) even when using multilingual models.Changes
sdks/python/omi/stt/whisper.py):language: Optional[str] = "en"toWhisperTranscriber.__init__.self.languageand forwarded it aslanguage=self.languagetoself._model.transcribe(audio, fp16=False, language=self.language).runnercontract (receives raw PCM bytes and manages its own language).sdks/python/tests/test_whisper_language.py):whispermodule covering default ("en"), explicit multilingual code ("de"), and automatic detection (None).runnercontinues to receive raw PCM bytes only.docs/doc/developer/sdk/python.mdx,sdks/python/README.md):Local Whisper language selectiondocumentation and usage examples..github/workflows/python-cli-ci.yml):sdks/python/**path triggers to pull requests and push events.sdk-testsjob to run hermetic Python SDK unit tests using pytest.Verification
PYTHONPATH=sdks/python pytest sdks/python/tests/locally: all 11 tests passed.make preflight: all 18 local manifest checks passed.Fixes #13071