diff --git a/CHANGELOG.md b/CHANGELOG.md index 865f75676..60f5c4de4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +- Added a new `StopFrame` which can be used to stop a pipeline task while + keeping the frame processors running. The frame processors could then be used + in a different pipeline. The difference between a `StopFrame` and a + `StopTaskFrame` is that, as with `EndFrame` and `EndTaskFrame`, the + `StopFrame` is pushed from the task and the `StopTaskFrame` is pushed upstream + inside the pipeline by any processor. + - Added a new `PipelineTask` parameter `observers` that replaces the previous `PipelineParams.observers`. diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index c9b812a1c..3e11a7a19 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -513,9 +513,9 @@ class CancelTaskFrame(SystemFrame): @dataclass class StopTaskFrame(SystemFrame): - """Indicates that a pipeline task should be stopped but that the pipeline - processors should be kept in a running state. This is normally queued from - the pipeline task. + """This is used to notify the pipeline task that it should be stopped as + soon as possible (flushing all the queued frames) but that the pipeline + processors should be kept in a running state. """ @@ -722,6 +722,17 @@ class EndFrame(ControlFrame): pass +@dataclass +class StopFrame(ControlFrame): + """Indicates that a pipeline should be stopped but that the pipeline + processors should be kept in a running state. This is normally queued from + the pipeline task. + + """ + + pass + + @dataclass class LLMFullResponseStartFrame(ControlFrame): """Used to indicate the beginning of an LLM response. Following by one or