Skip to content

Refactor ASR input types and enhance CJK handling#2581

Merged
openminddev merged 6 commits into
mainfrom
fix-asr
May 21, 2026
Merged

Refactor ASR input types and enhance CJK handling#2581
openminddev merged 6 commits into
mainfrom
fix-asr

Conversation

@openminddev
Copy link
Copy Markdown
Contributor

Overview

Refactor ASR input types to utilize a plugin format and improve handling of CJK characters in ASR responses.

Type of change

  • Bug fix
  • New feature
  • Documentation improvement
  • Bounty issue submission
  • Other:

Changes

Updated ASR input types to a plugin format and enhanced the logic for processing CJK characters in ASR replies.

Checklist

  • Code complies with style guidelines
  • Self-review completed
  • Documentation updated (if applicable)
  • Local testing completed
  • Tests added/updated (if applicable)

Impact

Changes improve the flexibility of ASR input handling and ensure better performance with CJK character sets. Reviewers should be aware of potential impacts on existing ASR configurations.

Additional Information

No additional information at this time.

Copilot AI review requested due to automatic review settings May 21, 2026 20:29
@openminddev openminddev requested review from a team as code owners May 21, 2026 20:29
@github-actions github-actions Bot added robotics Robotics code changes python Python code config Configuration files labels May 21, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates ASR input handling to be more flexible via configuration and improves ASR reply gating for CJK languages where whitespace tokenization is unreliable.

Changes:

  • Added CJK detection in ASR reply handling to gate “final” transcripts using character length instead of word count.
  • Updated greeting_conversation.json5 to make the ASR input type configurable via an environment-variable-like placeholder.
  • Changed ElevenLabs ASR default websocket endpoint.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/inputs/plugins/google_asr.py Adds CJK detection to decide when to enqueue ASR replies.
src/inputs/plugins/google_asr_rtsp.py Mirrors the CJK gating change for the RTSP variant.
src/inputs/plugins/elevenlabs_asr.py Adds CJK gating and changes the default ElevenLabs ASR websocket URL.
src/inputs/plugins/elevenlabs_asr_rtsp.py Mirrors the CJK gating change for the RTSP variant.
config/greeting_conversation.json5 Makes ASR input type configurable via a placeholder string.

Comment thread config/greeting_conversation.json5 Outdated
Comment thread config/greeting_conversation.json5 Outdated
Comment thread config/greeting_conversation.json5 Outdated
Comment thread src/inputs/plugins/elevenlabs_asr.py Outdated
Comment thread src/inputs/plugins/google_asr.py
Comment thread src/inputs/plugins/elevenlabs_asr_rtsp.py Outdated
Comment thread src/inputs/plugins/google_asr.py
Comment thread src/inputs/plugins/google_asr_rtsp.py
Comment thread src/inputs/plugins/elevenlabs_asr.py Outdated
Comment thread src/inputs/plugins/elevenlabs_asr_rtsp.py Outdated
Rename temporary variable _has_cjk to has_cjk in elevenlabs_asr.py and elevenlabs_asr_rtsp.py and update related conditionals. Also adjust import ordering for re and logging in elevenlabs_asr_rtsp.py and google_asr_rtsp.py to satisfy style/linting. Functional behavior remains unchanged.
Replace the default ASR websocket URL from a local ws address to the secure production wss endpoint at api.openmind.com. Keeps the same path and api_key query parameter and preserves override via config.base_url; this ensures the plugin uses the secure production ASR service by default instead of a local/dev server.
@codecov
Copy link
Copy Markdown

codecov Bot commented May 21, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Add tests for CJK acceptance/rejection logic across ElevenLabs and Google ASR input modules (including RTSP variants). The new tests validate that committed/asr_reply messages containing Chinese, Japanese (hiragana), and Korean (Hangul) are accepted when longer than two characters, while messages of two or fewer CJK characters (and single-character CJK) are rejected. Mixed Latin+CJK messages are also verified to be accepted via the CJK path. Tests use existing provider mocks/patches and assert expected message_buffer behavior to prevent regressions in multilingual ASR handling.
@github-actions github-actions Bot added the tests Test files label May 21, 2026
Replace occurrences of "{ASR_INPUT_PLUGIN:-GoogleASRInput}" with "${ASR_INPUT_PLUGIN:-GoogleASRInput}" in config/greeting_conversation.json5 (three locations). This enables shell-style environment variable expansion with a default of GoogleASRInput instead of keeping the literal brace form.
Clean up test files by removing redundant inline comments in ASR tests. Deleted explanatory comment lines that described character counts/acceptance for CJK examples in tests/tests/inputs/plugins/test_google_asr.py and tests/inputs/plugins/test_elevenlabs_asr_rtsp.py. No test logic was changed—this is a cosmetic cleanup to reduce noise in the test code.
@openminddev openminddev merged commit 7a32ed4 into main May 21, 2026
6 checks passed
@openminddev openminddev deleted the fix-asr branch May 21, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

config Configuration files python Python code robotics Robotics code changes tests Test files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants