Refactor for new on_context_updated callback and new frame properties

This commit is contained in:
Mark Backman
2025-01-13 17:20:41 -05:00
parent 1ca6ecc46e
commit 8c0ecb89de
7 changed files with 67 additions and 43 deletions

View File

@@ -5,7 +5,7 @@
#
from dataclasses import dataclass, field
from typing import Any, List, Literal, Mapping, Optional, Tuple
from typing import Any, Awaitable, Callable, List, Literal, Mapping, Optional, Tuple
from pipecat.audio.vad.vad_analyzer import VADParams
from pipecat.clocks.base_clock import BaseClock
@@ -321,6 +321,14 @@ 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."""
@@ -329,8 +337,7 @@ class FunctionCallResultFrame(DataFrame):
tool_call_id: str
arguments: str
result: Any
run_llm: bool = True
override_run_llm: bool = False
properties: Optional[FunctionCallResultProperties] = None
@dataclass