Merge pull request #3219 from pipecat-ai/mb/deprecate-fal-smart-turn

This commit is contained in:
Mark Backman
2025-12-10 13:13:44 -05:00
committed by GitHub
3 changed files with 29 additions and 0 deletions

View File

@@ -0,0 +1 @@
- `FalSmartTurnAnalyzer` and `LocalSmartTurnAnalyzer` are deprecated and will be removed in a future version. Use `LocalSmartTurnAnalyzerV3` instead.

View File

@@ -14,6 +14,7 @@ Note: To learn more about the smart-turn model, visit:
- https://github.com/pipecat-ai/smart-turn - https://github.com/pipecat-ai/smart-turn
""" """
import warnings
from typing import Optional from typing import Optional
import aiohttp import aiohttp
@@ -26,6 +27,10 @@ class FalSmartTurnAnalyzer(HttpSmartTurnAnalyzer):
Extends HttpSmartTurnAnalyzer to provide integration with Fal.ai's Extends HttpSmartTurnAnalyzer to provide integration with Fal.ai's
smart turn detection API endpoint with proper authentication. smart turn detection API endpoint with proper authentication.
.. deprecated:: 0.98.0
FalSmartTurnAnalyzer is deprecated and will be removed in a future version.
Use LocalSmartTurnAnalyzerV3 instead.
""" """
def __init__( def __init__(
@@ -48,3 +53,12 @@ class FalSmartTurnAnalyzer(HttpSmartTurnAnalyzer):
if api_key: if api_key:
headers = {"Authorization": f"Key {api_key}"} headers = {"Authorization": f"Key {api_key}"}
super().__init__(url=url, aiohttp_session=aiohttp_session, headers=headers, **kwargs) super().__init__(url=url, aiohttp_session=aiohttp_session, headers=headers, **kwargs)
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"FalSmartTurnAnalyzer is deprecated and will be removed in a future version. "
"Use LocalSmartTurnAnalyzerV3 instead.",
DeprecationWarning,
stacklevel=2,
)

View File

@@ -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
@@ -34,6 +35,10 @@ class LocalSmartTurnAnalyzer(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-BERT architecture for audio sequence classification. Wav2Vec2-BERT architecture for audio sequence classification.
.. deprecated:: 0.98.0
LocalSmartTurnAnalyzer 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):
@@ -46,6 +51,15 @@ class LocalSmartTurnAnalyzer(BaseSmartTurn):
""" """
super().__init__(**kwargs) super().__init__(**kwargs)
with warnings.catch_warnings():
warnings.simplefilter("always")
warnings.warn(
"LocalSmartTurnAnalyzer 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" smart_turn_model_path = "pipecat-ai/smart-turn"