From 169b50af61fa87bd645e630ddae38518a823d3c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aleix=20Conchillo=20Flaqu=C3=A9?= Date: Tue, 1 Apr 2025 14:41:07 -0700 Subject: [PATCH] frames: make FunctionCallResultFrame a SystemFrame --- CHANGELOG.md | 3 +++ src/pipecat/frames/frames.py | 38 ++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7584ca409..1da63ef82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,6 +53,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +- `FunctionCallResultFrame`a are now system frames. This is to prevent function + call results to be discarded during interruptions. + - Pipecat services have been reorganized into packages. Each package can have one or more of the following modules (in the future new module names might be needed) depending on the services implemented: diff --git a/src/pipecat/frames/frames.py b/src/pipecat/frames/frames.py index 30d8622d9..72acf1a2a 100644 --- a/src/pipecat/frames/frames.py +++ b/src/pipecat/frames/frames.py @@ -377,25 +377,6 @@ class LLMEnablePromptCachingFrame(DataFrame): enable: bool -@dataclass -class FunctionCallResultProperties: - """Properties for a function call result frame.""" - - run_llm: Optional[bool] = None - on_context_updated: Optional[Callable[[], Awaitable[None]]] = None - - -@dataclass -class FunctionCallResultFrame(DataFrame): - """A frame containing the result of an LLM function (tool) call.""" - - function_name: str - tool_call_id: str - arguments: Any - result: Any - properties: Optional[FunctionCallResultProperties] = None - - @dataclass class TTSSpeakFrame(DataFrame): """A frame that contains a text that should be spoken by the TTS in the @@ -652,6 +633,25 @@ class FunctionCallCancelFrame(SystemFrame): tool_call_id: str +@dataclass +class FunctionCallResultProperties: + """Properties for a function call result frame.""" + + run_llm: Optional[bool] = None + on_context_updated: Optional[Callable[[], Awaitable[None]]] = None + + +@dataclass +class FunctionCallResultFrame(SystemFrame): + """A frame containing the result of an LLM function (tool) call.""" + + function_name: str + tool_call_id: str + arguments: Any + result: Any + properties: Optional[FunctionCallResultProperties] = None + + @dataclass class STTMuteFrame(SystemFrame): """System frame to mute/unmute the STT service."""