fix(turns): defer LocalSmartTurnAnalyzerV3 import to avoid loading transformers at module load
Importing pipecat.turns.user_turn_strategies pulled in LocalSmartTurnAnalyzerV3 → transformers → onnxruntime at module load time. Since this module is imported by llm_response_universal (and therefore most LLM services), any LLM service import paid the cost of loading transformers and triggered its missing-backend warning in environments without PyTorch/TF/Flax. Move the LocalSmartTurnAnalyzerV3 import into default_user_turn_stop_strategies() so it only loads when the default smart-turn strategy is actually constructed. Fixes #4392
This commit is contained in:
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
|
|
||||||
from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
|
|
||||||
from pipecat.turns.user_start import (
|
from pipecat.turns.user_start import (
|
||||||
BaseUserTurnStartStrategy,
|
BaseUserTurnStartStrategy,
|
||||||
ExternalUserTurnStartStrategy,
|
ExternalUserTurnStartStrategy,
|
||||||
@@ -44,6 +43,8 @@ def default_user_turn_stop_strategies() -> list[BaseUserTurnStopStrategy]:
|
|||||||
Returns ``[TurnAnalyzerUserTurnStopStrategy(LocalSmartTurnAnalyzerV3)]``.
|
Returns ``[TurnAnalyzerUserTurnStopStrategy(LocalSmartTurnAnalyzerV3)]``.
|
||||||
Useful when building a custom strategy list that extends the defaults.
|
Useful when building a custom strategy list that extends the defaults.
|
||||||
"""
|
"""
|
||||||
|
from pipecat.audio.turn.smart_turn.local_smart_turn_v3 import LocalSmartTurnAnalyzerV3
|
||||||
|
|
||||||
return [TurnAnalyzerUserTurnStopStrategy(turn_analyzer=LocalSmartTurnAnalyzerV3())]
|
return [TurnAnalyzerUserTurnStopStrategy(turn_analyzer=LocalSmartTurnAnalyzerV3())]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user