Use logger.warning instead of warnings.warn for deprecation message

- Makes deprecation warning visible in logs without needing Python warning flags
- Users will see the warning during normal operation
This commit is contained in:
zack
2026-03-01 11:39:00 -05:00
parent d1cbc81108
commit 5de495cc98

View File

@@ -11,8 +11,8 @@ transcription WebSocket messages and connection configuration.
""" """
from typing import List, Literal, Optional from typing import List, Literal, Optional
import warnings
from loguru import logger
from pydantic import BaseModel, ConfigDict, Field, model_validator from pydantic import BaseModel, ConfigDict, Field, model_validator
@@ -166,11 +166,9 @@ class AssemblyAIConnectionParams(BaseModel):
def handle_deprecated_param(self): def handle_deprecated_param(self):
"""Handle deprecated min_end_of_turn_silence_when_confident parameter.""" """Handle deprecated min_end_of_turn_silence_when_confident parameter."""
if self.min_end_of_turn_silence_when_confident is not None: if self.min_end_of_turn_silence_when_confident is not None:
warnings.warn( logger.warning(
"The 'min_end_of_turn_silence_when_confident' parameter is deprecated and will be " "The 'min_end_of_turn_silence_when_confident' parameter is deprecated and will be "
"removed in a future version. Please use 'min_turn_silence' instead.", "removed in a future version. Please use 'min_turn_silence' instead."
DeprecationWarning,
stacklevel=2,
) )
# If min_turn_silence is not set, use the deprecated value # If min_turn_silence is not set, use the deprecated value
if self.min_turn_silence is None: if self.min_turn_silence is None: