diff --git a/CHANGELOG.md b/CHANGELOG.md index 142605f90..599e316f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `LLMUserResponseAggregator` and `LLMAssistantResponseAggregator` internal messages are now exposed through the `messages` property. +### Fixed + +- Fixed an issue where `LLMAssistantResponseAggregator` was not accumulating the + full response but short sentences instead. If there's an interruption we only + accumulate what the bot has spoken until now in a long response as well. + ## [0.0.18] - 2024-05-20 ### Fixed diff --git a/src/pipecat/processors/aggregators/llm_response.py b/src/pipecat/processors/aggregators/llm_response.py index 3886b0ff9..c24289737 100644 --- a/src/pipecat/processors/aggregators/llm_response.py +++ b/src/pipecat/processors/aggregators/llm_response.py @@ -11,12 +11,11 @@ from pipecat.frames.frames import ( Frame, InterimTranscriptionFrame, LLMFullResponseEndFrame, + LLMFullResponseStartFrame, LLMMessagesFrame, - LLMResponseStartFrame, StartInterruptionFrame, - TextFrame, - LLMResponseEndFrame, TranscriptionFrame, + TextFrame, UserStartedSpeakingFrame, UserStoppedSpeakingFrame) @@ -103,6 +102,8 @@ class LLMResponseAggregator(FrameProcessor): elif self._interim_accumulator_frame and isinstance(frame, self._interim_accumulator_frame): self._seen_interim_results = True elif isinstance(frame, StartInterruptionFrame): + await self._push_aggregation() + # Reset anyways self._reset() await self.push_frame(frame, direction) else: @@ -133,8 +134,8 @@ class LLMAssistantResponseAggregator(LLMResponseAggregator): super().__init__( messages=messages, role="assistant", - start_frame=LLMResponseStartFrame, - end_frame=LLMResponseEndFrame, + start_frame=LLMFullResponseStartFrame, + end_frame=LLMFullResponseEndFrame, accumulator_frame=TextFrame )