LLMUserAggregator: show error if using turn analyzer in transport
This commit is contained in:
@@ -44,6 +44,7 @@ from pipecat.frames.frames import (
|
|||||||
LLMThoughtEndFrame,
|
LLMThoughtEndFrame,
|
||||||
LLMThoughtStartFrame,
|
LLMThoughtStartFrame,
|
||||||
LLMThoughtTextFrame,
|
LLMThoughtTextFrame,
|
||||||
|
SpeechControlParamsFrame,
|
||||||
StartFrame,
|
StartFrame,
|
||||||
TextFrame,
|
TextFrame,
|
||||||
TranscriptionFrame,
|
TranscriptionFrame,
|
||||||
@@ -300,6 +301,8 @@ class LLMUserAggregator(LLMContextAggregator):
|
|||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
elif isinstance(frame, LLMSetToolChoiceFrame):
|
elif isinstance(frame, LLMSetToolChoiceFrame):
|
||||||
self.set_tool_choice(frame.tool_choice)
|
self.set_tool_choice(frame.tool_choice)
|
||||||
|
elif isinstance(frame, SpeechControlParamsFrame):
|
||||||
|
await self._handle_speech_control_params(frame)
|
||||||
else:
|
else:
|
||||||
await self.push_frame(frame, direction)
|
await self.push_frame(frame, direction)
|
||||||
|
|
||||||
@@ -367,6 +370,16 @@ class LLMUserAggregator(LLMContextAggregator):
|
|||||||
if frame.run_llm:
|
if frame.run_llm:
|
||||||
await self.push_context_frame()
|
await self.push_context_frame()
|
||||||
|
|
||||||
|
async def _handle_speech_control_params(self, frame: SpeechControlParamsFrame):
|
||||||
|
if not frame.turn_params:
|
||||||
|
return
|
||||||
|
|
||||||
|
logger.error(
|
||||||
|
f"{self}: turn_analyzer in base input transport is deprecated and "
|
||||||
|
"might result in unexpected behavior. Use PipelineTask's turn_start_strategies with "
|
||||||
|
"TurnAnalyzerBotTurnStartStrategy instead."
|
||||||
|
)
|
||||||
|
|
||||||
async def _handle_transcription(self, frame: TranscriptionFrame):
|
async def _handle_transcription(self, frame: TranscriptionFrame):
|
||||||
text = frame.text
|
text = frame.text
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user