Merge pull request #4012 from pipecat-ai/mb/deprecate-old-local-smart-turn
This commit is contained in:
1
changelog/4012.deprecated.md
Normal file
1
changelog/4012.deprecated.md
Normal file
@@ -0,0 +1 @@
|
|||||||
|
- Deprecated `LocalSmartTurnAnalyzerV2` and `LocalCoreMLSmartTurnAnalyzer`. Use `LocalSmartTurnAnalyzerV3` instead. Instantiating these analyzers will now emit a `DeprecationWarning`.
|
||||||
@@ -10,6 +10,7 @@ This module provides a smart turn analyzer that uses CoreML models for
|
|||||||
local end-of-turn detection without requiring network connectivity.
|
local end-of-turn detection without requiring network connectivity.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import warnings
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -35,6 +36,10 @@ class LocalCoreMLSmartTurnAnalyzer(BaseSmartTurn):
|
|||||||
Provides end-of-turn detection using locally-stored CoreML models,
|
Provides end-of-turn detection using locally-stored CoreML models,
|
||||||
enabling offline operation without network dependencies. Optimized
|
enabling offline operation without network dependencies. Optimized
|
||||||
for Apple Silicon and other CoreML-compatible hardware.
|
for Apple Silicon and other CoreML-compatible hardware.
|
||||||
|
|
||||||
|
.. deprecated:: 0.0.106
|
||||||
|
LocalCoreMLSmartTurnAnalyzer is deprecated and will be removed in a future version.
|
||||||
|
Use LocalSmartTurnAnalyzerV3 instead.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *, smart_turn_model_path: str, **kwargs):
|
def __init__(self, *, smart_turn_model_path: str, **kwargs):
|
||||||
@@ -50,6 +55,15 @@ class LocalCoreMLSmartTurnAnalyzer(BaseSmartTurn):
|
|||||||
"""
|
"""
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"LocalCoreMLSmartTurnAnalyzer is deprecated and will be removed in a future "
|
||||||
|
"version. Use LocalSmartTurnAnalyzerV3 instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
if not smart_turn_model_path:
|
if not smart_turn_model_path:
|
||||||
logger.error("smart_turn_model_path is not set.")
|
logger.error("smart_turn_model_path is not set.")
|
||||||
raise Exception("smart_turn_model_path must be provided.")
|
raise Exception("smart_turn_model_path must be provided.")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class LocalSmartTurnAnalyzer(BaseSmartTurn):
|
|||||||
enabling offline operation without network dependencies. Uses
|
enabling offline operation without network dependencies. Uses
|
||||||
Wav2Vec2-BERT architecture for audio sequence classification.
|
Wav2Vec2-BERT architecture for audio sequence classification.
|
||||||
|
|
||||||
.. deprecated:: 0.98.0
|
.. deprecated:: 0.0.98
|
||||||
LocalSmartTurnAnalyzer is deprecated and will be removed in a future version.
|
LocalSmartTurnAnalyzer is deprecated and will be removed in a future version.
|
||||||
Use LocalSmartTurnAnalyzerV3 instead.
|
Use LocalSmartTurnAnalyzerV3 instead.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ This module provides a smart turn analyzer that uses PyTorch models for
|
|||||||
local end-of-turn detection without requiring network connectivity.
|
local end-of-turn detection without requiring network connectivity.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import warnings
|
||||||
from typing import Any, Dict
|
from typing import Any, Dict
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
@@ -41,6 +42,10 @@ class LocalSmartTurnAnalyzerV2(BaseSmartTurn):
|
|||||||
Provides end-of-turn detection using locally-stored PyTorch models,
|
Provides end-of-turn detection using locally-stored PyTorch models,
|
||||||
enabling offline operation without network dependencies. Uses
|
enabling offline operation without network dependencies. Uses
|
||||||
Wav2Vec2 architecture for audio sequence classification.
|
Wav2Vec2 architecture for audio sequence classification.
|
||||||
|
|
||||||
|
.. deprecated:: 0.0.106
|
||||||
|
LocalSmartTurnAnalyzerV2 is deprecated and will be removed in a future version.
|
||||||
|
Use LocalSmartTurnAnalyzerV3 instead.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, *, smart_turn_model_path: str, **kwargs):
|
def __init__(self, *, smart_turn_model_path: str, **kwargs):
|
||||||
@@ -53,6 +58,15 @@ class LocalSmartTurnAnalyzerV2(BaseSmartTurn):
|
|||||||
"""
|
"""
|
||||||
super().__init__(**kwargs)
|
super().__init__(**kwargs)
|
||||||
|
|
||||||
|
with warnings.catch_warnings():
|
||||||
|
warnings.simplefilter("always")
|
||||||
|
warnings.warn(
|
||||||
|
"LocalSmartTurnAnalyzerV2 is deprecated and will be removed in a future version. "
|
||||||
|
"Use LocalSmartTurnAnalyzerV3 instead.",
|
||||||
|
DeprecationWarning,
|
||||||
|
stacklevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
if not smart_turn_model_path:
|
if not smart_turn_model_path:
|
||||||
# Define the path to the pretrained model on Hugging Face
|
# Define the path to the pretrained model on Hugging Face
|
||||||
smart_turn_model_path = "pipecat-ai/smart-turn-v2"
|
smart_turn_model_path = "pipecat-ai/smart-turn-v2"
|
||||||
|
|||||||
Reference in New Issue
Block a user