From 5fd6fc99fd81f34ea3f4c946945c32ae42beadad Mon Sep 17 00:00:00 2001 From: James Hush Date: Tue, 19 Nov 2024 13:09:43 +0800 Subject: [PATCH] Apply logs --- src/pipecat/services/ai_services.py | 2 ++ src/pipecat/services/cartesia.py | 2 ++ src/pipecat/services/openai.py | 7 +++++++ 3 files changed, 11 insertions(+) diff --git a/src/pipecat/services/ai_services.py b/src/pipecat/services/ai_services.py index e0f16e220..5c374a0c0 100644 --- a/src/pipecat/services/ai_services.py +++ b/src/pipecat/services/ai_services.py @@ -289,6 +289,7 @@ class TTSService(AIService): async def process_frame(self, frame: Frame, direction: FrameDirection): await super().process_frame(frame, direction) + print(f"_---_ai_services.py process_frame * frame: {frame}") if isinstance(frame, TextFrame): await self._process_text_frame(frame) @@ -343,6 +344,7 @@ class TTSService(AIService): await self._push_tts_frames(text) async def _push_tts_frames(self, text: str): + print(f"_____ai_services.py * push_tts_frames str: {str}") # Don't send only whitespace. This causes problems for some TTS models. But also don't # strip all whitespace, as whitespace can influence prosody. if not text.strip(): diff --git a/src/pipecat/services/cartesia.py b/src/pipecat/services/cartesia.py index ad4636a74..3be99f07f 100644 --- a/src/pipecat/services/cartesia.py +++ b/src/pipecat/services/cartesia.py @@ -140,6 +140,8 @@ class CartesiaTTSService(WordTTSService): def _build_msg( self, text: str = "", continue_transcript: bool = True, add_timestamps: bool = True ): + print(f"_____cartesia.py * _build_msg str: {str}") + voice_config = {} voice_config["mode"] = "id" voice_config["id"] = self._voice_id diff --git a/src/pipecat/services/openai.py b/src/pipecat/services/openai.py index b6927e8dc..2c2c44667 100644 --- a/src/pipecat/services/openai.py +++ b/src/pipecat/services/openai.py @@ -166,6 +166,7 @@ class BaseOpenAILLMService(LLMService): params.update(self._settings["extra"]) chunks = await self._client.chat.completions.create(**params) + print(f"_____openai.py get_chat_completions * chunks: {chunks}") return chunks async def _stream_chat_completions( @@ -202,6 +203,8 @@ class BaseOpenAILLMService(LLMService): function_name = "" arguments = "" tool_call_id = "" + + print(f"_____openai.py * _process_context: tool_call_id {tool_call_id}") await self.start_ttfb_metrics() @@ -239,6 +242,7 @@ class BaseOpenAILLMService(LLMService): # yield a frame containing the function name and the arguments. tool_call = chunk.choices[0].delta.tool_calls[0] + print(f"___________________________openai.py * tool_call_id: {tool_call_id}") if tool_call.index != func_idx: functions_list.append(function_name) arguments_list.append(arguments) @@ -503,6 +507,7 @@ class OpenAIAssistantContextAggregator(LLMAssistantContextAggregator): async def process_frame(self, frame, direction): await super().process_frame(frame, direction) + print(f"___<1>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") # See note above about not calling push_frame() here. if isinstance(frame, StartInterruptionFrame): self._function_calls_in_progress.clear() @@ -525,6 +530,8 @@ class OpenAIAssistantContextAggregator(LLMAssistantContextAggregator): elif isinstance(frame, OpenAIImageMessageFrame): self._pending_image_frame_message = frame await self._push_aggregation() + else: + print(f"___<2>__openai.py * OpenAIAssistantContextAggregator process_frame frame : {frame}") async def _push_aggregation(self): if not (