Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate stt_service parameter in STTMuteFilter #1176

Merged
merged 2 commits into from
Feb 9, 2025

Conversation

markbackman
Copy link
Contributor

Please describe the changes in your PR. If it is addressing an issue, please reference that as well.

The STTMuteFilter currently takes an STTService parameter but only uses it to check mute state. This is unnecessary coupling since the filter can manage this state internally.

This PR:

  • Makes the stt_service parameter optional
  • Adds a deprecation warning when the parameter is provided
  • Implements internal mute state tracking
  • Maintains full backwards compatibility

I've tested using the 24 example that this doesn't introduce a regression.

**kwargs: Additional arguments passed to parent class
"""

def __init__(self, stt_service: STTService, config: STTMuteConfig, **kwargs):
def __init__(self, config: STTMuteConfig, stt_service: Optional[STTService] = None, **kwargs):
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks like a breaking change, which is fine. We should foce keyword arguments which save us from breaking changes like this:

 def __init__(self, *, config: STTMuteConfig, stt_service: Optional[STTService] = None, **kwargs):

self._config = config
if stt_service is not None:
warnings.warn(
Copy link
Contributor

Choose a reason for hiding this comment

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

Move import warnings here so we can remove the whole block in the future and we don't forget removing the import.

@aconchillo
Copy link
Contributor

LGTM! Minor comments.

@markbackman markbackman merged commit 081abce into main Feb 9, 2025
4 checks passed
@markbackman markbackman deleted the mb/stt-mute-deprecate-stt-service branch February 9, 2025 13:35
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