diff --git a/examples/foundational/30-observer.py b/examples/foundational/30-observer.py index b5d7e51b1..54318884e 100644 --- a/examples/foundational/30-observer.py +++ b/examples/foundational/30-observer.py @@ -29,9 +29,8 @@ from pipecat.observers.loggers.llm_log_observer import LLMLogObserver from pipecat.pipeline.pipeline import Pipeline from pipecat.pipeline.runner import PipelineRunner from pipecat.pipeline.task import PipelineParams, PipelineTask -from pipecat.processors.aggregators.openai_llm_context import ( - OpenAILLMContext, -) +from pipecat.processors.aggregators.llm_context import LLMContext +from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair from pipecat.processors.frame_processor import FrameDirection from pipecat.runner.types import RunnerArguments from pipecat.runner.utils import create_transport @@ -124,8 +123,8 @@ async def run_bot(transport: BaseTransport, runner_args: RunnerArguments): }, ] - context = OpenAILLMContext(messages) - context_aggregator = llm.create_context_aggregator(context) + context = LLMContext(messages) + context_aggregator = LLMContextAggregatorPair(context) pipeline = Pipeline( [ diff --git a/src/pipecat/observers/loggers/llm_log_observer.py b/src/pipecat/observers/loggers/llm_log_observer.py index 53a0ac484..a88f3ca2b 100644 --- a/src/pipecat/observers/loggers/llm_log_observer.py +++ b/src/pipecat/observers/loggers/llm_log_observer.py @@ -11,6 +11,7 @@ from loguru import logger from pipecat.frames.frames import ( FunctionCallInProgressFrame, FunctionCallResultFrame, + LLMContextFrame, LLMFullResponseEndFrame, LLMFullResponseStartFrame, LLMMessagesFrame, @@ -79,10 +80,13 @@ class LLMLogObserver(BaseObserver): f"🧠 {arrow} {dst} LLM MESSAGES FRAME: {frame.messages} at {time_sec:.2f}s" ) # Log OpenAILLMContextFrame (input) - elif isinstance(frame, OpenAILLMContextFrame): - logger.debug( - f"🧠 {arrow} {dst} LLM CONTEXT FRAME: {frame.context.messages} at {time_sec:.2f}s" + elif isinstance(frame, (LLMContextFrame, OpenAILLMContextFrame)): + messages = ( + frame.context.messages + if isinstance(frame, OpenAILLMContextFrame) + else frame.context.get_messages() ) + logger.debug(f"🧠 {arrow} {dst} LLM CONTEXT FRAME: {messages} at {time_sec:.2f}s") # Log function call result (input) elif isinstance(frame, FunctionCallResultFrame): logger.debug(